From bd8a14e5d22ee7e4e53a1b3c8bfe2b35328632e5 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 17 Aug 2025 20:49:03 -0300 Subject: Attack --- scripts/actors/actions/BumpAction.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/actors/actions/BumpAction.cs (limited to 'scripts/actors/actions/BumpAction.cs') diff --git a/scripts/actors/actions/BumpAction.cs b/scripts/actors/actions/BumpAction.cs new file mode 100644 index 0000000..e1fb706 --- /dev/null +++ b/scripts/actors/actions/BumpAction.cs @@ -0,0 +1,24 @@ +using Godot; +using System; + +public partial class BumpAction : DirectionalAction +{ + public BumpAction(Vector2I offset) : base(offset) + { + } + + public override void Perform(Game game, Actor actor) + { + Vector2I destination = actor.GridPosition + Offset; + + Action action; + + if (game.Map.GetBlockingActorAtPosition(destination) != null) { + action = new MeleeAction(Offset); + } else { + action = new MovementAction(Offset); + } + + action.Perform(game, actor); + } +} -- cgit v1.2.3