diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 16:58:58 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-04 16:58:58 -0300 |
| commit | 6f2c2edd52171a4df7f35de695c9b2e7801d3e5f (patch) | |
| tree | 509002136987182309a934623b19d19393e306e3 /scripts/entities/actors/actions/MeleeAction.cs | |
| parent | 9953c9a5818baa392a48a4d18339c73f3b7a814e (diff) | |
Preparação para itens
Diffstat (limited to 'scripts/entities/actors/actions/MeleeAction.cs')
| -rw-r--r-- | scripts/entities/actors/actions/MeleeAction.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/entities/actors/actions/MeleeAction.cs b/scripts/entities/actors/actions/MeleeAction.cs index b20430a..6dfeb78 100644 --- a/scripts/entities/actors/actions/MeleeAction.cs +++ b/scripts/entities/actors/actions/MeleeAction.cs @@ -15,7 +15,15 @@ public partial class MeleeAction : DirectionalAction public override void Perform() { // Eu te disse que este método seria útil. - Actor target = GetTargetActor(); + Entity potentialTarget = GetTarget(); + + // Só podemos atacar atores. + if (potentialTarget is not Actor) { + return; + } + + Actor target = (Actor)potentialTarget; + // Se não houver um ator na direção, não podemos continuar. // Isto é uma ação gratuita. @@ -24,13 +32,13 @@ public partial class MeleeAction : DirectionalAction // não podemos ter dano negativo. int damage = actor.Atk - target.Def; - string attackDesc = $"{actor.ActorName} ataca {target.ActorName}"; + string attackDesc = $"{actor.DisplayName} ataca {target.DisplayName}"; if (damage > 0) { attackDesc += $" e remove {damage} de HP."; target.Hp -= damage; } else { - attackDesc += $" mas {target.ActorName} tem músculos de aço."; + attackDesc += $" mas {target.DisplayName} tem músculos de aço."; } MessageLogData.Instance.AddMessage(attackDesc); |
