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