diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-19 10:15:47 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-19 10:15:47 +0100 |
commit | 747637fce3ac01f785f77d0a3592e756955d0107 (patch) | |
tree | aaa460f3650a9910df3bd930766a22a000bbbd95 /core | |
parent | 36c821c2d8881a1244fc6c7fbbd68ec67f48331e (diff) | |
download | RustAndDust-747637fce3ac01f785f77d0a3592e756955d0107.zip RustAndDust-747637fce3ac01f785f77d0a3592e756955d0107.tar.gz |
Unit: add private updateDescr()
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 164d43c..a53dab0 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -79,6 +79,15 @@ public class Unit extends HeadedPawn enableOverlay(HQ, isHq()); this.hasMoved = false; this.hasFired = false; + updateDescr(); + } + + private void updateDescr() + { + if (cdef == -1) + this.descr = id.toString() + (ace ? " Ace " : "") + " (" + rng + "-" + def + "-" + mp + ")"; + else + this.descr = id.toString() + (ace ? " Ace " : "") + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")"; } // hard tager @@ -87,10 +96,10 @@ public class Unit extends HeadedPawn this(army, unit, head, pawns, overlays); this.rng = range; this.def = defense; + this.cdef = -1; this.mp = movementPoints; this.id = id; this.type = type; - this.descr = id.toString() + " (" + rng + "-" + def + "-" + mp + ")"; commonSetup(); } @@ -104,7 +113,6 @@ public class Unit extends HeadedPawn this.mp = movementPoints; this.id = id; this.type = type; - this.descr = id.toString() + " (" + rng + "-" + def + "/" + cdef + "-" + mp + ")"; commonSetup(); } @@ -121,6 +129,7 @@ public class Unit extends HeadedPawn public void setAce(boolean ace) { this.ace = ace; + updateDescr(); enableOverlay(ACE, ace); } @@ -211,6 +220,7 @@ public class Unit extends HeadedPawn type = UnitType.HARD_TARGET_HQ; enableOverlay(HQ, true); + updateDescr(); } public void degrade() @@ -226,6 +236,7 @@ public class Unit extends HeadedPawn type = UnitType.HARD_TARGET; enableOverlay(HQ, false); + updateDescr(); } @Override |