@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | protected function generateCharacter(int $id): Character { |
24 | 24 | $stats = [ |
25 | - "id" => $id, "name" => "Player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
25 | + "id" => $id, "name" => "player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
26 | 26 | "dexterity" => 10, "constitution" => 10, "intelligence" => 10, "charisma" => 10 |
27 | 27 | ]; |
28 | 28 | $petStats = [ |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | protected function generateCharacter(int $id): Character { |
31 | 31 | $stats = [ |
32 | - "id" => $id, "name" => "Player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
32 | + "id" => $id, "name" => "player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
33 | 33 | "dexterity" => 10, "constitution" => 10, "intelligence" => 10, "charisma" => 10 |
34 | 34 | ]; |
35 | 35 | $skillData = [ |
@@ -14,7 +14,7 @@ |
||
14 | 14 | final class CharacterTest extends \Tester\TestCase { |
15 | 15 | protected function generateCharacter(int $id): Character { |
16 | 16 | $stats = [ |
17 | - "id" => $id, "name" => "Player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
17 | + "id" => $id, "name" => "player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
18 | 18 | "dexterity" => 10, "constitution" => 10, "intelligence" => 10, "charisma" => 10 |
19 | 19 | ]; |
20 | 20 | return new Character($stats); |
@@ -58,9 +58,11 @@ |
||
58 | 58 | /** |
59 | 59 | * @throws NotImplementedException |
60 | 60 | */ |
61 | - public function do(CombatBase $combat, Character $character): void { |
|
61 | + public function do { |
|
62 | + (CombatBase $combat, Character $character): void { |
|
62 | 63 | /** @var CharacterAttackSkill $skill */ |
63 | 64 | $skill = $character->usableSkills[0]; |
65 | + } |
|
64 | 66 | /** @var Character $primaryTarget */ |
65 | 67 | $primaryTarget = $combat->selectAttackTarget($character); |
66 | 68 | $targets = match($skill->skill->target) { |
@@ -67,7 +67,7 @@ |
||
67 | 67 | Skill::TARGET_SINGLE => [$primaryTarget], |
68 | 68 | Skill::TARGET_ROW => $combat->getTeam($primaryTarget)->getItems(["positionRow" => $primaryTarget->positionRow]), |
69 | 69 | Skill::TARGET_COLUMN => $combat->getTeam($primaryTarget)->getItems(["positionColumn" => $primaryTarget->positionColumn]), |
70 | - default => throw new NotImplementedException("Target {$skill->skill->target} for attack skills is not implemented."), |
|
70 | + default => throw new NotImplementedException("target {$skill->skill->target} for attack skills is not implemented."), |
|
71 | 71 | }; |
72 | 72 | /** @var Character $target */ |
73 | 73 | foreach($targets as $target) { |
@@ -56,9 +56,11 @@ |
||
56 | 56 | /** |
57 | 57 | * @throws NotImplementedException |
58 | 58 | */ |
59 | - public function do(CombatBase $combat, Character $character): void { |
|
59 | + public function do { |
|
60 | + (CombatBase $combat, Character $character): void { |
|
60 | 61 | /** @var CharacterSpecialSkill $skill */ |
61 | 62 | $skill = $character->usableSkills[0]; |
63 | + } |
|
62 | 64 | $targets = match($skill->skill->target) { |
63 | 65 | Skill::TARGET_ENEMY => [$combat->selectAttackTarget($character)], |
64 | 66 | Skill::TARGET_SELF => [$character], |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | "character1" => $character1, "character2" => $target, |
42 | 42 | ]; |
43 | 43 | $effect = new CharacterEffect([ |
44 | - "id" => "skill{$skill->skill->id}Effect", |
|
44 | + "id" => "skill{$skill->skill->id}effect", |
|
45 | 45 | "type" => $skill->skill->type, |
46 | 46 | "stat" => ((in_array($skill->skill->type, Skill::NO_STAT_TYPES, true)) ? null : $skill->skill->stat), |
47 | 47 | "value" => $skill->value, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | Skill::TARGET_SELF => [$character], |
65 | 65 | Skill::TARGET_PARTY => $combat->getTeam($character)->toArray(), |
66 | 66 | Skill::TARGET_ENEMY_PARTY => $combat->getEnemyTeam($character)->toArray(), |
67 | - default => throw new NotImplementedException("Target {$skill->skill->target} for special skills is not implemented."), |
|
67 | + default => throw new NotImplementedException("target {$skill->skill->target} for special skills is not implemented."), |
|
68 | 68 | }; |
69 | 69 | foreach($targets as $target) { |
70 | 70 | $this->doSingleTarget($character, $target, $skill, $combat); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public const STATUS_POISONED = "poisoned"; |
76 | 76 | public const STATUS_HIDDEN = "hidden"; |
77 | 77 | |
78 | - protected int|string $id; |
|
78 | + protected int | string $id; |
|
79 | 79 | protected string $name; |
80 | 80 | protected string $gender = "male"; |
81 | 81 | protected string $race; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $this->dodgeBase = $this->dodge; |
201 | 201 | } |
202 | 202 | |
203 | - protected function getId(): int|string { |
|
203 | + protected function getId(): int | string { |
|
204 | 204 | return $this->id; |
205 | 205 | } |
206 | 206 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public readonly string $stat; |
26 | 26 | public readonly int $value; |
27 | 27 | public readonly bool $valueAbsolute; |
28 | - protected int|string $duration; |
|
28 | + protected int | string $duration; |
|
29 | 29 | /** @var callable[] */ |
30 | 30 | public array $onApply = []; |
31 | 31 | /** @var callable[] */ |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | return Constants::getConstantsValues(static::class, "DURATION_"); |
103 | 103 | } |
104 | 104 | |
105 | - protected function getDuration(): int|string { |
|
105 | + protected function getDuration(): int | string { |
|
106 | 106 | return $this->duration; |
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @throws \InvalidArgumentException |
111 | 111 | */ |
112 | - protected function setDuration(string|int $value): void { |
|
112 | + protected function setDuration(string | int $value): void { |
|
113 | 113 | if(!is_int($value) && !in_array($value, $this->getDurations(), true)) { |
114 | 114 | throw new \InvalidArgumentException("Invalid value set to CharacterEffect::\$duration. Expected string or integer."); |
115 | 115 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function generateCharacter(int $id): Character { |
22 | 22 | $stats = [ |
23 | - "id" => $id, "name" => "Player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
23 | + "id" => $id, "name" => "player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
24 | 24 | "dexterity" => 10, "constitution" => 10, "intelligence" => 10, "charisma" => 10 |
25 | 25 | ]; |
26 | 26 | return new Character($stats); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function generateCharacter(int $id): Character { |
22 | 22 | $stats = [ |
23 | - "id" => $id, "name" => "Player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
23 | + "id" => $id, "name" => "player $id", "level" => 1, "initiativeFormula" => "1d2+DEX/4", "strength" => 10, |
|
24 | 24 | "dexterity" => 10, "constitution" => 10, "intelligence" => 10, "charisma" => 10 |
25 | 25 | ]; |
26 | 26 | return new Character($stats); |