From 112a562b2df9183fae03017e394ea8946e5717c4 Mon Sep 17 00:00:00 2001 From: ipdnaeip <89097082+ipdnaeip@users.noreply.github.com> Date: Sat, 9 Sep 2023 12:08:38 -0400 Subject: [PATCH] fix: Increased the tick rate of continuous spells (#849) ... and added some checks to make sure the spells don't deal too much with mods that interact with the hurt resistance timer. --- src/main/java/electroblob/wizardry/spell/FireBreath.java | 2 +- src/main/java/electroblob/wizardry/spell/FlameRay.java | 2 +- src/main/java/electroblob/wizardry/spell/FrostRay.java | 2 +- src/main/java/electroblob/wizardry/spell/LifeDrain.java | 2 +- src/main/java/electroblob/wizardry/spell/LightningRay.java | 2 +- src/main/java/electroblob/wizardry/spell/LightningWeb.java | 2 +- src/main/java/electroblob/wizardry/spell/RayOfPurification.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/electroblob/wizardry/spell/FireBreath.java b/src/main/java/electroblob/wizardry/spell/FireBreath.java index 28301d944..a942a221f 100644 --- a/src/main/java/electroblob/wizardry/spell/FireBreath.java +++ b/src/main/java/electroblob/wizardry/spell/FireBreath.java @@ -53,7 +53,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin this.getNameForTranslationFormatted()), true); // This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle // with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry. - }else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){ + }else if(ticksInUse % 10 == 0){ target.setFire((int)(getProperty(BURN_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade))); EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE), diff --git a/src/main/java/electroblob/wizardry/spell/FlameRay.java b/src/main/java/electroblob/wizardry/spell/FlameRay.java index 3a2acaf48..2b1acd0f9 100644 --- a/src/main/java/electroblob/wizardry/spell/FlameRay.java +++ b/src/main/java/electroblob/wizardry/spell/FlameRay.java @@ -56,7 +56,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin this.getNameForTranslationFormatted()), true); // This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle // with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry. - }else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){ + }else if(ticksInUse % 10 == 0){ target.setFire((int)(getProperty(BURN_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade))); EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE), diff --git a/src/main/java/electroblob/wizardry/spell/FrostRay.java b/src/main/java/electroblob/wizardry/spell/FrostRay.java index a995bb7a7..b5f18dd5b 100644 --- a/src/main/java/electroblob/wizardry/spell/FrostRay.java +++ b/src/main/java/electroblob/wizardry/spell/FrostRay.java @@ -65,7 +65,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin (int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)), getProperty(EFFECT_STRENGTH).intValue())); - if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){ + if(ticksInUse % 10 == 0){ float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY); if(target instanceof EntityBlaze || target instanceof EntityMagmaCube) damage *= 2; diff --git a/src/main/java/electroblob/wizardry/spell/LifeDrain.java b/src/main/java/electroblob/wizardry/spell/LifeDrain.java index 81e7a8e53..789e79544 100644 --- a/src/main/java/electroblob/wizardry/spell/LifeDrain.java +++ b/src/main/java/electroblob/wizardry/spell/LifeDrain.java @@ -47,7 +47,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin if(EntityUtils.isLiving(target)){ - if(ticksInUse % 12 == 0){ + if(ticksInUse % 10 == 0){ float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY); diff --git a/src/main/java/electroblob/wizardry/spell/LightningRay.java b/src/main/java/electroblob/wizardry/spell/LightningRay.java index 3e56a1ade..c71139c8e 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningRay.java +++ b/src/main/java/electroblob/wizardry/spell/LightningRay.java @@ -51,7 +51,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin this.getNameForTranslationFormatted()), true); // This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle // with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry. - }else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){ + }else if(ticksInUse % 10 == 0){ EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK), getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY)); diff --git a/src/main/java/electroblob/wizardry/spell/LightningWeb.java b/src/main/java/electroblob/wizardry/spell/LightningWeb.java index 126f57cd9..0b807cd2e 100644 --- a/src/main/java/electroblob/wizardry/spell/LightningWeb.java +++ b/src/main/java/electroblob/wizardry/spell/LightningWeb.java @@ -53,7 +53,7 @@ protected void playSound(World world, double x, double y, double z, int ticksInU @Override protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ - if(EntityUtils.isLiving(target)){ + if(EntityUtils.isLiving(target) && ticksInUse % 10 == 0){ electrocute(world, caster, origin, target, getProperty(PRIMARY_DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY), ticksInUse); diff --git a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java index 07c0c3ce4..150028bb3 100644 --- a/src/main/java/electroblob/wizardry/spell/RayOfPurification.java +++ b/src/main/java/electroblob/wizardry/spell/RayOfPurification.java @@ -58,7 +58,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer) ((EntityPlayer)caster) .sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(), this.getNameForTranslationFormatted()), true); - }else{ + }else if (ticksInUse % 10 == 0) { float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY); // Fire