int diff = defender.getLevel() - (pAttacker != null ? pAttacker.getLevel() : attacker.getLevel());
if (attacker.isPlayable() && defender.isMonster() && (defender.getLevel() >= 78) && (diff > 2))
{
value *= .7 / Math.pow(diff - 2, .25);
}
Element element = Element.NONE;
double power = 0.;
if (skill != null)
{
element = skill.getElement();
power = skill.getElementPower();
}
else
{
element = getAttackElement(attacker, defender);
}
if (element == Element.NONE)
{
return value;
}
Double attDiff = attacker.calcStat(element.getAttack(), power) - defender.calcStat(element.getDefence(), 0.);
if ((pAttacker != null) && pAttacker.isDebug())
{
pAttacker.sendMessage("Element: " + element.name());
pAttacker.sendMessage("Attack: " + attacker.calcStat(element.getAttack(), power));
pAttacker.sendMessage("Defence: " + defender.calcStat(element.getDefence(), 0.));
pAttacker.sendMessage("Modifier: " + (attDiff < 0 ? "On defense " : "On attack ") + AttributeDamageResistTable.getInstance().getAttributeBonus(attDiff));
}
if(attDiff < 0)
{
return value / AttributeDamageResistTable.getInstance().getAttributeBonus(attDiff);