@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | use HeroesofAbenez\Combat\NotImplementedException; |
| 12 | 12 | use Nexendrie\Utils\Numbers; |
| 13 | 13 | |
| 14 | -final class SkillAttack implements ICombatAction |
|
| 15 | -{ |
|
| 14 | +final class SkillAttack implements ICombatAction { |
|
| 16 | 15 | public const ACTION_NAME = "skill_attack"; |
| 17 | 16 | |
| 18 | 17 | public function getName(): string |
@@ -65,10 +64,12 @@ discard block |
||
| 65 | 64 | /** |
| 66 | 65 | * @throws NotImplementedException |
| 67 | 66 | */ |
| 68 | - public function do(CombatBase $combat, Character $character): void |
|
| 67 | + public function do { |
|
| 68 | + (CombatBase $combat, Character $character): void |
|
| 69 | 69 | { |
| 70 | 70 | /** @var CharacterAttackSkill $skill */ |
| 71 | 71 | $skill = $character->usableSkills[0]; |
| 72 | + } |
|
| 72 | 73 | /** @var Character $primaryTarget */ |
| 73 | 74 | $primaryTarget = $combat->selectAttackTarget($character); |
| 74 | 75 | $targets = match ($skill->skill->target) { |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | use HeroesofAbenez\Combat\ICombatAction; |
| 9 | 9 | use Nexendrie\Utils\Numbers; |
| 10 | 10 | |
| 11 | -final class Attack implements ICombatAction |
|
| 12 | -{ |
|
| 11 | +final class Attack implements ICombatAction { |
|
| 13 | 12 | public const ACTION_NAME = "attack"; |
| 14 | 13 | |
| 15 | 14 | public function getName(): string |
@@ -32,9 +31,11 @@ discard block |
||
| 32 | 31 | * Hit chance = Attacker's hit - Defender's dodge, but at least 15% |
| 33 | 32 | * Damage = Attacker's damage - defender's defense |
| 34 | 33 | */ |
| 35 | - public function do(CombatBase $combat, Character $character): void |
|
| 34 | + public function do { |
|
| 35 | + (CombatBase $combat, Character $character): void |
|
| 36 | 36 | { |
| 37 | 37 | $result = []; |
| 38 | + } |
|
| 38 | 39 | $defender = $combat->selectAttackTarget($character); |
| 39 | 40 | if ($defender === null) { |
| 40 | 41 | return; |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | use HeroesofAbenez\Combat\NotImplementedException; |
| 12 | 12 | use HeroesofAbenez\Combat\CharacterEffect; |
| 13 | 13 | |
| 14 | -final class SkillSpecial implements ICombatAction |
|
| 15 | -{ |
|
| 14 | +final class SkillSpecial implements ICombatAction { |
|
| 16 | 15 | public const ACTION_NAME = "skill_special"; |
| 17 | 16 | |
| 18 | 17 | public function getName(): string |
@@ -63,10 +62,12 @@ discard block |
||
| 63 | 62 | /** |
| 64 | 63 | * @throws NotImplementedException |
| 65 | 64 | */ |
| 66 | - public function do(CombatBase $combat, Character $character): void |
|
| 65 | + public function do { |
|
| 66 | + (CombatBase $combat, Character $character): void |
|
| 67 | 67 | { |
| 68 | 68 | /** @var CharacterSpecialSkill $skill */ |
| 69 | 69 | $skill = $character->usableSkills[0]; |
| 70 | + } |
|
| 70 | 71 | $targets = match ($skill->skill->target) { |
| 71 | 72 | Skill::TARGET_ENEMY => [$combat->selectAttackTarget($character)], |
| 72 | 73 | Skill::TARGET_SELF => [$character], |
@@ -9,8 +9,7 @@ discard block |
||
| 9 | 9 | use Nexendrie\Utils\Numbers; |
| 10 | 10 | use HeroesofAbenez\Combat\Team; |
| 11 | 11 | |
| 12 | -final class Heal implements ICombatAction |
|
| 13 | -{ |
|
| 12 | +final class Heal implements ICombatAction { |
|
| 14 | 13 | public const ACTION_NAME = "healing"; |
| 15 | 14 | |
| 16 | 15 | public function getName(): string |
@@ -28,9 +27,11 @@ discard block |
||
| 28 | 27 | return (in_array($character, $this->findHealers($combat)->toArray(), true) && $this->selectHealingTarget($character, $combat) !== null); |
| 29 | 28 | } |
| 30 | 29 | |
| 31 | - public function do(CombatBase $combat, Character $character): void |
|
| 30 | + public function do { |
|
| 31 | + (CombatBase $combat, Character $character): void |
|
| 32 | 32 | { |
| 33 | 33 | $result = []; |
| 34 | + } |
|
| 34 | 35 | /** @var Character $patient */ |
| 35 | 36 | $patient = $this->selectHealingTarget($character, $combat); |
| 36 | 37 | $result["result"] = $combat->successCalculator->hasHealed($character); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | public int $round = 0; |
| 19 | 19 | public string $title = ""; |
| 20 | 20 | |
| 21 | - public function __construct(private readonly ICombatLogRender $render, private readonly Translator $translator) |
|
| 22 | - { |
|
| 21 | + public function __construct(private readonly ICombatLogRender $render, private readonly Translator $translator) { |
|
| 23 | 22 | } |
| 24 | 23 | |
| 25 | 24 | /** |
@@ -3,10 +3,11 @@ |
||
| 3 | 3 | |
| 4 | 4 | namespace HeroesofAbenez\Combat; |
| 5 | 5 | |
| 6 | -interface ICombatAction |
|
| 7 | -{ |
|
| 6 | +interface ICombatAction { |
|
| 8 | 7 | public function getName(): string; |
| 9 | 8 | public function getPriority(): int; |
| 10 | 9 | public function shouldUse(CombatBase $combat, Character $character): bool; |
| 11 | - public function do(CombatBase $combat, Character $character): void; |
|
| 12 | -} |
|
| 10 | + public function do { |
|
| 11 | + (CombatBase $combat, Character $character): void; |
|
| 12 | + } |
|
| 13 | + } |
|
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | * @property-read bool $ranged |
| 14 | 14 | * @property-read string $damageStat |
| 15 | 15 | */ |
| 16 | -class Weapon extends Equipment |
|
| 17 | -{ |
|
| 16 | +class Weapon extends Equipment { |
|
| 18 | 17 | public const TYPE_SWORD = "sword"; |
| 19 | 18 | public const TYPE_AXE = "axe"; |
| 20 | 19 | public const TYPE_CLUB = "club"; |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @author Jakub Konečný |
| 12 | 12 | */ |
| 13 | -final class CombatLogEntry |
|
| 14 | -{ |
|
| 13 | +final class CombatLogEntry { |
|
| 15 | 14 | /** @internal */ |
| 16 | 15 | public const ACTION_POISON = "poison"; |
| 17 | 16 | |
@@ -22,8 +21,7 @@ discard block |
||
| 22 | 21 | public readonly bool $result; |
| 23 | 22 | public readonly int $amount; |
| 24 | 23 | |
| 25 | - public function __construct(array $action) |
|
| 26 | - { |
|
| 24 | + public function __construct(array $action) { |
|
| 27 | 25 | $resolver = new OptionsResolver(); |
| 28 | 26 | $this->configureOptions($resolver); |
| 29 | 27 | $action = $resolver->resolve($action); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | namespace HeroesofAbenez\Combat; |
| 5 | 5 | |
| 6 | -interface ICombatLogRender |
|
| 7 | -{ |
|
| 6 | +interface ICombatLogRender { |
|
| 8 | 7 | public function render(array $params): string; |
| 9 | 8 | } |