From 953e31e257dd6b3ed3595cc5b90dd13fdbf6e39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 14 Nov 2014 12:50:29 +0100 Subject: Naming attack -> engagement - move -> movement --- core/src/ch/asynk/tankontank/engine/Board.java | 8 ++--- core/src/ch/asynk/tankontank/engine/Pawn.java | 36 ++++++++++---------- .../ch/asynk/tankontank/engine/PossiblePaths.java | 12 +++---- .../ch/asynk/tankontank/engine/SearchBoard.java | 16 ++++----- core/src/ch/asynk/tankontank/game/Hex.java | 2 +- core/src/ch/asynk/tankontank/game/Map.java | 38 +++++++++++----------- core/src/ch/asynk/tankontank/game/Player.java | 10 +++--- core/src/ch/asynk/tankontank/game/Unit.java | 22 ++++++------- .../asynk/tankontank/game/states/StateCommon.java | 2 +- .../asynk/tankontank/game/states/StateEngage.java | 12 +++---- .../ch/asynk/tankontank/game/states/StateMove.java | 2 +- .../asynk/tankontank/game/states/StateRotate.java | 4 +-- 12 files changed, 82 insertions(+), 82 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 1b621c0..0d8f3dc 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -307,7 +307,7 @@ public abstract class Board implements Disposable targets.clear(); while (units.hasNext()) { Pawn target = units.next(); - if (pawn.canAttack(target) && searchBoard.collectAttacks(pawn, target, true)) + if (pawn.canEngage(target) && searchBoard.collectAttacks(pawn, target, true)) targets.add(target); } @@ -337,7 +337,7 @@ public abstract class Board implements Disposable assists.clear(); while (units.hasNext()) { Pawn p = units.next(); - if ((p != pawn) && p.canAttack(target) && searchBoard.collectAttacks(p, target, !p.canAssistAttackWithoutLos())) + if ((p != pawn) && p.canEngage(target) && searchBoard.collectAttacks(p, target, !p.canAssistEngagementWithoutLos())) assists.add(p); } @@ -418,7 +418,7 @@ public abstract class Board implements Disposable return RunnableAnimation.get(pawn, new Runnable() { @Override public void run() { - setPawnOnto(pawn, pawn.move.to, pawn.move.orientation); + setPawnOnto(pawn, pawn.movement.to, pawn.movement.orientation); } }); } @@ -438,7 +438,7 @@ public abstract class Board implements Disposable protected void rotatePawn(final Pawn pawn, Orientation o, RunnableAnimation whenDone) { - pawn.move.setRotation(pawn.getTile(), o); + pawn.movement.setRotation(pawn.getTile(), o); removePawn(pawn); AnimationSequence seq = pawn.getRotateAnimation(o.r(), 2); diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index b9fa335..423824b 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -25,7 +25,7 @@ public abstract class Pawn implements Moveable, Disposable { } - public class Attack + public class Engagement { Pawn target; int distance; @@ -35,7 +35,7 @@ public abstract class Pawn implements Moveable, Disposable public String toString() { - return "attack : " + target + " distance:" + distance + " clear:" + isClear + " flank:" + isFlank + " " + calculus; + return "engage : " + target + " distance:" + distance + " clear:" + isClear + " flank:" + isFlank + " " + calculus; } public void reset() @@ -47,7 +47,7 @@ public abstract class Pawn implements Moveable, Disposable } } - public class Move + public class Movement { Tile from; Tile to; @@ -101,14 +101,14 @@ public abstract class Pawn implements Moveable, Disposable protected String descr; private Image image; private StackedImages overlays; - public Attack attack = new Attack(); - public Move move = new Move(); + public Engagement engagement = new Engagement(); + public Movement movement= new Movement(); public abstract int getMovementPoints(); public abstract int getRoadMarchBonus(); public abstract int getAngleOfAttack(); public abstract int getFlankSides(); - public abstract int getAttackRangeFrom(Tile tile); + public abstract int getEngagementRangeFrom(Tile tile); public abstract boolean isUnit(); public abstract boolean isA(PawnType type); @@ -118,12 +118,12 @@ public abstract class Pawn implements Moveable, Disposable public abstract boolean canMove(); public abstract boolean canRotate(); - public abstract boolean canAttack(); - public abstract boolean canAttack(Pawn other); - public abstract boolean canAssistAttackWithoutLos(); + public abstract boolean canEngage(); + public abstract boolean canEngage(Pawn other); + public abstract boolean canAssistEngagementWithoutLos(); public abstract void move(); - public abstract void attack(); + public abstract void engage(); public abstract void revertLastMove(); @@ -158,17 +158,17 @@ public abstract class Pawn implements Moveable, Disposable public void reset() { - attack.reset(); - move.reset(); + engagement.reset(); + movement.reset(); } public void enterBoard(Tile to, Orientation o) { - move.to = to; - move.from = null; - move.entryMove = true; - move.orientation = o; - move.cost = to.costFrom(this, o); + movement.to = to; + movement.from = null; + movement.entryMove = true; + movement.orientation = o; + movement.cost = to.costFrom(this, o); move(); } @@ -189,7 +189,7 @@ public abstract class Pawn implements Moveable, Disposable public boolean isFlankAttack() { - return (attack.isClear && attack.isFlank); + return (engagement.isClear && engagement.isFlank); } public Tile getTile() diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java index 318aafc..83ce92e 100644 --- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java +++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java @@ -170,9 +170,9 @@ public class PossiblePaths implements Iterable public void applyToPawn(int i) { - pawn.move.from = from; - pawn.move.to = to; - pawn.move.orientation = orientation; + pawn.movement.from = from; + pawn.movement.to = to; + pawn.movement.orientation = orientation; pathCost(i); } @@ -196,9 +196,9 @@ public class PossiblePaths implements Iterable if (cost < 1) cost = 1; - pawn.move.cost = cost; - pawn.move.roadMarch = roadMarch; - pawn.move.distance = (1 + paths.get(i).size()); + pawn.movement.cost = cost; + pawn.movement.roadMarch = roadMarch; + pawn.movement.distance = (1 + paths.get(i).size()); return cost; } diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java index 2c5e326..a93bd67 100644 --- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java +++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java @@ -265,7 +265,7 @@ public class SearchBoard Node adjacents[] = new Node[6]; - int range = pawn.getAttackRangeFrom(pawn.getTile()); + int range = pawn.getEngagementRangeFrom(pawn.getTile()); int angle = pawn.getAngleOfAttack(); int extendedAngle = pawn.getOrientation().opposite().allBut(); @@ -308,7 +308,7 @@ public class SearchBoard Iterator it = t.iterator(); while (it.hasNext()) { Pawn target = it.next(); - if (pawn.canAttack(target)) + if (pawn.canEngage(target)) targets.add(target); } } @@ -325,11 +325,11 @@ public class SearchBoard Node from = getNode(pawn.getTile()); Node to = getNode(target.getTile()); - pawn.attack.isClear = false; - pawn.attack.target = target; - pawn.attack.distance = distance(from, to); + pawn.engagement.isClear = false; + pawn.engagement.target = target; + pawn.engagement.distance = distance(from, to); - if (pawn.attack.distance > pawn.getAttackRangeFrom(pawn.getTile())) + if (pawn.engagement.distance > pawn.getEngagementRangeFrom(pawn.getTile())) return false; List los = lineOfSight(from.col, from.row, to.col, to.row, clearVisibility); @@ -340,8 +340,8 @@ public class SearchBoard if (!validatePathAngle(pawn.getAngleOfAttack(), los)) return false; - pawn.attack.isClear = true; - pawn.attack.isFlank = isFlankAttack(target.getFlankSides(), los); + pawn.engagement.isClear = true; + pawn.engagement.isFlank = isFlankAttack(target.getFlankSides(), los); return true; } diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index 302dc86..656a1e6 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -138,7 +138,7 @@ public class Hex extends Tile break; } - pawn.attack.calculus += " >= " + def + " + " + tdef; + pawn.engagement.calculus += " >= " + def + " + " + tdef; return (def + tdef); } } diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index e22b373..3735d40 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -30,14 +30,14 @@ public abstract class Map extends Board public final Board.PawnCollection moveablePawns; public final Board.PawnCollection possibleTargets; - public final Board.PawnCollection attackAssists; + public final Board.PawnCollection engagementAssists; public final Board.PawnCollection activatedPawns; public final Board.PawnCollection breakPawns; private final SpriteAnimation explosion; private final SpriteAnimation explosions; private final Sound moveSound; - private final Sound attackSound; + private final Sound engagementSound; private Sound sound; private long soundId = -1; @@ -50,7 +50,7 @@ public abstract class Map extends Board this.explosion = new SpriteAnimation(game.manager.get("data/explosion.png", Texture.class), 10, 4, 40); this.explosions = new SpriteAnimation(game.manager.get("data/explosions.png", Texture.class), 16, 8, 15); this.moveSound = game.manager.get("sounds/move.mp3", Sound.class); - this.attackSound = game.manager.get("sounds/attack.mp3", Sound.class); + this.engagementSound = game.manager.get("sounds/attack.mp3", Sound.class); setup(); @@ -59,7 +59,7 @@ public abstract class Map extends Board moveablePawns = new PawnSet(this, 6); possibleTargets = new PawnSet(this, 10); - attackAssists = new PawnSet(this, 6); + engagementAssists = new PawnSet(this, 6); activatedPawns = new PawnSet(this, 7); breakPawns = new PawnSet(this, 4); } @@ -72,7 +72,7 @@ public abstract class Map extends Board explosion.dispose(); explosions.dispose(); moveSound.dispose(); - attackSound.dispose(); + engagementSound.dispose(); } public void clearAll() @@ -81,7 +81,7 @@ public abstract class Map extends Board possibleTargets.clear(); possiblePaths.clear(); moveablePawns.clear(); - attackAssists.clear(); + engagementAssists.clear(); activatedPawns.clear(); breakPawns.clear(); } @@ -112,7 +112,7 @@ public abstract class Map extends Board public int collectPossibleTargets(Pawn pawn, Iterator foes) { - if (!pawn.canAttack()) { + if (!pawn.canEngage()) { possibleTargets.clear(); return 0; } @@ -122,7 +122,7 @@ public abstract class Map extends Board public int collectMoveablePawns(Pawn pawn) { - if (pawn.isHq() && !pawn.move.entryMove) { + if (pawn.isHq() && !pawn.movement.entryMove) { collectMoveAssists(pawn, moveablePawns); } else { moveablePawns.clear(); @@ -134,7 +134,7 @@ public abstract class Map extends Board public int collectAttackAssists(Pawn pawn, Pawn target, Iterator units) { - int s = collectAttackAssists(pawn, target, units, attackAssists); + int s = collectAttackAssists(pawn, target, units, engagementAssists); activatedPawns.add(pawn); return s; } @@ -242,17 +242,17 @@ public abstract class Map extends Board ctrl.animationDone(); } - public boolean attackPawn(Pawn pawn, final Pawn target, int d1, int d2) + public boolean engagePawn(Pawn pawn, final Pawn target, int d1, int d2) { int activatedUnits = activatedPawns.size(); int dice = d1 + d2; final boolean success; if (dice == 2) { - pawn.attack.calculus = "2D6 -> (1 + 1) automatic failure"; + pawn.engagement.calculus = "2D6 -> (1 + 1) automatic failure"; success = false; } else if (dice == 12) { - pawn.attack.calculus = "2D6 -> (6 + 6) automatic success"; + pawn.engagement.calculus = "2D6 -> (6 + 6) automatic success"; success = true; } else { int flankAttacks = 0; @@ -262,11 +262,11 @@ public abstract class Map extends Board break; } } - pawn.attack.calculus = "2D6 -> (" + d1 + " + " + d2 + ") + " + activatedUnits + " + " + flankAttacks; + pawn.engagement.calculus = "2D6 -> (" + d1 + " + " + d2 + ") + " + activatedUnits + " + " + flankAttacks; int def = target.getTile().defenseFor(pawn, target, activatedPawns); success = ((dice + activatedUnits + flankAttacks) >= def); } - TankOnTank.debug(pawn + " attacks " + target + " : " + pawn.attack.calculus); + TankOnTank.debug(pawn + " engagements " + target + " : " + pawn.engagement.calculus); AnimationSequence seq = AnimationSequence.get(2); if (success) { @@ -288,7 +288,7 @@ public abstract class Map extends Board breakPawns.clear(); for (Pawn p : activatedPawns) { - p.attack(); + p.engage(); if (p.isA(Unit.UnitType.INFANTRY)) breakPawns.add(p); } @@ -297,7 +297,7 @@ public abstract class Map extends Board activatedPawns.clear(); addAnimation(seq); - sound = attackSound; + sound = engagementSound; sound.play(1.0f); return success; @@ -322,9 +322,9 @@ public abstract class Map extends Board public void hideMoveablePawns() { moveablePawns.enable(Unit.MOVE, false); } public void showPossibleTargets() { possibleTargets.enable(Unit.TARGET, true); } public void hidePossibleTargets() { possibleTargets.enable(Unit.TARGET, false); } - public void showAttackAssists() { attackAssists.enable(Unit.MAY_FIRE, true); } - public void hideAttackAssists() { attackAssists.enable(Unit.FIRE, false); - attackAssists.enable(Unit.MAY_FIRE, false); } + public void showAttackAssists() { engagementAssists.enable(Unit.MAY_FIRE, true); } + public void hideAttackAssists() { engagementAssists.enable(Unit.FIRE, false); + engagementAssists.enable(Unit.MAY_FIRE, false); } public void showBreakPawns() { breakPawns.enable(Unit.MOVE, true); } public void hideBreakPawns() { breakPawns.enable(Unit.MOVE, false); } diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index fe450fa..d7b26f2 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -17,8 +17,8 @@ public class Player extends ch.asynk.tankontank.engine.Player private boolean deploymentDone; // stats public int actionCount; - public int lostAttackCount; - public int wonAttackCount; + public int lostEngagementCount; + public int wonEngagementCount; public Player(final TankOnTank game, Army army, int n) { @@ -28,8 +28,8 @@ public class Player extends ch.asynk.tankontank.engine.Player this.actionPoints = 0; this.deploymentDone = false; this.actionCount = 0; - this.lostAttackCount = 0; - this.wonAttackCount = 0; + this.lostEngagementCount = 0; + this.wonEngagementCount = 0; } public String toString() @@ -40,7 +40,7 @@ public class Player extends ch.asynk.tankontank.engine.Player public String getStats() { - return String.format("%s\n%4d\n%4d\n%4d\n%4d\n%4d", getName(), actionCount, unitsLeft(), casualties.size(), wonAttackCount, lostAttackCount); + return String.format("%s\n%4d\n%4d\n%4d\n%4d\n%4d", getName(), actionCount, unitsLeft(), casualties.size(), wonEngagementCount, lostEngagementCount); } public int getAp() diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index e97ff2f..dd68b20 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -114,7 +114,7 @@ public class Unit extends HeadedPawn } @Override - public int getAttackRangeFrom(Tile tile) + public int getEngagementRangeFrom(Tile tile) { if ((type != UnitType.INFANTRY) && (((Hex) tile).terrain == Hex.Terrain.HILLS)) return rng + 1; @@ -181,40 +181,40 @@ public class Unit extends HeadedPawn } @Override - public boolean canAttack() + public boolean canEngage() { if (isHardTarget()) return !hasFired; return (!hasMoved && !hasFired); } @Override - public boolean canAssistAttackWithoutLos() + public boolean canAssistEngagementWithoutLos() { return (type == UnitType.ARTILLERY); } @Override - public boolean canAttack(Pawn other) + public boolean canEngage(Pawn other) { - return (isEnemy(other) && canAttack()); + return (isEnemy(other) && canEngage()); } @Override public void move() { - TankOnTank.debug(move.toString()); - if (move.cost > mpLeft) TankOnTank.debug("ERROR: Movement point exceeded: " + move.cost + "/" + mpLeft + " please report"); + TankOnTank.debug(movement.toString()); + if (movement.cost > mpLeft) TankOnTank.debug("ERROR: Movement point exceeded: " + movement.cost + "/" + mpLeft + " please report"); - if (move.isComplete()) { + if (movement.isComplete()) { hasMoved = true; } - mpLeft -= move.cost; + mpLeft -= movement.cost; } @Override - public void attack() + public void engage() { - TankOnTank.debug(attack.toString()); + TankOnTank.debug(engagement.toString()); hasFired = true; } diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index 7c71a9a..9dbd177 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -64,7 +64,7 @@ public abstract class StateCommon implements State protected void showPossibilities(Unit pawn) { if (ctrl.cfg.showMoves && pawn.canMove()) map.showPossibleMoves(); - if (ctrl.cfg.showTargets && pawn.canAttack()) map.showPossibleTargets(); + if (ctrl.cfg.showTargets && pawn.canEngage()) map.showPossibleTargets(); if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveablePawns(); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateEngage.java b/core/src/ch/asynk/tankontank/game/states/StateEngage.java index c157a69..af461e8 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateEngage.java +++ b/core/src/ch/asynk/tankontank/game/states/StateEngage.java @@ -56,17 +56,17 @@ public class StateEngage extends StateCommon StateType nextState = StateType.DONE; int d1 = ctrl.player.d6(); int d2 = ctrl.player.d6(); - if (map.attackPawn(selectedUnit, activeUnit, d1, d2)) { - ctrl.player.wonAttackCount += 1; - ctrl.hud.notify(selectedUnit.attack.calculus + " : " + activeUnit + " is destroyed"); + if (map.engagePawn(selectedUnit, activeUnit, d1, d2)) { + ctrl.player.wonEngagementCount += 1; + ctrl.hud.notify(selectedUnit.engagement.calculus + " : " + activeUnit + " is destroyed"); ctrl.opponent.casualty(activeUnit); if (map.breakPawns.size() > 0) { ctrl.hud.pushNotify("Break move possible"); nextState = StateType.BREAK; } } else { - ctrl.player.lostAttackCount += 1; - ctrl.hud.notify(selectedUnit.attack.calculus + " : failure"); + ctrl.player.lostEngagementCount += 1; + ctrl.hud.notify(selectedUnit.engagement.calculus + " : failure"); } activeUnit.showTarget(); @@ -97,7 +97,7 @@ public class StateEngage extends StateCommon ctrl.hud.actionButtons.show(Buttons.ENGAGE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); } - if ((activeUnit != null) && map.attackAssists.contains(unit)) { + if ((activeUnit != null) && map.engagementAssists.contains(unit)) { if(map.toggleAttackAssist(unit)) ctrl.hud.notify(unit + " will fire"); else diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index fbc71ea..333f1b0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -58,7 +58,7 @@ public class StateMove extends StateCommon hideAssists(); ctrl.setAnimationCount(map.activatedPawns.size()); map.revertMoves(); - if (activeUnit.move.entryMove) { + if (activeUnit.movement.entryMove) { map.leaveBoard(activeUnit); ctrl.player.revertUnitEntry(activeUnit); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index 2066a8a..ec085b0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -47,7 +47,7 @@ public class StateRotate extends StateCommon { StateType nextState = StateType.ABORT; ctrl.hud.actionButtons.hide(); - if (activeUnit.move.entryMove) { + if (activeUnit.movement.entryMove) { map.leaveBoard(activeUnit); ctrl.player.revertUnitEntry(activeUnit); } @@ -81,7 +81,7 @@ public class StateRotate extends StateCommon o = Orientation.fromAdj(to.getCol(), to.getRow(), downHex.getCol(), downHex.getRow()); if (o == Orientation.KEEP) return; - if (!activeUnit.move.entryMove && rotateOnly && (o == activeUnit.getOrientation())) return; + if (!activeUnit.movement.entryMove && rotateOnly && (o == activeUnit.getOrientation())) return; rotationSet = true; -- cgit v1.1-2-g2b99