diff --git a/src/main/java/electroblob/wizardry/item/ItemArtefact.java b/src/main/java/electroblob/wizardry/item/ItemArtefact.java index 45749116..afc47d74 100644 --- a/src/main/java/electroblob/wizardry/item/ItemArtefact.java +++ b/src/main/java/electroblob/wizardry/item/ItemArtefact.java @@ -493,7 +493,7 @@ public class ItemArtefact extends Item { } @SubscribeEvent - public static void onSpellCastPostEvent(SpellCastEvent.Pre event){ + public static void onSpellCastPostEvent(SpellCastEvent.Post event){ if(event.getCaster() instanceof EntityPlayer){ diff --git a/src/main/java/electroblob/wizardry/registry/Spells.java b/src/main/java/electroblob/wizardry/registry/Spells.java index fd4ee87a..e6327ce9 100644 --- a/src/main/java/electroblob/wizardry/registry/Spells.java +++ b/src/main/java/electroblob/wizardry/registry/Spells.java @@ -241,6 +241,7 @@ public final class Spells { // Wizardry 4.3 spells public static final Spell blinding_flash = placeholder(); + public static final Spell mark_sacrifice = placeholder(); public static final Spell stormcloud = placeholder(); public static final Spell fangs = placeholder(); @@ -452,6 +453,7 @@ public final class Spells { // Wizardry 4.3 spells registry.register(new BlindingFlash()); + registry.register(new MarkSacrifice()); registry.register(new Stormcloud()); registry.register(new Fangs()); diff --git a/src/main/java/electroblob/wizardry/registry/WizardryPotions.java b/src/main/java/electroblob/wizardry/registry/WizardryPotions.java index 8501009f..9f5f7338 100644 --- a/src/main/java/electroblob/wizardry/registry/WizardryPotions.java +++ b/src/main/java/electroblob/wizardry/registry/WizardryPotions.java @@ -55,6 +55,7 @@ public final class WizardryPotions { public static final Potion curse_of_undeath = placeholder(); public static final Potion containment = placeholder(); public static final Potion frost_step = placeholder(); + public static final Potion mark_of_sacrifice = placeholder(); /** * Sets both the registry and unlocalised names of the given potion, then registers it with the given registry. Use @@ -190,6 +191,9 @@ public final class WizardryPotions { registerPotion(registry, "frost_step", new PotionFrostStep(false, 0).setBeneficial()); + registerPotion(registry, "mark_of_sacrifice", new PotionMagicEffect(true, 0xe90e48, + new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mark_of_sacrifice.png"))); + } } \ No newline at end of file diff --git a/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java b/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java new file mode 100644 index 00000000..60217c5a --- /dev/null +++ b/src/main/java/electroblob/wizardry/spell/MarkSacrifice.java @@ -0,0 +1,71 @@ +package electroblob.wizardry.spell; + +import electroblob.wizardry.item.SpellActions; +import electroblob.wizardry.registry.WizardryItems; +import electroblob.wizardry.registry.WizardryPotions; +import electroblob.wizardry.util.EntityUtils; +import electroblob.wizardry.util.ParticleBuilder; +import electroblob.wizardry.util.ParticleBuilder.Type; +import electroblob.wizardry.util.SpellModifiers; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +@EventBusSubscriber +public class MarkSacrifice extends SpellRay { + + private static final float DAMAGE_INCREASE_PER_LEVEL = 0.6f; + + public MarkSacrifice(){ + super("mark_sacrifice", SpellActions.POINT, false); + this.soundValues(1, 1.1f, 0.2f); + addProperties(EFFECT_DURATION, EFFECT_STRENGTH); + } + + @Override + protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ + + if(EntityUtils.isLiving(target)){ + ((EntityLivingBase)target).addPotionEffect(new PotionEffect(WizardryPotions.mark_of_sacrifice, + (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), + getProperty(EFFECT_STRENGTH).intValue() + SpellBuff.getStandardBonusAmplifier(modifiers.get(SpellModifiers.POTENCY)))); + } + + return true; + } + + @Override + protected boolean onBlockHit(World world, BlockPos pos, EnumFacing side, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ + return false; + } + + @Override + protected boolean onMiss(World world, EntityLivingBase caster, Vec3d origin, Vec3d direction, int ticksInUse, SpellModifiers modifiers){ + return true; + } + + @Override + protected void spawnParticle(World world, double x, double y, double z, double vx, double vy, double vz){ + ParticleBuilder.create(Type.DARK_MAGIC).pos(x, y, z).clr(0xe90e48).spawn(world); + ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).time(12 + world.rand.nextInt(8)).clr(0xff7bbb).spawn(world); + } + + @SubscribeEvent + public static void onLivingHurtEvent(LivingHurtEvent event){ + + PotionEffect effect = event.getEntityLiving().getActivePotionEffect(WizardryPotions.mark_of_sacrifice); + + if(effect != null && event.getSource().isMagicDamage()){ + event.setAmount(event.getAmount() * (1 + effect.getAmplifier() * DAMAGE_INCREASE_PER_LEVEL)); + event.getEntityLiving().removePotionEffect(WizardryPotions.mark_of_sacrifice); + } + } + +} diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index ad3878c6..dfa2b95f 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -852,6 +852,7 @@ spell.ebwizardry\:lightning_ray=Lightning Ray spell.ebwizardry\:lightning_sigil=Lightning Sigil spell.ebwizardry\:lightning_web=Lightning Web spell.ebwizardry\:magic_missile=Magic Missile +spell.ebwizardry\:mark_sacrifice=Mark Sacrifice spell.ebwizardry\:metamorphosis=Metamorphosis spell.ebwizardry\:meteor=Meteor spell.ebwizardry\:mind_control=Mind Control @@ -1033,6 +1034,7 @@ spell.ebwizardry\:lightning_ray.desc=Creates a stream of lightning in the direct spell.ebwizardry\:lightning_sigil.desc=Places a magical lightning trap on the ground which damages the creature that triggers it and chains lightning to other nearby creatures. spell.ebwizardry\:lightning_web.desc="Focus. Channel the storm in your mind through your wand and unleash its fury." spell.ebwizardry\:magic_missile.desc=Fires a bolt of magical energy in the direction you are pointing. +spell.ebwizardry\:mark_sacrifice.desc=Marks the target as a divine sacrifice. The next magical attack on a marked creature deals 60%% extra damage for each level of the effect. spell.ebwizardry\:metamorphosis.desc=Changes the target into another form. Only works on some creatures. spell.ebwizardry\:meteor.desc=Some wizards just want to see the world burn... spell.ebwizardry\:mind_control.desc=Takes control of the target's mind for 30 seconds, causing it switch sides and fight for the caster instead. Will not work on creatures that are too strong-willed. diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index 5f294494..27111029 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -852,6 +852,7 @@ spell.ebwizardry\:lightning_ray=Lightning Ray spell.ebwizardry\:lightning_sigil=Lightning Sigil spell.ebwizardry\:lightning_web=Lightning Web spell.ebwizardry\:magic_missile=Magic Missile +spell.ebwizardry\:mark_sacrifice=Mark Sacrifice spell.ebwizardry\:metamorphosis=Metamorphosis spell.ebwizardry\:meteor=Meteor spell.ebwizardry\:mind_control=Mind Control @@ -1033,6 +1034,7 @@ spell.ebwizardry\:lightning_ray.desc=Creates a stream of lightning in the direct spell.ebwizardry\:lightning_sigil.desc=Places a magical lightning trap on the ground which damages the creature that triggers it and chains lightning to other nearby creatures. spell.ebwizardry\:lightning_web.desc="Focus. Channel the storm in your mind through your wand and unleash its fury." spell.ebwizardry\:magic_missile.desc=Fires a bolt of magical energy in the direction you are pointing. +spell.ebwizardry\:mark_sacrifice.desc=Marks the target as a divine sacrifice. The next magical attack on a marked creature deals 60%% extra damage for each level of the effect. spell.ebwizardry\:metamorphosis.desc=Changes the target into another form. Only works on some creatures. spell.ebwizardry\:meteor.desc=Some wizards just want to see the world burn... spell.ebwizardry\:mind_control.desc=Takes control of the target's mind for 30 seconds, causing it switch sides and fight for the caster instead. Will not work on creatures that are too strong-willed. diff --git a/src/main/resources/assets/ebwizardry/spells/mark_sacrifice.json b/src/main/resources/assets/ebwizardry/spells/mark_sacrifice.json new file mode 100644 index 00000000..70ba9bef --- /dev/null +++ b/src/main/resources/assets/ebwizardry/spells/mark_sacrifice.json @@ -0,0 +1,24 @@ +{ + "enabled": { + "book": true, + "scroll": true, + "wands": true, + "npcs": true, + "dispensers": true, + "commands": true, + "treasure": true, + "trades": true, + "looting": true + }, + "tier": "apprentice", + "element": "healing", + "type": "alteration", + "cost": 15, + "chargeup": 0, + "cooldown": 30, + "base_properties": { + "range": 10, + "effect_duration": 300, + "effect_strength": 0 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/textures/gui/potion_icons/mark_of_sacrifice.png b/src/main/resources/assets/ebwizardry/textures/gui/potion_icons/mark_of_sacrifice.png new file mode 100644 index 00000000..1aa8ac87 Binary files /dev/null and b/src/main/resources/assets/ebwizardry/textures/gui/potion_icons/mark_of_sacrifice.png differ diff --git a/src/main/resources/assets/ebwizardry/textures/spells/mark_sacrifice.png b/src/main/resources/assets/ebwizardry/textures/spells/mark_sacrifice.png new file mode 100644 index 00000000..c52f7d24 Binary files /dev/null and b/src/main/resources/assets/ebwizardry/textures/spells/mark_sacrifice.png differ