Untitled diff

Created Diff never expires
1 removal
29 lines
1 addition
29 lines
int32_t WeaponDistance::getElementDamage(const Player* player, const Creature* target, const Item* item) const
int32_t WeaponDistance::getElementDamage(const Player* player, const Creature* target, const Item* item) const
{
{
if (elementType == COMBAT_NONE) {
if (elementType == COMBAT_NONE) {
return 0;
return 0;
}
}


int32_t attackValue = elementDamage;
int32_t attackValue = elementDamage;
if (item->getWeaponType() == WEAPON_AMMO) {
if (item->getWeaponType() == WEAPON_AMMO) {
Item* weapon = player->getWeapon(true);
Item* weapon = player->getWeapon(true);
if (weapon) {
if (weapon) {
attackValue += weapon->getAttack();
attackValue += weapon->getAttack();
}
}
}
}


int32_t attackSkill = player->getSkillLevel(SKILL_DISTANCE);
int32_t attackSkill = player->getSkillLevel(SKILL_DISTANCE);
float attackFactor = player->getAttackFactor();
float attackFactor = player->getAttackFactor();


int32_t minValue = 0;
int32_t minValue = 0;
int32_t maxValue = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor);
int32_t maxValue = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor, player->getPassiveDamageBonus());
if (target) {
if (target) {
if (target->getPlayer()) {
if (target->getPlayer()) {
minValue = static_cast<int32_t>(std::ceil(player->getLevel() * 0.1));
minValue = static_cast<int32_t>(std::ceil(player->getLevel() * 0.1));
} else {
} else {
minValue = static_cast<int32_t>(std::ceil(player->getLevel() * 0.2));
minValue = static_cast<int32_t>(std::ceil(player->getLevel() * 0.2));
}
}
}
}


return -normal_random(minValue, static_cast<int32_t>(maxValue * player->getVocation()->distDamageMultiplier));
return -normal_random(minValue, static_cast<int32_t>(maxValue * player->getVocation()->distDamageMultiplier));
}
}