| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function do(CombatBase $combat, Character $character): void { |
||
| 27 | $result = []; |
||
| 28 | /** @var Character $patient */ |
||
| 29 | $patient = $combat->selectHealingTarget($character); |
||
| 30 | $result["result"] = $combat->successCalculator->hasHealed($character); |
||
| 31 | $amount = ($result["result"]) ? (int) ($character->intelligence / 2) : 0; |
||
| 32 | $result["amount"] = Numbers::range($amount, 0, $patient->maxHitpoints - $patient->hitpoints); |
||
| 33 | if($result["amount"] > 0) { |
||
| 34 | $patient->heal($result["amount"]); |
||
| 35 | } |
||
| 36 | $result["action"] = CombatLogEntry::ACTION_HEALING; |
||
| 37 | $result["name"] = ""; |
||
| 38 | $result["character1"] = $character; |
||
| 39 | $result["character2"] = $patient; |
||
| 40 | $combat->log->log($result); |
||
| 41 | } |
||
| 43 | ?> |