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