{
int32_t attackSkill = player->getWeaponSkill(item) * 1.2;
int32_t attackValue = std::max((int32_t)0, (int32_t(item->getAttack() + item->getExtraAttack()) - elementDamage));
int32_t tope = (item->getAttack() + item->getExtraAttack() * 2) * 10;
float attackFactor = player->getAttackFactor();
double maxValue = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor);
if(maxValue >= tope)
maxValue = tope;
int32_t ret = (int32_t)std::floor(maxValue);
if(maxDamage)
return -ret;
int32_t minValue = 0;
if(target)
{
if(target->getPlayer())
minValue = (int32_t)std::ceil(tope * 0.1);
else
minValue = (int32_t)std::ceil(tope * 0.12);
}
return -random_range(minValue, ret, DISTRO_NORMAL);
}