v3.0.2: improved damage rounding logic in hero.damage()
This commit is contained in:
@@ -1561,34 +1561,41 @@ public class Hero extends Char {
|
|||||||
GLog.w( Messages.get(this, "pain_resist") );
|
GLog.w( Messages.get(this, "pain_resist") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//temporarily assign to a float to avoid rounding a bunch
|
||||||
|
float damage = dmg;
|
||||||
|
|
||||||
Endure.EndureTracker endure = buff(Endure.EndureTracker.class);
|
Endure.EndureTracker endure = buff(Endure.EndureTracker.class);
|
||||||
if (!(src instanceof Char)){
|
if (!(src instanceof Char)){
|
||||||
//reduce damage here if it isn't coming from a character (if it is we already reduced it)
|
//reduce damage here if it isn't coming from a character (if it is we already reduced it)
|
||||||
if (endure != null){
|
if (endure != null){
|
||||||
dmg = Math.round(endure.adjustDamageTaken(dmg));
|
damage = endure.adjustDamageTaken(dmg);
|
||||||
}
|
}
|
||||||
//the same also applies to challenge scroll damage reduction
|
//the same also applies to challenge scroll damage reduction
|
||||||
if (buff(ScrollOfChallenge.ChallengeArena.class) != null){
|
if (buff(ScrollOfChallenge.ChallengeArena.class) != null){
|
||||||
dmg *= 0.67f;
|
damage *= 0.67f;
|
||||||
}
|
}
|
||||||
//and to monk meditate damage reduction
|
//and to monk meditate damage reduction
|
||||||
if (buff(MonkEnergy.MonkAbility.Meditate.MeditateResistance.class) != null){
|
if (buff(MonkEnergy.MonkAbility.Meditate.MeditateResistance.class) != null){
|
||||||
dmg *= 0.2f;
|
damage *= 0.2f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unused, could be removed
|
||||||
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
|
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
|
||||||
if (thorns != null) {
|
if (thorns != null) {
|
||||||
dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this);
|
damage = thorns.proc((int)damage, (src instanceof Char ? (Char)src : null), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
dmg = (int)Math.ceil(dmg * RingOfTenacity.damageMultiplier( this ));
|
|
||||||
|
|
||||||
if (buff(Talent.WarriorFoodImmunity.class) != null){
|
if (buff(Talent.WarriorFoodImmunity.class) != null){
|
||||||
if (pointsInTalent(Talent.IRON_STOMACH) == 1) dmg = Math.round(dmg*0.25f);
|
if (pointsInTalent(Talent.IRON_STOMACH) == 1) damage /= 4f;
|
||||||
else if (pointsInTalent(Talent.IRON_STOMACH) == 2) dmg = Math.round(dmg*0.00f);
|
else if (pointsInTalent(Talent.IRON_STOMACH) == 2) damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dmg = Math.round(damage);
|
||||||
|
|
||||||
|
//we ceil this one to avoid letting the player easily take 0 dmg from tenacity early
|
||||||
|
dmg = (int)Math.ceil(dmg * RingOfTenacity.damageMultiplier( this ));
|
||||||
|
|
||||||
int preHP = HP + shielding();
|
int preHP = HP + shielding();
|
||||||
if (src instanceof Hunger) preHP -= shielding();
|
if (src instanceof Hunger) preHP -= shielding();
|
||||||
super.damage( dmg, src );
|
super.damage( dmg, src );
|
||||||
|
|||||||
Reference in New Issue
Block a user