@@ -74,7 +74,7 @@ |
||
| 74 | 74 | }); |
| 75 | 75 | $resolver->setAllowedTypes("stat", ["string", "null"]); |
| 76 | 76 | $resolver->setAllowedValues("stat", function(?string $value) { |
| 77 | - return is_null($value) OR in_array($value, $this->getAllowedStats(), true); |
|
| 77 | + return is_null($value) or in_array($value, $this->getAllowedStats(), true); |
|
| 78 | 78 | }); |
| 79 | 79 | $resolver->setAllowedTypes("value", "integer"); |
| 80 | 80 | $resolver->setAllowedValues("value", function(int $value) { |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | }); |
| 62 | 62 | $resolver->setAllowedTypes("type", ["string", "null"]); |
| 63 | 63 | $resolver->setAllowedValues("type", function(?string $value) { |
| 64 | - return is_null($value) OR in_array($value, $this->getAllowedTypes(), true); |
|
| 64 | + return is_null($value) or in_array($value, $this->getAllowedTypes(), true); |
|
| 65 | 65 | }); |
| 66 | 66 | $resolver->setAllowedTypes("strength", "integer"); |
| 67 | 67 | $resolver->setAllowedValues("strength", function(int $value) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $resolver->setAllowedTypes("stat", "string"); |
| 53 | 53 | $resolver->setDefault("stat", ""); |
| 54 | 54 | $resolver->setAllowedValues("stat", function(string $value) { |
| 55 | - return $value === "" OR in_array($value, $this->getAllowedStats(), true); |
|
| 55 | + return $value === "" or in_array($value, $this->getAllowedStats(), true); |
|
| 56 | 56 | }); |
| 57 | 57 | $resolver->setAllowedTypes("source", "string"); |
| 58 | 58 | $resolver->setAllowedValues("source", function(string $value) { |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $resolver->setDefault("value", 0); |
| 63 | 63 | $resolver->setAllowedTypes("duration", ["string", "integer"]); |
| 64 | 64 | $resolver->setAllowedValues("duration", function($value) { |
| 65 | - return (in_array($value, $this->getDurations(), true)) OR ($value > 0); |
|
| 65 | + return (in_array($value, $this->getDurations(), true)) or ($value > 0); |
|
| 66 | 66 | }); |
| 67 | 67 | $effect = $resolver->resolve($effect); |
| 68 | - if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) AND $effect["stat"] === "") { |
|
| 68 | + if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) and $effect["stat"] === "") { |
|
| 69 | 69 | throw new \InvalidArgumentException("The option stat with value '' is invalid."); |
| 70 | 70 | } |
| 71 | 71 | $this->id = $effect["id"]; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @throws \InvalidArgumentException |
| 136 | 136 | */ |
| 137 | 137 | public function setDuration($value) { |
| 138 | - if(!is_int($value) AND !in_array($value, $this->getDurations(), true)) { |
|
| 138 | + if(!is_int($value) and !in_array($value, $this->getDurations(), true)) { |
|
| 139 | 139 | throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer."); |
| 140 | 140 | } |
| 141 | 141 | $this->duration = $value; |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getHitRate(): int { |
| 41 | - if(is_string($this->skill->hitRate) AND substr($this->skill->hitRate, -1) === "%") { |
|
| 41 | + if(is_string($this->skill->hitRate) and substr($this->skill->hitRate, -1) === "%") { |
|
| 42 | 42 | return (int) $this->skill->hitRate; |
| 43 | 43 | } |
| 44 | 44 | return 100; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | public function damageStat(): string { |
| 498 | 498 | $stat = "strength"; |
| 499 | 499 | foreach($this->equipment as $item) { |
| 500 | - if(!$item->worn OR $item->slot != Equipment::SLOT_WEAPON) { |
|
| 500 | + if(!$item->worn or $item->slot != Equipment::SLOT_WEAPON) { |
|
| 501 | 501 | continue; |
| 502 | 502 | } |
| 503 | 503 | switch($item->type) { |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $stat = $effect->stat; |
| 557 | 557 | $type = $effect->type; |
| 558 | 558 | $duration = $effect->duration; |
| 559 | - if(is_int($duration) AND $duration < 1) { |
|
| 559 | + if(is_int($duration) and $duration < 1) { |
|
| 560 | 560 | $this->removeEffect($effect->id); |
| 561 | 561 | continue; |
| 562 | 562 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | */ |
| 76 | 76 | public function setTemplate(string $template): void { |
| 77 | 77 | if(!is_file($template)) { |
| 78 | - throw new \RuntimeException("File $template does not exist."); |
|
| 78 | + throw new \RuntimeException("file $template does not exist."); |
|
| 79 | 79 | } |
| 80 | 80 | $this->template = $template; |
| 81 | 81 | } |
@@ -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 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $threshold = static::LOWEST_HP_THRESHOLD; |
| 371 | 371 | } |
| 372 | 372 | foreach($team->aliveMembers as $index => $member) { |
| 373 | - if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) { |
|
| 373 | + if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) { |
|
| 374 | 374 | $lowestHp = $member->hitpoints; |
| 375 | 375 | $lowestIndex = $index; |
| 376 | 376 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $targets = $this->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]); |
| 414 | 414 | break; |
| 415 | 415 | default: |
| 416 | - throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented."); |
|
| 416 | + throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented."); |
|
| 417 | 417 | } |
| 418 | 418 | foreach($targets as $target) { |
| 419 | 419 | for($i = 1; $i <= $skill->skill->strikes; $i++) { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $targets = $this->getEnemyTeam($character)->toArray(); |
| 439 | 439 | break; |
| 440 | 440 | default: |
| 441 | - throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented."); |
|
| 441 | + throw new NotImplementedException("target $skill->skill->target for special skills is not implemented."); |
|
| 442 | 442 | } |
| 443 | 443 | foreach($targets as $target) { |
| 444 | 444 | $this->onSkillSpecial($character, $target, $skill); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | protected function chooseAction(self $combat, Character $character): ?string { |
| 449 | 449 | if($character->hitpoints < 1) { |
| 450 | 450 | return NULL; |
| 451 | - } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) { |
|
| 451 | + } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) { |
|
| 452 | 452 | return CombatAction::ACTION_HEALING; |
| 453 | 453 | } |
| 454 | 454 | $attackTarget = $combat->selectAttackTarget($character); |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | "character1" => $character1, "character2" => $target, |
| 632 | 632 | ]; |
| 633 | 633 | $effect = new CharacterEffect([ |
| 634 | - "id" => "skill{$skill->skill->id}Effect", |
|
| 634 | + "id" => "skill{$skill->skill->id}effect", |
|
| 635 | 635 | "type" => $skill->skill->type, |
| 636 | 636 | "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? NULL : $skill->skill->stat), |
| 637 | 637 | "value" => $skill->value, |