Completed
Push — master ( cb21fe...1dfedc )
by Jakub
02:59
created
src/Team.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
       }
Please login to merge, or discard this patch.
src/CombatBase.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $this->onCombatEnd[] = [$this, "logCombatResult"];
81 81
     $this->onCombatEnd[] = [$this, "resetInitiative"];
82 82
     $this->onRoundStart[] = [$this, "decreaseEffectsDuration"];
83
-    $this->onRoundStart[] = [$this ,"recalculateStats"];
83
+    $this->onRoundStart[] = [$this, "recalculateStats"];
84 84
     $this->onRoundStart[] = [$this, "logRoundNumber"];
85 85
     $this->onRoundStart[] = [$this, "applyPoison"];
86 86
     $this->onRound[] = [$this, "mainStage"];
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
       return NULL;
343 343
     }
344 344
     /** @var Team $enemies */
345
-    $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0,]), $enemyTeam->name);
345
+    $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0, ]), $enemyTeam->name);
346 346
     $target = $enemies->getLowestHpCharacter();
347 347
     if(!is_null($target)) {
348 348
       return $target;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
       foreach($team as $character) {
227 227
         try {
228 228
           $column++;
229
-          if($character->positionRow > 0 AND $character->positionColumn > 0) {
229
+          if($character->positionRow > 0 and $character->positionColumn > 0) {
230 230
             continue;
231 231
           }
232 232
           setPosition:
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray());
280 280
     foreach($characters as $character) {
281 281
       foreach($character->effects as $effect) {
282
-        if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) {
282
+        if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) {
283 283
           $character->removeEffect($effect->id);
284 284
         }
285 285
       }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]);
383 383
         break;
384 384
       default:
385
-        throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented.");
385
+        throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented.");
386 386
     }
387 387
     foreach($targets as $target) {
388 388
       for($i = 1; $i <= $skill->skill->strikes; $i++) {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         $targets = $this->getEnemyTeam($character)->toArray();
408 408
         break;
409 409
       default:
410
-        throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented.");
410
+        throw new NotImplementedException("target $skill->skill->target for special skills is not implemented.");
411 411
     }
412 412
     foreach($targets as $target) {
413 413
       $this->onSkillSpecial($character, $target, $skill);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
   protected function chooseAction(self $combat, Character $character): ?string {
418 418
     if($character->hitpoints < 1) {
419 419
       return NULL;
420
-    } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) {
420
+    } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) {
421 421
       return CombatAction::ACTION_HEALING;
422 422
     }
423 423
     $attackTarget = $combat->selectAttackTarget($character);
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
       "character1" => $character1, "character2" => $target,
601 601
     ];
602 602
     $effect = new CharacterEffect([
603
-      "id" => "skill{$skill->skill->id}Effect",
603
+      "id" => "skill{$skill->skill->id}effect",
604 604
       "type" => $skill->skill->type,
605 605
       "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? NULL : $skill->skill->stat),
606 606
       "value" => $skill->value,
Please login to merge, or discard this patch.