@@ -23,7 +23,7 @@ |
||
| 23 | 23 | public function chooseAction(CombatBase $combat, Character $character): ?string { |
| 24 | 24 | if($character->hitpoints < 1) { |
| 25 | 25 | return null; |
| 26 | - } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) { |
|
| 26 | + } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) { |
|
| 27 | 27 | return CombatAction::ACTION_HEALING; |
| 28 | 28 | } |
| 29 | 29 | $attackTarget = $combat->selectAttackTarget($character); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @return Character[] |
| 51 | 51 | */ |
| 52 | 52 | public function getAliveMembers(): array { |
| 53 | - return $this->getItems(["hitpoints>" => 0,]); |
|
| 53 | + return $this->getItems(["hitpoints>" => 0, ]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return null; |
| 129 | 129 | } |
| 130 | 130 | for($i = 1; $i <= PHP_INT_MAX; $i++) { |
| 131 | - if($this->hasItems(["positionRow" => $i, "hitpoints>" => 0,])) { |
|
| 131 | + if($this->hasItems(["positionRow" => $i, "hitpoints>" => 0, ])) { |
|
| 132 | 132 | return $i; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function setCharacterPosition($id, int $row, int $column): void { |
| 82 | 82 | if(!$this->hasItems(["id" => $id])) { |
| 83 | - throw new \OutOfBoundsException("Character $id is not in the team"); |
|
| 83 | + throw new \OutOfBoundsException("character $id is not in the team"); |
|
| 84 | 84 | } elseif(count($this->getItems(["positionRow" => $row])) >= $this->maxRowSize) { |
| 85 | - throw new InvalidCharacterPositionException("Row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
| 85 | + throw new InvalidCharacterPositionException("row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
| 86 | 86 | } elseif($this->hasItems(["positionRow" => $row, "positionColumn" => $column])) { |
| 87 | - throw new InvalidCharacterPositionException("Row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
| 87 | + throw new InvalidCharacterPositionException("row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
| 88 | 88 | } |
| 89 | 89 | $character = $this->getItems(["id" => $id])[0]; |
| 90 | 90 | $character->positionRow = $row; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return null; |
| 113 | 113 | } |
| 114 | 114 | foreach($this->aliveMembers as $index => $member) { |
| 115 | - if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) { |
|
| 115 | + if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) { |
|
| 116 | 116 | $lowestHp = $member->hitpoints; |
| 117 | 117 | $lowestIndex = $index; |
| 118 | 118 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | protected function configureOptions(OptionsResolver $resolver): void { |
| 55 | - $allStats = ["id", "name", "slot", "type", "strength", "worn",]; |
|
| 55 | + $allStats = ["id", "name", "slot", "type", "strength", "worn", ]; |
|
| 56 | 56 | $resolver->setRequired($allStats); |
| 57 | 57 | $resolver->setAllowedTypes("id", "integer"); |
| 58 | 58 | $resolver->setAllowedTypes("name", "string"); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->onCombatEnd[] = [$this, "logCombatResult"]; |
| 83 | 83 | $this->onCombatEnd[] = [$this, "resetInitiative"]; |
| 84 | 84 | $this->onRoundStart[] = [$this, "decreaseEffectsDuration"]; |
| 85 | - $this->onRoundStart[] = [$this ,"recalculateStats"]; |
|
| 85 | + $this->onRoundStart[] = [$this, "recalculateStats"]; |
|
| 86 | 86 | $this->onRoundStart[] = [$this, "logRoundNumber"]; |
| 87 | 87 | $this->onRoundStart[] = [$this, "applyPoison"]; |
| 88 | 88 | $this->onRound[] = [$this, "mainStage"]; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | return null; |
| 364 | 364 | } |
| 365 | 365 | /** @var Team $enemies */ |
| 366 | - $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0,]), $enemyTeam->name); |
|
| 366 | + $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0, ]), $enemyTeam->name); |
|
| 367 | 367 | } else { |
| 368 | 368 | $enemies = $enemyTeam; |
| 369 | 369 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | foreach($team as $character) { |
| 233 | 233 | try { |
| 234 | 234 | $column++; |
| 235 | - if($character->positionRow > 0 AND $character->positionColumn > 0) { |
|
| 235 | + if($character->positionRow > 0 and $character->positionColumn > 0) { |
|
| 236 | 236 | continue; |
| 237 | 237 | } |
| 238 | 238 | setPosition: |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray()); |
| 288 | 288 | foreach($characters as $character) { |
| 289 | 289 | foreach($character->effects as $effect) { |
| 290 | - if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) { |
|
| 290 | + if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) { |
|
| 291 | 291 | $character->removeEffect($effect->id); |
| 292 | 292 | } |
| 293 | 293 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $enemyTeam = $this->getEnemyTeam($attacker); |
| 350 | 350 | $rangedWeapon = false; |
| 351 | 351 | foreach($attacker->equipment as $equipment) { |
| 352 | - if($equipment instanceof Weapon AND $equipment->isWorn() AND $equipment->ranged) { |
|
| 352 | + if($equipment instanceof Weapon and $equipment->isWorn() and $equipment->ranged) { |
|
| 353 | 353 | $rangedWeapon = true; |
| 354 | 354 | break; |
| 355 | 355 | } |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]); |
| 410 | 410 | break; |
| 411 | 411 | default: |
| 412 | - throw new NotImplementedException("Target {$skill->skill->target} for attack skills is not implemented."); |
|
| 412 | + throw new NotImplementedException("target {$skill->skill->target} for attack skills is not implemented."); |
|
| 413 | 413 | } |
| 414 | 414 | foreach($targets as $target) { |
| 415 | 415 | 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); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $combat->onHeal($character, $combat->selectHealingTarget($character)); |
| 476 | 476 | break; |
| 477 | 477 | default: |
| 478 | - throw new NotImplementedException("Action $action is not implemented."); |
|
| 478 | + throw new NotImplementedException("action $action is not implemented."); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | "character1" => $character1, "character2" => $target, |
| 587 | 587 | ]; |
| 588 | 588 | $effect = new CharacterEffect([ |
| 589 | - "id" => "skill{$skill->skill->id}Effect", |
|
| 589 | + "id" => "skill{$skill->skill->id}effect", |
|
| 590 | 590 | "type" => $skill->skill->type, |
| 591 | 591 | "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? null : $skill->skill->stat), |
| 592 | 592 | "value" => $skill->value, |