I've noticed that within the function AbstractDealDamageHandler.parseDamage(), the variable calcDmgMax accumulates with each monster damage calculation. Is this behavior intended?
long calcDmgMax;
...
for (int i = 0; i < ret.numAttacked; i++) {
int oid = p.readInt();
p.skip(14);
List<Integer> allDamageNumbers = new ArrayList<>();
Monster monster = chr.getMap().getMonsterByOid(oid);
if (chr.getBuffEffect(BuffStat.WK_CHARGE) != null) {
// Charge, so now we need to check elemental effectiveness
int sourceID = chr.getBuffSource(BuffStat.WK_CHARGE);
int level = chr.getBuffedValue(BuffStat.WK_CHARGE);
if (monster != null) {
if (sourceID == WhiteKnight.BW_FIRE_CHARGE || sourceID == WhiteKnight.SWORD_FIRE_CHARGE) {
if (monster.getStats().getEffectiveness(Element.FIRE) == ElementalEffectiveness.WEAK) {
calcDmgMax *= 1.05 + level * 0.015;
}
} else if (sourceID == WhiteKnight.BW_ICE_CHARGE || sourceID == WhiteKnight.SWORD_ICE_CHARGE) {
if (monster.getStats().getEffectiveness(Element.ICE) == ElementalEffectiveness.WEAK) {
calcDmgMax *= 1.05 + level * 0.015;
}
} else if (sourceID == WhiteKnight.BW_LIT_CHARGE || sourceID == WhiteKnight.SWORD_LIT_CHARGE) {
if (monster.getStats().getEffectiveness(Element.LIGHTING) == ElementalEffectiveness.WEAK) {
calcDmgMax *= 1.05 + level * 0.015;
}
} else if (sourceID == Paladin.BW_HOLY_CHARGE || sourceID == Paladin.SWORD_HOLY_CHARGE) {
if (monster.getStats().getEffectiveness(Element.HOLY) == ElementalEffectiveness.WEAK) {
calcDmgMax *= 1.2 + level * 0.015;
}
}
} else {
// Since we already know the skill has an elemental attribute, but we dont know if the monster is weak or not, lets
// take the safe approach and just assume they are weak.
calcDmgMax *= 1.5;
}
}
if (ret.skill != 0) {
Skill skill = SkillFactory.getSkill(ret.skill);
if (skill.getElement() != Element.NEUTRAL && chr.getBuffedValue(BuffStat.ELEMENTAL_RESET) == null) {
// The skill has an element effect, so we need to factor that in.
if (monster != null) {
ElementalEffectiveness eff = monster.getElementalEffectiveness(skill.getElement());
if (eff == ElementalEffectiveness.WEAK) {
calcDmgMax *= 1.5;
} else if (eff == ElementalEffectiveness.STRONG) {
//calcDmgMax *= 0.5;
}
} else {
// Since we already know the skill has an elemental attribute, but we dont know if the monster is weak or not, lets
// take the safe approach and just assume they are weak.
calcDmgMax *= 1.5;
}
}
if (ret.skill == FPWizard.POISON_BREATH || ret.skill == FPMage.POISON_MIST || ret.skill == FPArchMage.FIRE_DEMON || ret.skill == ILArchMage.ICE_DEMON) {
if (monster != null) {
// Turns out poison is completely server side, so I don't know why I added this. >.<
//calcDmgMax = monster.getHp() / (70 - chr.getSkillLevel(skill));
}
} else if (ret.skill == Hermit.SHADOW_WEB) {
if (monster != null) {
calcDmgMax = monster.getHp() / (50 - chr.getSkillLevel(skill));
}
} else if (ret.skill == Hermit.SHADOW_MESO) {
if (monster != null) {
monster.debuffMob(Hermit.SHADOW_MESO);
}
} else if (ret.skill == Aran.BODY_PRESSURE) {
if (monster != null) {
int bodyPressureDmg = (int) Math.ceil(monster.getMaxHp() * SkillFactory.getSkill(Aran.BODY_PRESSURE).getEffect(ret.skilllevel).getDamage() / 100.0);
if (bodyPressureDmg > calcDmgMax) {
calcDmgMax = bodyPressureDmg;
}
}
}
}
...
// end of iteration
}
...
I've noticed that within the function AbstractDealDamageHandler.parseDamage(), the variable calcDmgMax accumulates with each monster damage calculation. Is this behavior intended?