Projectiles multiplicative speed scaling now only works off the base-damage of the projectile. Quartz is added flat afterwards.

For that purpose Tools now have base-damage saved. For existing tools the damage added by quartz is simply subtracted before the calculation.
This commit is contained in:
Bernhard Bonigl committed 2015-01-30 17:34:30 +01:00
1 parent cfebaef2c3
commit 283c3cf12a
2 files changed
+21 -1

No files matched your search

@@ -280,6 +280,7 @@ public class ToolBuilder
compound.getCompoundTag("InfiTool").setFloat("ModDurability", 0f); //Modifier
compound.getCompoundTag("InfiTool").setBoolean("Broken", false);
compound.getCompoundTag("InfiTool").setInteger("Attack", attack);
compound.getCompoundTag("InfiTool").setInteger("BaseAttack", attack);
compound.getCompoundTag("InfiTool").setInteger("MiningSpeed", headMat.toolSpeed());
compound.getCompoundTag("InfiTool").setInteger("HarvestLevel", headMat.harvestLevel());
@@ -201,7 +201,26 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
}
}
float damage = speed * tags.getInteger("Attack"); // todo: potentially change this back to MathHelper.ceiling_float_int to get 1/2 heart steps back
if(!tags.hasKey("BaseAttack"))
{
// quickly calculate the base attack damage from the actual attack damage and quartz modifiers
// yes, this relies on quartz being the only modifier that modifiers damage, but at the point of writing this
// that is the case, and later tools should have the tag
int atk = tags.getInteger("Attack");
if(tags.hasKey("ModAttack"))
{
int bonusDmg = tags.getIntArray("ModAttack")[0]/24 + 1;
atk -= bonusDmg;
}
tags.setInteger("BaseAttack", atk);
}
float baseAttack = tags.getInteger("BaseAttack");
float totalAttack = tags.getInteger("Attack");
float damage = speed * baseAttack; // todo: potentially change this back to MathHelper.ceiling_float_int to get 1/2 heart steps back
// add quartz damage
damage += (totalAttack - baseAttack);
boolean shotByPlayer = this.shootingEntity != null && this.shootingEntity instanceof EntityPlayer;