diff options
Diffstat (limited to 'scripts/actors/actions')
| -rw-r--r-- | scripts/actors/actions/Action.cs | 5 | ||||
| -rw-r--r-- | scripts/actors/actions/BumpAction.cs | 4 | ||||
| -rw-r--r-- | scripts/actors/actions/MeleeAction.cs | 1 | ||||
| -rw-r--r-- | scripts/actors/actions/MovementAction.cs | 1 | ||||
| -rw-r--r-- | scripts/actors/actions/WaitAction.cs | 1 |
5 files changed, 10 insertions, 2 deletions
diff --git a/scripts/actors/actions/Action.cs b/scripts/actors/actions/Action.cs index 0320dd8..f20e262 100644 --- a/scripts/actors/actions/Action.cs +++ b/scripts/actors/actions/Action.cs @@ -11,8 +11,13 @@ public abstract partial class Action : RefCounted { /// </summary> protected Actor actor; + // O custo da ação. + protected int cost; + public Action(Actor actor) { this.actor = actor; + // Custo base, subclasses podem sobreescrever isto se quiserem. + cost = 10; } /// <summary> diff --git a/scripts/actors/actions/BumpAction.cs b/scripts/actors/actions/BumpAction.cs index 0ce7fbe..805520c 100644 --- a/scripts/actors/actions/BumpAction.cs +++ b/scripts/actors/actions/BumpAction.cs @@ -11,10 +11,10 @@ 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() { - Vector2I destination = actor.GridPosition + Offset; - // Declaramos uma ação genérica. Action action; diff --git a/scripts/actors/actions/MeleeAction.cs b/scripts/actors/actions/MeleeAction.cs index c61a803..56a2dc3 100644 --- a/scripts/actors/actions/MeleeAction.cs +++ b/scripts/actors/actions/MeleeAction.cs @@ -32,6 +32,7 @@ public partial class MeleeAction : DirectionalAction attackDesc += $" mas {target.ActorName} tem músculos de aço."; } + actor.Energy -= cost; GD.Print(attackDesc); } } diff --git a/scripts/actors/actions/MovementAction.cs b/scripts/actors/actions/MovementAction.cs index b37f9ae..6cec875 100644 --- a/scripts/actors/actions/MovementAction.cs +++ b/scripts/actors/actions/MovementAction.cs @@ -18,6 +18,7 @@ public partial class MovementAction : DirectionalAction // Na maioria dos casos, essa condição nunca é verdadeira. if (GetTargetActor() != null) return; + actor.Energy -= cost; actor.Walk(Offset); } } diff --git a/scripts/actors/actions/WaitAction.cs b/scripts/actors/actions/WaitAction.cs index 4ad064a..2d3ccc2 100644 --- a/scripts/actors/actions/WaitAction.cs +++ b/scripts/actors/actions/WaitAction.cs @@ -96,6 +96,7 @@ public partial class WaitAction : Action //@@@@@@@@@@@@*====+==++=*@. @ @@* .@* @ .*#. @ @* #: -@ @@% @ -+ =*%@@= @@: @ @ +. #+ *@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@======++====+*%@@@@%%%@@@@%*+#@@@@@%#%@@#=+**=. =**+=***==*#*: :%@@@@@@@@@**=+#*==*###*=. -=**+::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@+==+==++=====++=====++=+++++++++===+++++#% +@@@* :#%= =@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + actor.Energy -= cost; } |
