Completed
Push — master ( d235f7...843ccd )
by Jakub
02:33
created
src/CombatActionSelector.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
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
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
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"];
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
       return null;
356 356
     }
357 357
     /** @var Team $enemies */
358
-    $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0,]), $enemyTeam->name);
358
+    $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0, ]), $enemyTeam->name);
359 359
     $target = $enemies->getLowestHpCharacter();
360 360
     if(!is_null($target)) {
361 361
       return $target;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
       foreach($team as $character) {
238 238
         try {
239 239
           $column++;
240
-          if($character->positionRow > 0 AND $character->positionColumn > 0) {
240
+          if($character->positionRow > 0 and $character->positionColumn > 0) {
241 241
             continue;
242 242
           }
243 243
           setPosition:
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray());
291 291
     foreach($characters as $character) {
292 292
       foreach($character->effects as $effect) {
293
-        if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) {
293
+        if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) {
294 294
           $character->removeEffect($effect->id);
295 295
         }
296 296
       }
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]);
399 399
         break;
400 400
       default:
401
-        throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented.");
401
+        throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented.");
402 402
     }
403 403
     foreach($targets as $target) {
404 404
       for($i = 1; $i <= $skill->skill->strikes; $i++) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         $targets = $this->getEnemyTeam($character)->toArray();
424 424
         break;
425 425
       default:
426
-        throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented.");
426
+        throw new NotImplementedException("target $skill->skill->target for special skills is not implemented.");
427 427
     }
428 428
     foreach($targets as $target) {
429 429
       $this->onSkillSpecial($character, $target, $skill);
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
       "character1" => $character1, "character2" => $target,
589 589
     ];
590 590
     $effect = new CharacterEffect([
591
-      "id" => "skill{$skill->skill->id}Effect",
591
+      "id" => "skill{$skill->skill->id}effect",
592 592
       "type" => $skill->skill->type,
593 593
       "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? null : $skill->skill->stat),
594 594
       "value" => $skill->value,
Please login to merge, or discard this patch.