diff options
Diffstat (limited to 'scripts/entities/actions')
| -rw-r--r-- | scripts/entities/actions/Action.cs | 3 | ||||
| -rw-r--r-- | scripts/entities/actions/BumpAction.cs | 4 | ||||
| -rw-r--r-- | scripts/entities/actions/MeleeAction.cs | 7 | ||||
| -rw-r--r-- | scripts/entities/actions/MovementAction.cs | 8 | ||||
| -rw-r--r-- | scripts/entities/actions/WaitAction.cs | 3 |
5 files changed, 15 insertions, 10 deletions
diff --git a/scripts/entities/actions/Action.cs b/scripts/entities/actions/Action.cs index f20e262..3f15105 100644 --- a/scripts/entities/actions/Action.cs +++ b/scripts/entities/actions/Action.cs @@ -31,7 +31,8 @@ public abstract partial class Action : RefCounted { /// </code> /// </example> /// </summary> - public abstract void Perform(); + /// <returns>Se a ação foi executada ou não.</returns> + public abstract bool Perform(); /// <summary> /// É conveniente ter acesso ao mapa dentro de uma ação. diff --git a/scripts/entities/actions/BumpAction.cs b/scripts/entities/actions/BumpAction.cs index bee202b..fa2605f 100644 --- a/scripts/entities/actions/BumpAction.cs +++ b/scripts/entities/actions/BumpAction.cs @@ -13,7 +13,7 @@ public partial class BumpAction : DirectionalAction // Como esta ação inevitavelmente gera outras ações, // não faz sentido descontar a energia do ator. - public override void Perform() + public override bool Perform() { // Declaramos uma ação genérica. Action action; @@ -27,6 +27,6 @@ public partial class BumpAction : DirectionalAction } // Executa a ação. - action.Perform(); + return action.Perform(); } } diff --git a/scripts/entities/actions/MeleeAction.cs b/scripts/entities/actions/MeleeAction.cs index 6dfeb78..09c5cc7 100644 --- a/scripts/entities/actions/MeleeAction.cs +++ b/scripts/entities/actions/MeleeAction.cs @@ -12,14 +12,14 @@ public partial class MeleeAction : DirectionalAction /// <summary> /// Ataca o ator na direção da ação. /// </summary> - public override void Perform() + public override bool Perform() { // Eu te disse que este método seria útil. Entity potentialTarget = GetTarget(); // Só podemos atacar atores. if (potentialTarget is not Actor) { - return; + return false; } Actor target = (Actor)potentialTarget; @@ -27,7 +27,7 @@ public partial class MeleeAction : DirectionalAction // Se não houver um ator na direção, não podemos continuar. // Isto é uma ação gratuita. - if (target == null) return; + if (target == null) return false; // não podemos ter dano negativo. int damage = actor.Atk - target.Def; @@ -43,5 +43,6 @@ public partial class MeleeAction : DirectionalAction MessageLogData.Instance.AddMessage(attackDesc); actor.Energy -= cost; + return true; } } diff --git a/scripts/entities/actions/MovementAction.cs b/scripts/entities/actions/MovementAction.cs index 2c394fc..403ec0a 100644 --- a/scripts/entities/actions/MovementAction.cs +++ b/scripts/entities/actions/MovementAction.cs @@ -9,16 +9,18 @@ public partial class MovementAction : DirectionalAction { } - public override void Perform() + public override bool Perform() { // Não anda se o destino for um tile sólido. - if (!Map_Data.GetTile(Destination).IsWalkable) return; + if (!Map_Data.GetTile(Destination).IsWalkable) return true; // Não anda se o destino for oculpado por um ator. // Na maioria dos casos, essa condição nunca é verdadeira. - if (GetTarget() != null) return; + if (GetTarget() != null) return true; actor.Walk(Offset); actor.Energy -= cost; + + return true; } } diff --git a/scripts/entities/actions/WaitAction.cs b/scripts/entities/actions/WaitAction.cs index 2d3ccc2..c26d884 100644 --- a/scripts/entities/actions/WaitAction.cs +++ b/scripts/entities/actions/WaitAction.cs @@ -9,7 +9,7 @@ public partial class WaitAction : Action { } - public override void Perform() + public override bool Perform() { //-=-==============================================-======++++*@@%*+#%%+*%%#*#%%@%**%%#=:+%@%=--.....::::@@@:................... #@----::@@@@@@@@@@@@@ //--============--===========================================+@. :@ =% @ :* @#= @@*........@@@:................ .::::::@@@@@@@@@@@@ @@ -97,6 +97,7 @@ public partial class WaitAction : Action //@@@@@@@@@@@======++====+*%@@@@%%%@@@@%*+#@@@@@%#%@@#=+**=. =**+=***==*#*: :%@@@@@@@@@**=+#*==*###*=. -=**+::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@+==+==++=====++=====++=+++++++++===+++++#% +@@@* :#%= =@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ actor.Energy -= cost; + return true; } |
