@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace HeroesofAbenez\Combat; |
| 5 | 5 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return Character[] |
| 48 | 48 | */ |
| 49 | 49 | public function getAliveMembers(): array { |
| 50 | - return $this->getItems(["hitpoints>" => 0,]); |
|
| 50 | + return $this->getItems(["hitpoints>" => 0, ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -77,11 +77,11 @@ |
||
| 77 | 77 | */ |
| 78 | 78 | public function setCharacterPosition($id, int $row, int $column): void { |
| 79 | 79 | if(!$this->hasItems(["id" => $id])) { |
| 80 | - throw new \OutOfBoundsException("Character $id is not in the team"); |
|
| 80 | + throw new \OutOfBoundsException("character $id is not in the team"); |
|
| 81 | 81 | } elseif(count($this->getItems(["positionRow" => $row])) >= $this->maxRowSize) { |
| 82 | - throw new InvalidCharacterPositionException("Row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
| 82 | + throw new InvalidCharacterPositionException("row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
| 83 | 83 | } elseif($this->hasItems(["positionRow" => $row, "positionColumn" => $column])) { |
| 84 | - throw new InvalidCharacterPositionException("Row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
| 84 | + throw new InvalidCharacterPositionException("row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
| 85 | 85 | } |
| 86 | 86 | $character = $this->getItems(["id" => $id])[0]; |
| 87 | 87 | $character->positionRow = $row; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | foreach($team as $character) { |
| 229 | 229 | try { |
| 230 | 230 | $column++; |
| 231 | - if($character->positionRow > 0 AND $character->positionColumn > 0) { |
|
| 231 | + if($character->positionRow > 0 and $character->positionColumn > 0) { |
|
| 232 | 232 | continue; |
| 233 | 233 | } |
| 234 | 234 | setPosition: |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray()); |
| 282 | 282 | foreach($characters as $character) { |
| 283 | 283 | foreach($character->effects as $effect) { |
| 284 | - if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) { |
|
| 284 | + if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) { |
|
| 285 | 285 | $character->removeEffect($effect->id); |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $threshold = static::LOWEST_HP_THRESHOLD; |
| 370 | 370 | } |
| 371 | 371 | foreach($team->aliveMembers as $index => $member) { |
| 372 | - if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) { |
|
| 372 | + if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) { |
|
| 373 | 373 | $lowestHp = $member->hitpoints; |
| 374 | 374 | $lowestIndex = $index; |
| 375 | 375 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]); |
| 413 | 413 | break; |
| 414 | 414 | default: |
| 415 | - throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented."); |
|
| 415 | + throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented."); |
|
| 416 | 416 | } |
| 417 | 417 | foreach($targets as $target) { |
| 418 | 418 | for($i = 1; $i <= $skill->skill->strikes; $i++) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | $targets = $this->getEnemyTeam($character)->toArray(); |
| 438 | 438 | break; |
| 439 | 439 | default: |
| 440 | - throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented."); |
|
| 440 | + throw new NotImplementedException("target $skill->skill->target for special skills is not implemented."); |
|
| 441 | 441 | } |
| 442 | 442 | foreach($targets as $target) { |
| 443 | 443 | $this->onSkillSpecial($character, $target, $skill); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | protected function chooseAction(CombatBase $combat, Character $character): ?string { |
| 448 | 448 | if($character->hitpoints < 1) { |
| 449 | 449 | return NULL; |
| 450 | - } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) { |
|
| 450 | + } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) { |
|
| 451 | 451 | return CombatAction::ACTION_HEALING; |
| 452 | 452 | } |
| 453 | 453 | $attackTarget = $combat->selectAttackTarget($character); |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | "character1" => $character1, "character2" => $target, |
| 631 | 631 | ]; |
| 632 | 632 | $effect = new CharacterEffect([ |
| 633 | - "id" => "skill{$skill->skill->id}Effect", |
|
| 633 | + "id" => "skill{$skill->skill->id}effect", |
|
| 634 | 634 | "type" => $skill->skill->type, |
| 635 | 635 | "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? NULL : $skill->skill->stat), |
| 636 | 636 | "value" => $skill->value, |