Untitled diff
31 lines
int32_t WeaponDistance::getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage /*= false*/) const
int32_t WeaponDistance::getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage /*= false*/) const
{
{
	int32_t attackValue = item->getAttack();
	int32_t attackValue = item->getAttack();
	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 maxValue = static_cast<int32_t>(Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor) * player->getVocation()->distDamageMultiplier);
	int32_t maxValue = static_cast<int32_t>(Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor, player->getPassiveDamageBonus()) * player->getVocation()->distDamageMultiplier);
	if (maxDamage) {
	if (maxDamage) {
		return -maxValue;
		return -maxValue;
	}
	}
	int32_t minValue;
	int32_t minValue;
	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));
		}
		}
	} else {
	} else {
		minValue = 0;
		minValue = 0;
	}
	}
	return -normal_random(minValue, maxValue);
	return -normal_random(minValue, maxValue);
}
}