From c6bbb834f7758027c0df338f1520f34fad3befea Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 9 Sep 2025 19:09:34 -0300 Subject: Organização MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Entities/Actions/Action.cs | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 scripts/Entities/Actions/Action.cs (limited to 'scripts/Entities/Actions/Action.cs') diff --git a/scripts/Entities/Actions/Action.cs b/scripts/Entities/Actions/Action.cs new file mode 100644 index 0000000..b2d6a4b --- /dev/null +++ b/scripts/Entities/Actions/Action.cs @@ -0,0 +1,69 @@ +using Godot; +using TheLegendOfGustav.Entities.Actors; +using TheLegendOfGustav.Map; + +namespace TheLegendOfGustav.Entities.Actions; + +/// +/// Action representa uma ação no jogo efetuada por um ator. +/// Ações são geradas pelo jogador e pela IA, elas regem os atores do jogo. +/// +public abstract partial class Action : RefCounted +{ + private Actor actor; + + private int cost; + + public Action(Actor actor) + { + Actor = actor; + // Custo base, subclasses podem sobreescrever isto se quiserem. + Cost = 10; + } + + /// + /// O ator que realiza a ação. + /// + public Actor Actor + { + get => actor; + private set + { + actor = value; + } + } + + /// + /// O custo da ação. + /// + protected int Cost + { + get => cost; + set + { + cost = value; + } + } + + /// + /// É conveniente ter acesso ao mapa dentro de uma ação. + /// + protected MapData MapData + { + get => actor.MapData; + } + + /// + /// Método que executa a ação. Subclasses da ação devem implementar este método. + /// + /// Exemplo: + /// + /// Action action = new Action(actor); + /// /* . . . */ + /// action.Perform(); + /// + /// + /// + /// Se a ação foi executada ou não. + public abstract bool Perform(); +} -- cgit v1.2.3