From 6f2c2edd52171a4df7f35de695c9b2e7801d3e5f Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 4 Sep 2025 16:58:58 -0300 Subject: Preparação para itens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/entities/actors/actions/MeleeAction.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'scripts/entities/actors/actions/MeleeAction.cs') 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); -- cgit v1.2.3