summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-18 16:24:53 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-18 16:24:53 +0100
commitba7371fa91a3af11d36f7f332e0823691a311414 (patch)
tree12aed7d457cd5bb11483d5b839a711493bd25ff7 /core
parent516e86d9aee3b441f070c46a367d321e5ba4fa5d (diff)
downloadRustAndDust-ba7371fa91a3af11d36f7f332e0823691a311414.zip
RustAndDust-ba7371fa91a3af11d36f7f332e0823691a311414.tar.gz
Unit: add promote(), degrade()
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index e9c2af4..d5576be 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -192,6 +192,34 @@ public class Unit extends HeadedPawn
return false;
}
+ public void promote()
+ {
+ if (isA(UnitId.GE_PANZER_IV))
+ id = UnitId.GE_PANZER_IV_HQ;
+ else if (isA(UnitId.US_PERSHING))
+ id = UnitId.US_PERSHING_HQ;
+ else if (isA(UnitId.US_SHERMAN))
+ id = UnitId.US_SHERMAN_HQ;
+ else
+ return;
+
+ type = UnitType.HARD_TARGET_HQ;
+ }
+
+ public void degrade()
+ {
+ if (isA(UnitId.GE_PANZER_IV_HQ))
+ id = UnitId.GE_PANZER_IV;
+ else if (isA(UnitId.US_PERSHING_HQ))
+ id = UnitId.US_PERSHING;
+ else if (isA(UnitId.US_SHERMAN_HQ))
+ id = UnitId.US_SHERMAN;
+ else
+ return;
+
+ type = UnitType.HARD_TARGET;
+ }
+
@Override
public boolean isHardTarget()
{