| Conditions | 2 |
| Paths | 2 |
| Total Lines | 7 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function hasHit(Character $character1, Character $character2, ?CharacterAttackSkill $skill = null): bool { |
||
| 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 | $hitChance = Numbers::range((int) ($hitRate - $dodgeRate), 15, static::MAX_HIT_CHANCE); |
|
| 21 | 1 | $roll = rand(0, 100); |
|
| 31 | ?> |