diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-14 16:53:55 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-14 16:53:55 +0200 |
commit | 605d4e13db0d6401927f0b03ed9c6764bd2147d2 (patch) | |
tree | 562bcf9bb961b7eac3b0a9900c3c2790cce3df7a /core/src/ch/asynk/tankontank/game/states | |
parent | 8cef42c8fcdfc38ffe66f122ff89e14c643f7709 (diff) | |
download | RustAndDust-605d4e13db0d6401927f0b03ed9c6764bd2147d2.zip RustAndDust-605d4e13db0d6401927f0b03ed9c6764bd2147d2.tar.gz |
add promote action
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
5 files changed, 50 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java index bbf54d1..c6aebc6 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java @@ -11,7 +11,7 @@ public class StateAttack extends StateCommon public void enter(boolean fromSelect) { map.clearPossibleTargets(); - ctrl.hud.show(false, false, true, false, ctrl.cfg.canCancel); + ctrl.hud.show(false, false, false, true, false, ctrl.cfg.canCancel); ctrl.hud.attackBtn.setOn(); if (fromSelect) { @@ -56,7 +56,7 @@ public class StateAttack extends StateCommon map.showTarget(to, true); map.buildAttackAssists(selectedPawn, activePawn, to, ctrl.currentPlayer().unitIterator()); map.showAttackAssists(true); - ctrl.hud.show(false, false, true, true, ctrl.cfg.canCancel); + ctrl.hud.show(false, false, false, true, true, ctrl.cfg.canCancel); } if ((activePawn != null) && map.isInPossibleAttackAssists(upHex)) { diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index 43a8d7f..e8e1c3b 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -10,7 +10,7 @@ public class StateMove extends StateCommon public void enter(boolean fromSelect) { map.clearPossiblePaths(); - ctrl.hud.show(true, true, false, ((map.activablePawnsCount() + map.activatedPawnsCount()) > 1), ctrl.cfg.canCancel); + ctrl.hud.show(false, true, true, false, ((map.activablePawnsCount() + map.activatedPawnsCount()) > 1), ctrl.cfg.canCancel); ctrl.hud.moveBtn.setOn(); if (fromSelect) { diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java new file mode 100644 index 0000000..cb86fd9 --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java @@ -0,0 +1,44 @@ +package ch.asynk.tankontank.game.states; + +import ch.asynk.tankontank.engine.Pawn; +import ch.asynk.tankontank.game.State.StateType; + +public class StatePromote extends StateCommon +{ + @Override + public void enter(boolean flag) + { + ctrl.hud.hide(); + Pawn p = ctrl.currentPlayer().promote(selectedPawn); + if (p != null) { + map.promote(selectedPawn, p); + } + done(); + } + + @Override + public void leave(StateType nextState) + { + } + + @Override + public void touchDown() + { + } + + @Override + public void touchUp() + { + } + + @Override + public void abort() + { + } + + @Override + public void done() + { + super.done(); + } +} diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index 9b26288..43350df 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -15,7 +15,7 @@ public class StateRotate extends StateCommon this.rotateOnly = rotateOnly; // if ((map.activablePawnsCount() + map.activatedPawnsCount()) == 1) - ctrl.hud.show(true, false, false, false, ctrl.cfg.canCancel); + ctrl.hud.show(false, true, false, false, false, ctrl.cfg.canCancel); ctrl.hud.rotateBtn.setOn(); if (rotateOnly) { @@ -68,7 +68,7 @@ public class StateRotate extends StateCommon if (ctrl.cfg.mustValidate) { map.showDirections(to, false); map.showOrientation(to, true, o); - ctrl.hud.show(true, false, false, true, ctrl.cfg.canCancel); + ctrl.hud.show(false, true, false, false, true, ctrl.cfg.canCancel); } else doRotation(o); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 5dc5e68..10fbed1 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -57,6 +57,7 @@ public class StateSelect extends StateCommon int assists = map.buildMoveAssists(selectedPawn, selectedHex); showPossibleTargetsMovesAssists(selectedPawn); ctrl.hud.show( + ctrl.currentPlayer().canPromote(selectedPawn), selectedPawn.canMove(), (selectedPawn.canMove() && (moves > 0)), (selectedPawn.canAttack() && (targets > 0)), |