@@ -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) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public const TARGET_PARTY = "party"; |
27 | 27 | public const TARGET_ENEMY_PARTY = "enemy_party"; |
28 | 28 | /** @var string[] */ |
29 | - public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON,]; |
|
29 | + public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON, ]; |
|
30 | 30 | |
31 | 31 | /** @var string */ |
32 | 32 | protected $type; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function configureOptions(OptionsResolver $resolver): void { |
62 | 62 | parent::configureOptions($resolver); |
63 | - $allStats = ["type", "stat", "value", "valueGrowth", "duration",]; |
|
63 | + $allStats = ["type", "stat", "value", "valueGrowth", "duration", ]; |
|
64 | 64 | $resolver->setRequired($allStats); |
65 | 65 | $resolver->setAllowedTypes("type", "string"); |
66 | 66 | $resolver->setAllowedValues("type", function(string $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; |
@@ -2,8 +2,8 @@ |
||
2 | 2 | declare(strict_types=1); |
3 | 3 | |
4 | 4 | require __DIR__ . "/../vendor/autoload.php"; |
5 | -Testbench\Bootstrap::setup(__DIR__ . '/_temp', function (\Nette\Configurator $configurator) { |
|
6 | - $configurator->addParameters(["appDir" => __DIR__,]); |
|
5 | +Testbench\Bootstrap::setup(__DIR__ . '/_temp', function(\Nette\Configurator $configurator) { |
|
6 | + $configurator->addParameters(["appDir" => __DIR__, ]); |
|
7 | 7 | $configurator->addConfig(__DIR__ . "/tests.neon"); |
8 | 8 | }); |
9 | 9 | ?> |
10 | 10 | \ No newline at end of file |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | protected function configureOptions(OptionsResolver $resolver): void { |
50 | 50 | parent::configureOptions($resolver); |
51 | - $allStats = ["baseDamage", "damageGrowth", "strikes", "hitRate",]; |
|
51 | + $allStats = ["baseDamage", "damageGrowth", "strikes", "hitRate", ]; |
|
52 | 52 | $resolver->setRequired($allStats); |
53 | 53 | $resolver->setAllowedTypes("baseDamage", "string"); |
54 | 54 | $resolver->setAllowedTypes("damageGrowth", "string"); |
@@ -190,10 +190,10 @@ |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | protected function setStats(array $stats): void { |
193 | - $requiredStats = array_merge(["id", "name", "level", "initiativeFormula",], static::BASE_STATS); |
|
194 | - $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience",]); |
|
193 | + $requiredStats = array_merge(["id", "name", "level", "initiativeFormula", ], static::BASE_STATS); |
|
194 | + $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", "experience", ]); |
|
195 | 195 | $numberStats = static::BASE_STATS; |
196 | - $textStats = ["name", "race", "occupation", "initiativeFormula",]; |
|
196 | + $textStats = ["name", "race", "occupation", "initiativeFormula", ]; |
|
197 | 197 | $resolver = new OptionsResolver(); |
198 | 198 | $resolver->setDefined($allStats); |
199 | 199 | $resolver->setAllowedTypes("id", ["integer", "string"]); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public function damageStat(): string { |
533 | 533 | foreach($this->equipment as $item) { |
534 | - if(!$item->worn OR !$item instanceof Weapon) { |
|
534 | + if(!$item->worn or !$item instanceof Weapon) { |
|
535 | 535 | continue; |
536 | 536 | } |
537 | 537 | return $item->damageStat; |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | $stat = $effect->stat; |
580 | 580 | $type = $effect->type; |
581 | 581 | $duration = $effect->duration; |
582 | - if(is_int($duration) AND $duration < 1) { |
|
582 | + if(is_int($duration) and $duration < 1) { |
|
583 | 583 | $this->removeEffect($effect->id); |
584 | 584 | continue; |
585 | 585 | } |
@@ -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 | } |
@@ -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: |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $characters = array_merge($combat->team1->toArray(), $combat->team2->toArray()); |
284 | 284 | foreach($characters as $character) { |
285 | 285 | foreach($character->effects as $effect) { |
286 | - if($effect->duration === CharacterEffect::DURATION_COMBAT OR is_int($effect->duration)) { |
|
286 | + if($effect->duration === CharacterEffect::DURATION_COMBAT or is_int($effect->duration)) { |
|
287 | 287 | $character->removeEffect($effect->id); |
288 | 288 | } |
289 | 289 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $enemyTeam = $this->getEnemyTeam($attacker); |
346 | 346 | $rangedWeapon = false; |
347 | 347 | foreach($attacker->equipment as $equipment) { |
348 | - if($equipment instanceof Weapon AND $equipment->worn AND $equipment->ranged) { |
|
348 | + if($equipment instanceof Weapon and $equipment->worn and $equipment->ranged) { |
|
349 | 349 | $rangedWeapon = true; |
350 | 350 | break; |
351 | 351 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | continue 2; |
411 | 411 | } |
412 | 412 | } |
413 | - throw new NotImplementedException("Action $action is not implemented."); |
|
413 | + throw new NotImplementedException("action $action is not implemented."); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | protected function configureOptions(OptionsResolver $resolver): void { |
40 | - $allStats = ["id", "deployed", "bonusStat", "bonusValue",]; |
|
40 | + $allStats = ["id", "deployed", "bonusStat", "bonusValue", ]; |
|
41 | 41 | $resolver->setRequired($allStats); |
42 | 42 | $resolver->setAllowedTypes("id", "integer"); |
43 | 43 | $resolver->setAllowedTypes("deployed", "boolean"); |