Hello,
I see that critical hit only work for melee weapons and distance weapons but not for wands.
I want to edit the source to make it work for wands also.
This is my weapons.cpp
Look to this lines ( melee weapon has the line of critical damage )
Look at this lines ( wand weapon ) no have the critical line like melee weapon
I just need help to make wands work with critical hit also.
I see that critical hit only work for melee weapons and distance weapons but not for wands.
I want to edit the source to make it work for wands also.
This is my weapons.cpp
weapons.cpp - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
Look to this lines ( melee weapon has the line of critical damage )
C++:
int32_t WeaponMelee::getWeaponDamage(const Player* player, const Creature*, const Item* item, bool maxDamage /*= false*/) const
{
int32_t attackSkill = player->getWeaponSkill(item), attackValue = std::max((int32_t)0,
(int32_t(item->getAttack() + item->getExtraAttack()) - item->getElementDamage()));
float attackFactor = player->getAttackFactor();
double maxValue = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor);
if(player->getCriticalHitChance() + g_config.getNumber(ConfigManager::CRITICAL_HIT_CHANCE) >= random_range(1, 100))
{
maxValue = std::pow(maxValue, g_config.getDouble(ConfigManager::CRITICAL_HIT_MUL));
player->sendCritical();
}
Vocation* vocation = player->getVocation();
if(vocation && vocation->getMultiplier(MULTIPLIER_MELEE) != 1.0)
maxValue *= vocation->getMultiplier(MULTIPLIER_MELEE);
int32_t ret = (int32_t)std::floor(maxValue);
if(maxDamage)
return -ret;
return -random_range(0, ret, DISTRO_NORMAL);
}
Look at this lines ( wand weapon ) no have the critical line like melee weapon
C++:
int32_t WeaponWand::getWeaponDamage(const Player* player, const Creature*, const Item*, bool maxDamage /* = false*/) const
{
float multiplier = 1.0f;
if(Vocation* vocation = player->getVocation())
multiplier = vocation->getMultiplier(MULTIPLIER_WAND);
int32_t maxValue = (int32_t)(maxChange * multiplier);
if(maxDamage)
{
player->sendCritical();
return -maxValue;
}
int32_t minValue = (int32_t)(minChange * multiplier);
return random_range(-minValue, -maxValue, DISTRO_NORMAL);
}
I just need help to make wands work with critical hit also.