diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-19 10:16:16 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-19 10:16:16 +0100 |
commit | 10a812dabf1518f68bb91e30ef05acd5514516a9 (patch) | |
tree | 1db0057b7cdc316551d79156fe327508d6268b99 /core | |
parent | 747637fce3ac01f785f77d0a3592e756955d0107 (diff) | |
download | RustAndDust-10a812dabf1518f68bb91e30ef05acd5514516a9.zip RustAndDust-10a812dabf1518f68bb91e30ef05acd5514516a9.tar.gz |
Player: promote does all the job, returns boolean
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Player.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index ffca1a2..9bc1c2b 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -205,17 +205,16 @@ public class Player return false; } - public Unit promote(Unit unit) + public boolean promote(Unit unit) { for (Unit p: casualties) { if (p.isHqOf(unit)) { - units.remove(unit); - casualties.add(unit); - units.add(p); - casualties.remove(p); - return p; + unit.promote(); + p.degrade(); + return true; } } - return null; + + return false; } } |