Package net.sf.colossus.game
Class BattleUnit
java.lang.Object
net.sf.colossus.game.BattleUnit
- All Implemented Interfaces:
BattleCritter
Class BattleUnit represents a Creature in a specific Battle.
GUI aspects moved to new Class GUIBattleChit.
TODO This should at some point extend Creature, or perhaps Creature can
take care of all so no extend is needed; but right now, Creature handles
some things (e.g. how to change the hexes) differently than how it's done
here, so can not "just delegate it" - needs investigation and checking.
- Author:
- David Ripton, Clemens Katzer (strip GUI issues out, to own new Class)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Listeners who needs to be notified if (currently) hits or dead values change, to trigger repaint: a GUIBattleChit representing this creature -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CreatureType
private BattleHex
private boolean
private final boolean
private int
private final String
private final Legion
private final Set
<BattleUnit.Listener> Listeners to be informed when something changes, e.g.private static final Logger
private boolean
private int
private int
private int
private int
private BattleHex
private boolean
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionBattleUnit
(String id, boolean defender, int tag, BattleHex currentHex, CreatureType type, Legion legion) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(BattleUnit.Listener listener) void
addPoisonDamage
(int damage) void
addSlowed
(int slowValue) int
getHits()
getId()
int
int
int
int
int
getPower()
int
getSkill()
int
int
getSlows()
int
getTag()
int
int
getType()
boolean
hasMoved()
boolean
boolean
isDead()
boolean
boolean
boolean
isLord()
boolean
boolean
isTitan()
void
void
void
removeListener
(BattleUnit.Listener listener) void
setCurrentHex
(BattleHex hex) void
setDead
(boolean dead) void
setHits
(int hits) void
setMoved
(boolean moved) void
setPoison
(int damage) void
setPoisonDamage
(int damage) void
setSlowed
(int slowValue) void
setSlows
(int slowValue) void
setStruck
(boolean struck) toString()
boolean
boolean
wouldDieFrom
(int hits)
-
Field Details
-
LOGGER
-
tag
private final int tag -
id
-
defender
private final boolean defender -
creatureType
-
legion
-
hits
private int hits -
poisonDamage
private int poisonDamage -
poison
private int poison -
slows
private int slows -
slowed
private int slowed -
currentHex
-
startingHex
-
moved
private boolean moved -
struck
private boolean struck -
dead
private boolean dead -
listeners
Listeners to be informed when something changes, e.g. right now only GUIBattleChit that needs to repaint if dead or hits change.
-
-
Constructor Details
-
BattleUnit
public BattleUnit(String id, boolean defender, int tag, BattleHex currentHex, CreatureType type, Legion legion)
-
-
Method Details
-
getLegion
-
getTag
public int getTag()- Specified by:
getTag
in interfaceBattleCritter
-
getHits
public int getHits()- Specified by:
getHits
in interfaceBattleCritter
-
setHits
public void setHits(int hits) - Specified by:
setHits
in interfaceBattleCritter
-
setPoison
public void setPoison(int damage) -
setPoisonDamage
public void setPoisonDamage(int damage) - Specified by:
setPoisonDamage
in interfaceBattleCritter
-
addPoisonDamage
public void addPoisonDamage(int damage) - Specified by:
addPoisonDamage
in interfaceBattleCritter
-
setSlowed
public void setSlowed(int slowValue) - Specified by:
setSlowed
in interfaceBattleCritter
-
addSlowed
public void addSlowed(int slowValue) - Specified by:
addSlowed
in interfaceBattleCritter
-
setSlows
public void setSlows(int slowValue) -
wouldDieFrom
public boolean wouldDieFrom(int hits) - Specified by:
wouldDieFrom
in interfaceBattleCritter
-
setDead
public void setDead(boolean dead) - Specified by:
setDead
in interfaceBattleCritter
-
isDead
public boolean isDead()- Specified by:
isDead
in interfaceBattleCritter
-
getCurrentHex
- Specified by:
getCurrentHex
in interfaceBattleCritter
-
getStartingHex
- Specified by:
getStartingHex
in interfaceBattleCritter
-
setCurrentHex
- Specified by:
setCurrentHex
in interfaceBattleCritter
-
moveToHex
- Specified by:
moveToHex
in interfaceBattleCritter
-
hasMoved
public boolean hasMoved()- Specified by:
hasMoved
in interfaceBattleCritter
-
setMoved
public void setMoved(boolean moved) - Specified by:
setMoved
in interfaceBattleCritter
-
hasStruck
public boolean hasStruck()- Specified by:
hasStruck
in interfaceBattleCritter
-
setStruck
public void setStruck(boolean struck) - Specified by:
setStruck
in interfaceBattleCritter
-
getType
- Specified by:
getType
in interfaceBattleCritter
-
isDefender
public boolean isDefender()- Specified by:
isDefender
in interfaceBattleCritter
-
getId
-
isTitan
public boolean isTitan()- Specified by:
isTitan
in interfaceBattleCritter
-
isLord
public boolean isLord()- Specified by:
isLord
in interfaceBattleCritter
-
isDemiLord
public boolean isDemiLord()- Specified by:
isDemiLord
in interfaceBattleCritter
-
getPower
public int getPower()- Specified by:
getPower
in interfaceBattleCritter
-
getTitanPower
public int getTitanPower()- Specified by:
getTitanPower
in interfaceBattleCritter
-
getIdBasedTitanPower
public int getIdBasedTitanPower() -
getTitanPowerViaLegionAndPlayer
public int getTitanPowerViaLegionAndPlayer() -
getSkill
public int getSkill()- Specified by:
getSkill
in interfaceBattleCritter
-
getPointValue
public int getPointValue()- Specified by:
getPointValue
in interfaceBattleCritter
-
getPoison
public int getPoison()- Specified by:
getPoison
in interfaceBattleCritter
-
getPoisonDamage
public int getPoisonDamage()- Specified by:
getPoisonDamage
in interfaceBattleCritter
-
getSlowed
public int getSlowed()- Specified by:
getSlowed
in interfaceBattleCritter
-
getSlows
public int getSlows()- Specified by:
getSlows
in interfaceBattleCritter
-
isRangestriker
public boolean isRangestriker()- Specified by:
isRangestriker
in interfaceBattleCritter
-
useMagicMissile
public boolean useMagicMissile()- Specified by:
useMagicMissile
in interfaceBattleCritter
-
getDescription
- Specified by:
getDescription
in interfaceBattleCritter
-
toString
-
addListener
-
removeListener
-
notifyListeners
public void notifyListeners()
-