| Total Complexity | 4 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 1 | final class RandomSuccessCalculator implements ISuccessCalculator { |
|
| 14 | public function calculateHitChance(Character $character1, Character $character2, ?CharacterAttackSkill $skill = NULL): int { |
||
|
|
|||
| 15 | 1 | $hitRate = $character1->hit; |
|
| 16 | 1 | $dodgeRate = $character2->dodge; |
|
| 17 | 1 | if(!is_null($skill)) { |
|
| 18 | 1 | $hitRate = $hitRate / 100 * $skill->hitRate; |
|
| 19 | } |
||
| 20 | 1 | return Numbers::range((int) ($hitRate - $dodgeRate), 15, 100); |
|
| 21 | } |
||
| 22 | |||
| 23 | public function calculateHealingSuccessChance(Character $healer): int { |
||
| 25 | } |
||
| 26 | |||
| 27 | public function hasHit(int $hitChance): bool { |
||
| 30 | } |
||
| 31 | } |
||
| 32 | ?> |