@@ -10,6 +10,8 @@ |
||
10 | 10 | public function getName(): string; |
11 | 11 | public function getPriority(): int; |
12 | 12 | public function shouldUse(CombatBase $combat, Character $character): bool; |
13 | - public function do(CombatBase $combat, Character $character): void; |
|
14 | -} |
|
13 | + public function do { |
|
14 | + (CombatBase $combat, Character $character): void; |
|
15 | + } |
|
16 | + } |
|
15 | 17 | ?> |
16 | 18 | \ No newline at end of file |
@@ -26,8 +26,10 @@ |
||
26 | 26 | * Hit chance = Attacker's hit - Defender's dodge, but at least 15% |
27 | 27 | * Damage = Attacker's damage - defender's defense |
28 | 28 | */ |
29 | - public function do(CombatBase $combat, Character $character): void { |
|
29 | + public function do { |
|
30 | + (CombatBase $combat, Character $character): void { |
|
30 | 31 | $result = []; |
32 | + } |
|
31 | 33 | /** @var Character $defender */ |
32 | 34 | $defender = $combat->selectAttackTarget($character); |
33 | 35 | $result["result"] = $combat->successCalculator->hasHit($character, $defender); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function configureOptions(OptionsResolver $resolver): void { |
73 | - $allStats = ["id", "type", "value", "valueAbsolute", "duration", "stat",]; |
|
73 | + $allStats = ["id", "type", "value", "valueAbsolute", "duration", "stat", ]; |
|
74 | 74 | $resolver->setRequired($allStats); |
75 | 75 | $resolver->setAllowedTypes("id", "string"); |
76 | 76 | $resolver->setAllowedTypes("type", "string"); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $resolver = new OptionsResolver(); |
47 | 47 | $this->configureOptions($resolver); |
48 | 48 | $effect = $resolver->resolve($effect); |
49 | - if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) AND $effect["stat"] === "") { |
|
49 | + if(!in_array($effect["type"], SkillSpecial::NO_STAT_TYPES, true) and $effect["stat"] === "") { |
|
50 | 50 | throw new \InvalidArgumentException("The option stat with value '' is invalid."); |
51 | 51 | } |
52 | 52 | $this->id = $effect["id"]; |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | $resolver->setAllowedTypes("stat", "string"); |
81 | 81 | $resolver->setDefault("stat", ""); |
82 | 82 | $resolver->setAllowedValues("stat", function(string $value) { |
83 | - return $value === "" OR in_array($value, $this->getAllowedStats(), true); |
|
83 | + return $value === "" or in_array($value, $this->getAllowedStats(), true); |
|
84 | 84 | }); |
85 | 85 | $resolver->setAllowedTypes("value", "integer"); |
86 | 86 | $resolver->setAllowedTypes("valueAbsolute", "bool"); |
87 | 87 | $resolver->setDefault("value", 0); |
88 | 88 | $resolver->setAllowedTypes("duration", ["string", "integer"]); |
89 | 89 | $resolver->setAllowedValues("duration", function($value) { |
90 | - return (in_array($value, $this->getDurations(), true)) OR ($value > 0); |
|
90 | + return (in_array($value, $this->getDurations(), true)) or ($value > 0); |
|
91 | 91 | }); |
92 | 92 | } |
93 | 93 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @throws \InvalidArgumentException |
149 | 149 | */ |
150 | 150 | public function setDuration($value): void { |
151 | - if(!is_int($value) AND !in_array($value, $this->getDurations(), true)) { |
|
151 | + if(!is_int($value) and !in_array($value, $this->getDurations(), true)) { |
|
152 | 152 | throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer."); |
153 | 153 | } |
154 | 154 | $this->duration = $value; |
@@ -51,8 +51,8 @@ |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | protected function configureOptions(OptionsResolver $resolver): void { |
54 | - $requiredStats = ["action", "result", "character1", "character2",]; |
|
55 | - $resolver->setDefined(["amount", "name",]); |
|
54 | + $requiredStats = ["action", "result", "character1", "character2", ]; |
|
55 | + $resolver->setDefined(["amount", "name", ]); |
|
56 | 56 | $resolver->setRequired($requiredStats); |
57 | 57 | $resolver->setAllowedTypes("action", "string"); |
58 | 58 | $resolver->setAllowedTypes("result", "bool"); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->onCombatEnd[] = [$this, "resetInitiative"]; |
75 | 75 | $this->onRoundStart[] = [$this, "applyEffectProviders"]; |
76 | 76 | $this->onRoundStart[] = [$this, "decreaseEffectsDuration"]; |
77 | - $this->onRoundStart[] = [$this ,"recalculateStats"]; |
|
77 | + $this->onRoundStart[] = [$this, "recalculateStats"]; |
|
78 | 78 | $this->onRoundStart[] = [$this, "logRoundNumber"]; |
79 | 79 | $this->onRoundStart[] = [$this, "applyPoison"]; |
80 | 80 | $this->onRound[] = [$this, "mainStage"]; |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function selectAttackTarget(Character $attacker): ?Character { |
345 | 345 | $enemyTeam = $this->getEnemyTeam($attacker); |
346 | - $rangedWeapon = ($attacker->equipment->hasItems(["%class%" => Weapon::class, "worn" => true, "ranged" => true,])); |
|
346 | + $rangedWeapon = ($attacker->equipment->hasItems(["%class%" => Weapon::class, "worn" => true, "ranged" => true, ])); |
|
347 | 347 | if(!$rangedWeapon) { |
348 | 348 | $rowToAttack = $enemyTeam->rowToAttack; |
349 | 349 | if(is_null($rowToAttack)) { |
350 | 350 | return null; |
351 | 351 | } |
352 | 352 | /** @var Team $enemies */ |
353 | - $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0,]), $enemyTeam->name); |
|
353 | + $enemies = Team::fromArray($enemyTeam->getItems(["positionRow" => $rowToAttack, "hitpoints>" => 0, ]), $enemyTeam->name); |
|
354 | 354 | } else { |
355 | 355 | $enemies = $enemyTeam; |
356 | 356 | } |
@@ -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: |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | continue 2; |
401 | 401 | } |
402 | 402 | } |
403 | - throw new NotImplementedException("Action $action is not implemented."); |
|
403 | + throw new NotImplementedException("action $action is not implemented."); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 |
@@ -201,10 +201,10 @@ |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | protected function setStats(array $stats): void { |
204 | - $requiredStats = array_merge(["id", "name", "level", "initiativeFormula",], static::BASE_STATS); |
|
205 | - $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender",]); |
|
204 | + $requiredStats = array_merge(["id", "name", "level", "initiativeFormula", ], static::BASE_STATS); |
|
205 | + $allStats = array_merge($requiredStats, ["occupation", "race", "specialization", "gender", ]); |
|
206 | 206 | $numberStats = static::BASE_STATS; |
207 | - $textStats = ["name", "race", "occupation", "specialization", "initiativeFormula",]; |
|
207 | + $textStats = ["name", "race", "occupation", "specialization", "initiativeFormula", ]; |
|
208 | 208 | $resolver = new OptionsResolver(); |
209 | 209 | $resolver->setDefined($allStats); |
210 | 210 | $resolver->setAllowedTypes("id", ["integer", "string"]); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function setTemplate(string $template): void { |
34 | 34 | if(!is_file($template)) { |
35 | - throw new \RuntimeException("File $template does not exist."); |
|
35 | + throw new \RuntimeException("file $template does not exist."); |
|
36 | 36 | } |
37 | 37 | $this->template = $template; |
38 | 38 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | case CombatActions\Attack::ACTION_NAME: |
56 | 56 | $message = ($item->result) ? "combat.log.attackHits" : "combat.log.attackFails"; |
57 | 57 | $text = $this->translator->translate($message, $item->amount, ["character1" => $character1, "character2" => $character2]); |
58 | - if($item->result AND $item->character2->hitpoints < 1) { |
|
58 | + if($item->result and $item->character2->hitpoints < 1) { |
|
59 | 59 | $text .= $this->translator->translate("combat.log.characterFalls"); |
60 | 60 | } |
61 | 61 | return $text; |
62 | 62 | case CombatActions\SkillAttack::ACTION_NAME: |
63 | 63 | $message = ($item->result) ? "combat.log.specialAttackHits" : "combat.log.specialAttackFails"; |
64 | 64 | $text = $this->translator->translate($message, $item->amount, ["character1" => $character1, "character2" => $character2, "name" => $item->name]); |
65 | - if($item->result AND $item->character2->hitpoints < 1) { |
|
65 | + if($item->result and $item->character2->hitpoints < 1) { |
|
66 | 66 | $text .= $this->translator->translate("combat.log.characterFalls"); |
67 | 67 | } |
68 | 68 | return $text; |
@@ -25,8 +25,10 @@ |
||
25 | 25 | return (in_array($character, $this->findHealers($combat)->toArray(), true) AND !is_null($this->selectHealingTarget($character, $combat))); |
26 | 26 | } |
27 | 27 | |
28 | - public function do(CombatBase $combat, Character $character): void { |
|
28 | + public function do { |
|
29 | + (CombatBase $combat, Character $character): void { |
|
29 | 30 | $result = []; |
31 | + } |
|
30 | 32 | /** @var Character $patient */ |
31 | 33 | $patient = $this->selectHealingTarget($character, $combat); |
32 | 34 | $result["result"] = $combat->successCalculator->hasHealed($character); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function shouldUse(CombatBase $combat, Character $character): bool { |
25 | - return (in_array($character, $this->findHealers($combat)->toArray(), true) AND !is_null($this->selectHealingTarget($character, $combat))); |
|
25 | + return (in_array($character, $this->findHealers($combat)->toArray(), true) and !is_null($this->selectHealingTarget($character, $combat))); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function do(CombatBase $combat, Character $character): void { |