Use target lifetime rather than construct lifetime when dealing periodic damage; means targets don't all get damaged at once

This commit is contained in:
Electroblob77
2020-01-25 22:50:45 +00:00
parent 40e77728ad
commit 6cd6411c25
3 changed files with 25 additions and 27 deletions
@@ -65,7 +65,7 @@ public class EntityBubble extends EntityMagicConstruct {
if(isDarkOrb){ if(isDarkOrb){
if(WizardryUtilities.getRider(this) != null if(WizardryUtilities.getRider(this) != null
&& this.ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){ && WizardryUtilities.getRider(this).ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){
if(this.getCaster() != null){ if(this.getCaster() != null){
WizardryUtilities.getRider(this).attackEntityFrom( WizardryUtilities.getRider(this).attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC), MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
@@ -103,8 +103,6 @@ public class EntityHammer extends EntityMagicConstruct {
this.rotationPitch = 0; this.rotationPitch = 0;
this.spin = false; this.spin = false;
if(this.ticksExisted % Spells.lightning_hammer.getProperty(LightningHammer.ATTACK_INTERVAL).floatValue() == 0){
double seekerRange = Spells.lightning_hammer.getProperty(Spell.EFFECT_RADIUS).doubleValue(); double seekerRange = Spells.lightning_hammer.getProperty(Spell.EFFECT_RADIUS).doubleValue();
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX,
@@ -115,7 +113,8 @@ public class EntityHammer extends EntityMagicConstruct {
for(EntityLivingBase target : targets){ for(EntityLivingBase target : targets){
if(WizardryUtilities.isLiving(target) && this.isValidTarget(target)){ if(WizardryUtilities.isLiving(target) && this.isValidTarget(target)
&& target.ticksExisted % Spells.lightning_hammer.getProperty(LightningHammer.ATTACK_INTERVAL).floatValue() == 0){
if(world.isRemote){ if(world.isRemote){
@@ -138,7 +137,6 @@ public class EntityHammer extends EntityMagicConstruct {
} }
} }
} }
}
}else{ }else{
@@ -62,7 +62,7 @@ public class EntityHealAura extends EntityMagicConstruct {
target.motionZ = velZ; target.motionZ = velZ;
} }
}else if(target.getHealth() < target.getMaxHealth() && this.ticksExisted % 5 == 0){ }else if(target.getHealth() < target.getMaxHealth() && target.ticksExisted % 5 == 0){
target.heal(Spells.healing_aura.getProperty(Spell.HEALTH).floatValue() * damageMultiplier); target.heal(Spells.healing_aura.getProperty(Spell.HEALTH).floatValue() * damageMultiplier);
} }
} }