From 4dc8f0f982408ad71c0ad94e7f84fcfd1edf3ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 9 Dec 2015 08:28:55 +0100 Subject: Battle: add actionDone() --- core/src/ch/asynk/rustanddust/game/Battle.java | 2 ++ core/src/ch/asynk/rustanddust/game/Ctrl.java | 5 +---- core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 10 ++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index c6e4983..86d95a7 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -23,6 +23,8 @@ public interface Battle public Player getVictor(); + public boolean actionDone(); + public boolean turnDone(); public boolean isDeploymentDone(); diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 23116db..e80890c 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -133,11 +133,8 @@ public class Ctrl implements Disposable StateType nextState = this.state.execute(); if (nextState == StateType.DONE) { - map.actionDone(); - if (map.unitsActivatedSize() > 0) { - RustAndDust.debug("Ctrl", "burn down 1AP"); + if (battle.actionDone()) { hud.notify("1 Action Point burnt", 0.6f, Position.BOTTOM_CENTER, false); - battle.getPlayer().burnDownOneAp(); hud.update(); } if (battle.getPlayer().apExhausted()) diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 13edd7c..0cc2189 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -71,6 +71,16 @@ public abstract class BattleCommon implements Battle } @Override + public boolean actionDone() + { + boolean burn = (map.unitsActivatedSize() > 0); + if (burn) + currentPlayer.burnDownOneAp(); + map.actionDone(); + return burn; + } + + @Override public boolean turnDone() { map.turnDone(); -- cgit v1.1-2-g2b99