| 1213 | } |
| 1214 | |
| 1215 | int 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 | |
| 1230 | float Game_Actor::GetCriticalHitChance(Weapon weapon) const { |
| 1231 | float crit_chance = dbActor->critical_hit ? 1.0f / dbActor->critical_hit_chance : 0.0f; |
no test coverage detected