ola a todos de novo. hj eu venho trazer um codigo melhorado do "Jackson Zani"(mais um)
configmanager.cpp
acima de
m_isLoaded = true;
adicione
m_confInteger[CRITICAL_HIT] = getGlobalNumber(L, "criticalhit", 10);
agora em configmanager.h
acima de
LAST_INTEGER_CONFIG
adicione
CRITICAL_HIT,
agora em weapons.cpp troque a funçao
int32_t Weapons::getMaxWeaponDamage(int32_t attackSkill, int32_t attackValue)
por
int32_t Weapons::getMaxWeaponDamage(int32_t attackSkill, int32_t attackValue) { int32_t maxDamage = ((int32_t)std::ceil((attackSkill * (attackValue * 0.0425)) + (attackValue * 0.2)) * 2); if(random_range(0,100) < g_config.getNumber(ConfigManager::CRITICAL_HIT)){ if(attackSkill > 60){ maxDamage *= 2; } else if(attackSkill > 30){ maxDamage *= 3; } else { maxDamage *= 4; } } return maxDamage; }
e pronto!
config.lua
-- chance to make a critical hit (1 = 1%) criticalhit = 10