Add potency modifier support for forest of thorns
This commit is contained in:
@@ -126,11 +126,14 @@ public class BlockThorns extends BlockBush implements ITileEntityProvider {
|
|||||||
private static boolean applyThornDamage(World world, BlockPos pos, IBlockState state, Entity target){
|
private static boolean applyThornDamage(World world, BlockPos pos, IBlockState state, Entity target){
|
||||||
|
|
||||||
DamageSource source = DamageSource.CACTUS;
|
DamageSource source = DamageSource.CACTUS;
|
||||||
|
float damage = Spells.forest_of_thorns.getProperty(Spell.DAMAGE).floatValue();
|
||||||
|
|
||||||
TileEntity tileentity = world.getTileEntity(state.getValue(HALF) == EnumBlockHalf.UPPER ? pos.down() : pos);
|
TileEntity tileentity = world.getTileEntity(state.getValue(HALF) == EnumBlockHalf.UPPER ? pos.down() : pos);
|
||||||
|
|
||||||
if(tileentity instanceof TileEntityThorns){
|
if(tileentity instanceof TileEntityThorns){
|
||||||
|
|
||||||
|
damage *= ((TileEntityThorns)tileentity).damageMultiplier;
|
||||||
|
|
||||||
EntityLivingBase caster = ((TileEntityThorns)tileentity).getCaster();
|
EntityLivingBase caster = ((TileEntityThorns)tileentity).getCaster();
|
||||||
|
|
||||||
if(!AllyDesignationSystem.isValidTarget(caster, target)) return false; // Don't attack or slow allies of the caster
|
if(!AllyDesignationSystem.isValidTarget(caster, target)) return false; // Don't attack or slow allies of the caster
|
||||||
@@ -141,7 +144,6 @@ public class BlockThorns extends BlockBush implements ITileEntityProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(target.ticksExisted % 20 == 0){
|
if(target.ticksExisted % 20 == 0){
|
||||||
float damage = Spells.forest_of_thorns.getProperty(Spell.DAMAGE).floatValue();
|
|
||||||
EntityUtils.attackEntityWithoutKnockback(target, source, damage);
|
EntityUtils.attackEntityWithoutKnockback(target, source, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ public class ForestOfThorns extends Spell {
|
|||||||
|
|
||||||
((TileEntityThorns)tileentity).setLifetime((int)(getProperty(DURATION).floatValue()
|
((TileEntityThorns)tileentity).setLifetime((int)(getProperty(DURATION).floatValue()
|
||||||
* modifiers.get(WizardryItems.duration_upgrade)));
|
* modifiers.get(WizardryItems.duration_upgrade)));
|
||||||
if(caster != null){
|
|
||||||
((TileEntityThorns)tileentity).setCaster(caster);
|
if(caster != null)((TileEntityThorns)tileentity).setCaster(caster);
|
||||||
}
|
((TileEntityThorns)tileentity).damageMultiplier = modifiers.get(SpellModifiers.POTENCY);
|
||||||
|
|
||||||
((TileEntityThorns)tileentity).sync();
|
((TileEntityThorns)tileentity).sync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class TileEntityThorns extends TileEntityPlayerSave implements ITickable
|
|||||||
private int lifetime;
|
private int lifetime;
|
||||||
private int age;
|
private int age;
|
||||||
|
|
||||||
|
public float damageMultiplier = 1;
|
||||||
|
|
||||||
public TileEntityThorns(){
|
public TileEntityThorns(){
|
||||||
this.lifetime = 600;
|
this.lifetime = 600;
|
||||||
}
|
}
|
||||||
@@ -43,6 +45,7 @@ public class TileEntityThorns extends TileEntityPlayerSave implements ITickable
|
|||||||
ticksExisted = tagCompound.getInteger("timer");
|
ticksExisted = tagCompound.getInteger("timer");
|
||||||
lifetime = tagCompound.getInteger("maxTimer"); // Left as maxTimer for backwards compatibility
|
lifetime = tagCompound.getInteger("maxTimer"); // Left as maxTimer for backwards compatibility
|
||||||
age = tagCompound.getInteger("age");
|
age = tagCompound.getInteger("age");
|
||||||
|
damageMultiplier = tagCompound.getFloat("damageMultiplier");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,6 +54,7 @@ public class TileEntityThorns extends TileEntityPlayerSave implements ITickable
|
|||||||
tagCompound.setInteger("timer", ticksExisted);
|
tagCompound.setInteger("timer", ticksExisted);
|
||||||
tagCompound.setInteger("maxTimer", lifetime);
|
tagCompound.setInteger("maxTimer", lifetime);
|
||||||
tagCompound.setInteger("age", age);
|
tagCompound.setInteger("age", age);
|
||||||
|
tagCompound.setFloat("damageMultiplier", damageMultiplier);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user