MCPcopy Create free account
hub / github.com/EasyRPG/Player / GetHitChance

Method GetHitChance

src/game_actor.cpp:1215–1228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1213}
1214
1215int Game_Actor::GetHitChance(Weapon weapon) const {
1216 int hit = INT_MIN;
1217 ForEachEquipment<true, false>(GetWholeEquipment(), [&](auto& item) { hit = std::max(hit, static_cast<int>(item.hit)); }, weapon);
1218
1219 if (hit != INT_MIN) {
1220 return hit;
1221 } else {
1222 if (dbActor->easyrpg_unarmed_hit != -1) {
1223 return dbActor->easyrpg_unarmed_hit;
1224 } else {
1225 return 90;
1226 }
1227 }
1228}
1229
1230float Game_Actor::GetCriticalHitChance(Weapon weapon) const {
1231 float crit_chance = dbActor->critical_hit ? 1.0f / dbActor->critical_hit_chance : 0.0f;

Callers 5

CalcNormalAttackToHitFunction · 0.45
CalcSkillToHitFunction · 0.45
game_actor.cppFile · 0.45
testWeapon3Function · 0.45
game_enemy.cppFile · 0.45

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected