diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-20 14:30:33 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-20 14:30:33 +0100 |
commit | ace9bc6875f0037e432f0d718495d09c55615ac3 (patch) | |
tree | 42eddc0bc7de79f10e53ae620e764ed0175ebd4a /core/src/ch/asynk/tankontank/game/states | |
parent | 893541b6132bf71e62c4cc4d3bcec844dee0b4be (diff) | |
download | RustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.zip RustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.tar.gz |
engine.PawnSet is dead : welcome UnitSet
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
9 files changed, 28 insertions, 28 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java index 6b5dea2..034bb0b 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java +++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java @@ -16,13 +16,13 @@ public class StateBreak extends StateCommon activeUnit = null; ctrl.hud.actionButtons.show(Buttons.DONE.b); ctrl.hud.pushNotify("Break move possible"); - map.showBreakPawns(); + map.showBreakUnits(); } @Override public void leave(StateType nextState) { - map.hideBreakPawns(); + map.hideBreakUnits(); map.hideMove(to); map.hideDirections(to); map.hideOrientation(to); @@ -51,12 +51,12 @@ public class StateBreak extends StateCommon { if (activeUnit == null) { Unit unit = upHex.getUnit(); - if (map.breakPawns.contains(unit)) { + if (map.breakUnits.contains(unit)) { activeUnit = unit; map.showMove(upHex); map.showMove(to); map.showDirections(to); - map.hideBreakPawns(); + map.hideBreakUnits(); } } else { o = Orientation.fromAdj(to, upHex); @@ -81,7 +81,7 @@ public class StateBreak extends StateCommon map.possiblePaths.init(activeUnit); if (map.possiblePaths.build(to) == 1) { map.possiblePaths.orientation = o; - map.movePawn(activeUnit, o); + map.moveUnit(activeUnit, o); ctrl.setAnimationCount(1); ctrl.setAfterAnimationState(StateType.DONE); } else diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index 2da80ae..b20c5d0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -68,14 +68,14 @@ public abstract class StateCommon implements State { if (ctrl.cfg.showMoves && pawn.canMove()) map.showPossibleMoves(); if (ctrl.cfg.showTargets && pawn.canEngage()) map.showPossibleTargets(); - if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveablePawns(); + if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveableUnits(); } protected void hidePossibilities() { map.hidePossibleMoves(); map.hidePossibleTargets(); - map.hideMoveablePawns(); + map.hideMoveableUnits(); } protected boolean checkExit(Unit unit, Hex hex) diff --git a/core/src/ch/asynk/tankontank/game/states/StateDeployment.java b/core/src/ch/asynk/tankontank/game/states/StateDeployment.java index 89e97aa..ace1265 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateDeployment.java +++ b/core/src/ch/asynk/tankontank/game/states/StateDeployment.java @@ -1,10 +1,10 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.engine.Orientation; -import ch.asynk.tankontank.engine.PawnSet; import ch.asynk.tankontank.game.Hex; import ch.asynk.tankontank.game.Zone; import ch.asynk.tankontank.game.Unit; +import ch.asynk.tankontank.game.UnitSet; import ch.asynk.tankontank.game.hud.ActionButtons.Buttons; import ch.asynk.tankontank.TankOnTank; @@ -13,7 +13,7 @@ public class StateDeployment extends StateCommon { private boolean done; private Zone entryZone; - private PawnSet deployedUnits = new PawnSet(map, 10); + private UnitSet deployedUnits = new UnitSet(map, 10); @Override public void enter(StateType prevState) diff --git a/core/src/ch/asynk/tankontank/game/states/StateEngage.java b/core/src/ch/asynk/tankontank/game/states/StateEngage.java index 0ef213d..14465cc 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateEngage.java +++ b/core/src/ch/asynk/tankontank/game/states/StateEngage.java @@ -19,7 +19,7 @@ public class StateEngage extends StateCommon activeUnit = null; // use selectedHex and selectedUnit map.hidePossibleTargets(); - map.collectPossibleTargets(selectedUnit, ctrl.opponent.unitsAsPawns()); + map.collectPossibleTargets(selectedUnit, ctrl.opponent.units); map.showPossibleTargets(); if (to != null) { // quick fire -> replay touchUp @@ -46,7 +46,7 @@ public class StateEngage extends StateCommon @Override public StateType abort() { - map.activatedPawns.clear(); + map.activatedUnits.clear(); return StateType.ABORT; } @@ -54,11 +54,11 @@ public class StateEngage extends StateCommon public StateType done() { StateType nextState = StateType.DONE; - if (map.engagePawn(selectedUnit, activeUnit)) { + if (map.engageUnit(selectedUnit, activeUnit)) { ctrl.player.wonEngagementCount += 1; ctrl.hud.notify(selectedUnit.engagement.calculus + " : " + activeUnit + " is destroyed"); ctrl.opponent.casualty(activeUnit); - if (map.breakPawns.size() > 0) { + if (map.breakUnits.size() > 0) { nextState = StateType.BREAK; } } else { @@ -89,7 +89,7 @@ public class StateEngage extends StateCommon to = upHex; activeUnit = unit; activeUnit.showTarget(); - map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.unitsAsPawns()); + map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.units); map.showAttackAssists(); ctrl.hud.actionButtons.show(Buttons.ENGAGE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateEscape.java b/core/src/ch/asynk/tankontank/game/states/StateEscape.java index 30af8e5..6c76a74 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateEscape.java +++ b/core/src/ch/asynk/tankontank/game/states/StateEscape.java @@ -61,7 +61,7 @@ public class StateEscape extends StateCommon map.leaveBoard(unit); ctrl.player.unitEscape(unit); - if (map.movePawn(activeUnit, exitZone.orientation) > 0) + if (map.moveUnit(activeUnit, exitZone.orientation) > 0) return StateType.MOVE; return StateType.DONE; } diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index d56c650..13280ce 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -9,7 +9,7 @@ public class StateMove extends StateCommon @Override public void enter(StateType prevState) { - boolean moreThanOne = ((map.moveablePawns.size() + map.activatedPawns.size()) > 1); + boolean moreThanOne = ((map.moveableUnits.size() + map.activatedUnits.size()) > 1); ctrl.hud.actionButtons.show(Buttons.ROTATE.b | Buttons.MOVE.b | ((moreThanOne) ? Buttons.DONE.b : 0) | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); ctrl.hud.actionButtons.setOn(Buttons.MOVE); @@ -38,7 +38,7 @@ public class StateMove extends StateCommon if (selectedUnit.canMove()) { changeUnit(selectedUnit); } else { - changeUnit((Unit) map.moveablePawns.first()); + changeUnit((Unit) map.moveableUnits.first()); } } } @@ -67,7 +67,7 @@ public class StateMove extends StateCommon public StateType abort() { hideAssists(); - int n = map.activatedPawns.size(); + int n = map.activatedUnits.size(); if (n == 0) return StateType.ABORT; ctrl.setAnimationCount(n); @@ -84,7 +84,7 @@ public class StateMove extends StateCommon { hideAssists(); // be sure that the hq is activated - if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) + if (selectedUnit.canMove() && (map.activatedUnits.size() > 0)) selectedUnit.setMoved(); return StateType.DONE; @@ -102,7 +102,7 @@ public class StateMove extends StateCommon Unit unit = upHex.getUnit(); - if (map.moveablePawns.contains(unit)) { + if (map.moveableUnits.contains(unit)) { if(unit != activeUnit) changeUnit(unit); } else if ((s == 0) && map.possibleMoves.contains(upHex)) { @@ -119,7 +119,7 @@ public class StateMove extends StateCommon private void hideAssists() { - map.hideMoveablePawns(); + map.hideMoveableUnits(); } private void changeUnit(Unit unit) diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java index 3d83ec3..8606986 100644 --- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java +++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java @@ -10,7 +10,7 @@ public class StatePromote extends StateCommon ctrl.hud.actionButtons.hide(); String str = selectedUnit.toString(); if (ctrl.player.promote(selectedUnit)) { - map.activatedPawns.add(selectedUnit); + map.activatedUnits.add(selectedUnit); ctrl.hud.notify(str+ " has been promoted"); } ctrl.setState(StateType.DONE); diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index c9949ab..ddc5737 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -60,7 +60,7 @@ public class StateRotate extends StateCommon map.leaveBoard(activeUnit); ctrl.player.revertUnitEntry(activeUnit); } - if (map.activatedPawns.size() == 0) { + if (map.activatedUnits.size() == 0) { hideAssists(); } else { nextState = StateType.MOVE; @@ -104,7 +104,7 @@ public class StateRotate extends StateCommon private void hideAssists() { - map.hideMoveablePawns(); + map.hideMoveableUnits(); } private void doRotation(Orientation o) @@ -112,7 +112,7 @@ public class StateRotate extends StateCommon StateType whenDone = StateType.DONE; ctrl.hud.notify("Move " + activeUnit); - if (map.movePawn(activeUnit, o) > 0) + if (map.moveUnit(activeUnit, o) > 0) whenDone = StateType.MOVE; ctrl.setAnimationCount(1); diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index ae70328..46b73c0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -77,11 +77,11 @@ public class StateSelect extends StateCommon int moves = map.collectPossibleMoves(selectedUnit); int targets = 0; if (isEnemy) - targets = map.collectPossibleTargets(selectedUnit, ctrl.player.unitsAsPawns()); + targets = map.collectPossibleTargets(selectedUnit, ctrl.player.units); else - targets = map.collectPossibleTargets(selectedUnit, ctrl.opponent.unitsAsPawns()); + targets = map.collectPossibleTargets(selectedUnit, ctrl.opponent.units); if (moves > 0) - map.collectMoveablePawns(selectedUnit); + map.collectMoveableUnits(selectedUnit); showPossibilities(selectedUnit); ctrl.hud.actionButtons.show( ((ctrl.player.canPromote(selectedUnit)) ? Buttons.PROMOTE.b : 0 ) | |