@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 | |
@@ -48,7 +48,7 @@ discard block |
||
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"); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public const STAT_DODGE = "dodge"; |
33 | 33 | public const STAT_INITIATIVE = "initiative"; |
34 | 34 | /** @var string[] */ |
35 | - public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON,]; |
|
35 | + public const NO_STAT_TYPES = [self::TYPE_STUN, self::TYPE_POISON, ]; |
|
36 | 36 | |
37 | 37 | /** @var string */ |
38 | 38 | protected $type; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function configureOptions(OptionsResolver $resolver): void { |
68 | 68 | parent::configureOptions($resolver); |
69 | - $allStats = ["type", "stat", "value", "valueGrowth", "duration",]; |
|
69 | + $allStats = ["type", "stat", "value", "valueGrowth", "duration", ]; |
|
70 | 70 | $resolver->setRequired($allStats); |
71 | 71 | $resolver->setAllowedTypes("type", "string"); |
72 | 72 | $resolver->setAllowedValues("type", function(string $value) { |
@@ -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) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | protected $worn; |
51 | 51 | |
52 | 52 | public function __construct(array $data) { |
53 | - $allStats = ["id", "name", "slot", "type", "strength", "worn",]; |
|
53 | + $allStats = ["id", "name", "slot", "type", "strength", "worn", ]; |
|
54 | 54 | $resolver = new OptionsResolver(); |
55 | 55 | $resolver->setRequired($allStats); |
56 | 56 | $resolver->setAllowedTypes("id", "integer"); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->onCombatEnd[] = [$this, "removeCombatEffects"]; |
79 | 79 | $this->onCombatEnd[] = [$this, "logCombatResult"]; |
80 | 80 | $this->onCombatEnd[] = [$this, "resetInitiative"]; |
81 | - $this->onRoundStart[] = [$this ,"recalculateStats"]; |
|
81 | + $this->onRoundStart[] = [$this, "recalculateStats"]; |
|
82 | 82 | $this->onRoundStart[] = [$this, "logRoundNumber"]; |
83 | 83 | $this->onRoundStart[] = [$this, "applyPoison"]; |
84 | 84 | $this->onRound[] = [$this, "mainStage"]; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | foreach($team as $character) { |
237 | 237 | try { |
238 | 238 | $column++; |
239 | - if($character->positionRow > 0 AND $character->positionColumn > 0) { |
|
239 | + if($character->positionRow > 0 and $character->positionColumn > 0) { |
|
240 | 240 | continue; |
241 | 241 | } |
242 | 242 | setPosition: |
@@ -279,7 +279,7 @@ discard block |
||
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 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $threshold = static::LOWEST_HP_THRESHOLD; |
368 | 368 | } |
369 | 369 | foreach($team->aliveMembers as $index => $member) { |
370 | - if($member->hitpoints <= $member->maxHitpoints * $threshold AND $member->hitpoints < $lowestHp) { |
|
370 | + if($member->hitpoints <= $member->maxHitpoints * $threshold and $member->hitpoints < $lowestHp) { |
|
371 | 371 | $lowestHp = $member->hitpoints; |
372 | 372 | $lowestIndex = $index; |
373 | 373 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $targets = $this->getTeam($primaryTarget)->getMembers(["positionColumn" => $primaryTarget->positionColumn]); |
411 | 411 | break; |
412 | 412 | default: |
413 | - throw new NotImplementedException("Target $skill->skill->target for attack skills is not implemented yet."); |
|
413 | + throw new NotImplementedException("target $skill->skill->target for attack skills is not implemented yet."); |
|
414 | 414 | } |
415 | 415 | foreach($targets as $target) { |
416 | 416 | for($i = 1; $i <= $skill->skill->strikes; $i++) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $targets = $this->getEnemyTeam($character)->toArray(); |
436 | 436 | break; |
437 | 437 | default: |
438 | - throw new NotImplementedException("Target $skill->skill->target for special skills is not implemented."); |
|
438 | + throw new NotImplementedException("target $skill->skill->target for special skills is not implemented."); |
|
439 | 439 | } |
440 | 440 | foreach($targets as $target) { |
441 | 441 | $this->onSkillSpecial($character, $target, $skill); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | protected function chooseAction(CombatBase $combat, Character $character): ?string { |
446 | 446 | if($character->hitpoints < 1) { |
447 | 447 | return NULL; |
448 | - } elseif(in_array($character, $combat->findHealers()->toArray(), true) AND !is_null($combat->selectHealingTarget($character))) { |
|
448 | + } elseif(in_array($character, $combat->findHealers()->toArray(), true) and !is_null($combat->selectHealingTarget($character))) { |
|
449 | 449 | return CombatAction::ACTION_HEALING; |
450 | 450 | } |
451 | 451 | $attackTarget = $combat->selectAttackTarget($character); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ]; |
628 | 628 | $this->results = $result; |
629 | 629 | $effect = new CharacterEffect([ |
630 | - "id" => "skill{$skill->skill->id}Effect", |
|
630 | + "id" => "skill{$skill->skill->id}effect", |
|
631 | 631 | "type" => $skill->skill->type, |
632 | 632 | "stat" => ((in_array($skill->skill->type, SkillSpecial::NO_STAT_TYPES, true)) ? NULL : $skill->skill->stat), |
633 | 633 | "value" => $skill->value, |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
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 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace HeroesofAbenez\Combat; |
5 | 5 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function getUsableMembers(): array { |
87 | 87 | return array_values(array_filter($this->items, function(Character $value) { |
88 | - return (!$value->stunned AND $value->hitpoints > 0); |
|
88 | + return (!$value->stunned and $value->hitpoints > 0); |
|
89 | 89 | })); |
90 | 90 | } |
91 | 91 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function setCharacterPosition($id, int $row, int $column): void { |
107 | 107 | if(!$this->hasMembers(["id" => $id])) { |
108 | - throw new \OutOfBoundsException("Character $id is not in the team"); |
|
108 | + throw new \OutOfBoundsException("character $id is not in the team"); |
|
109 | 109 | } elseif(count($this->getMembers(["positionRow" => $row])) >= $this->maxRowSize) { |
110 | - throw new InvalidCharacterPositionException("Row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
110 | + throw new InvalidCharacterPositionException("row $row is full.", InvalidCharacterPositionException::ROW_FULL); |
|
111 | 111 | } elseif($this->hasMembers(["positionRow" => $row, "positionColumn" => $column])) { |
112 | - throw new InvalidCharacterPositionException("Row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
112 | + throw new InvalidCharacterPositionException("row $row column $column is occupied.", InvalidCharacterPositionException::POSITION_OCCUPIED); |
|
113 | 113 | } |
114 | 114 | $character = $this->getMembers(["id" => $id])[0]; |
115 | 115 | $character->positionRow = $row; |