|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.colossus.game.Legion
public abstract class Legion
Nested Class Summary | |
---|---|
class |
Legion.AcquirableDecision
Data for one pending decision. |
Field Summary | |
---|---|
protected int |
angelsToAcquire
|
private java.util.List<Creature> |
creatures
The creatures in this legion. |
private MasterHex |
currentHex
The current position of the legion on the masterboard. |
protected java.util.List<Legion.AcquirableDecision> |
decisions
|
private EntrySide |
entrySide
The side this legion entered a battle in. |
private java.lang.String |
markerId
The ID of the marker of this legion. |
private boolean |
moved
Flag if the legion has moved in the current masterboard round. |
static java.util.Comparator<Legion> |
ORDER_TITAN_THEN_POINTS
A comparator to order legions by points, with Titan armies first. |
static java.util.Comparator<Legion> |
ORDER_TITAN_THEN_POINTS_THEN_MARKER
A comparator to order legions by points, with Titan armies first. |
private Player |
player
The player/game combination owning this Legion. |
private CreatureType |
recruit
The creature recruited in last recruit phase |
private boolean |
teleported
Flag if the legion has teleported in the current masterboard round. |
Constructor Summary | |
---|---|
Legion(Player player,
java.lang.String markerId,
MasterHex hex)
|
Method Summary | |
---|---|
abstract void |
addCreature(CreatureType type)
|
(package private) java.util.List<Legion.AcquirableDecision> |
calculateAcquirableDecisions(int score,
int points)
From the given score, awarding given points, calculate the choices for each threshold that will be crossed. |
boolean |
canFlee()
|
boolean |
contains(CreatureType type)
|
boolean |
equals(java.lang.Object obj)
Two legions are considered equal if they have the same marker. |
java.util.List<CreatureType> |
findEligibleAngels(int points)
Calculate which angels this legion can get in its current land when crossing the given points threshold |
java.util.List<? extends Creature> |
getCreatures()
TODO should be an unmodifiable List, but can't at the moment since both derived classes and users might still expect to change it TODO should be List |
java.util.List<CreatureType> |
getCreatureTypes()
Retrieves a list of all creature types in this legion. |
MasterHex |
getCurrentHex()
Returns the current position of the legion. |
EntrySide |
getEntrySide()
|
int |
getHeight()
Returns the number of creatures in this legion. |
java.lang.String |
getMarkerId()
|
Player |
getPlayer()
Retrieves the player this legion belongs to. |
abstract int |
getPointValue()
TODO unify between the two derived classes if possible -- the handling of Titans is quite different, although it should have the same result |
CreatureType |
getRecruit()
|
int |
hashCode()
|
boolean |
hasMoved()
|
boolean |
hasRecruited()
|
boolean |
hasSummonable()
|
boolean |
hasTeleported()
|
boolean |
hasTitan()
|
int |
numCreature(CreatureType creatureType)
|
int |
numLords()
|
int |
numRangestrikers()
|
abstract void |
removeCreature(CreatureType type)
|
void |
setCurrentHex(MasterHex newPosition)
Places the legion into the new position. |
void |
setEntrySide(EntrySide entrySide)
|
void |
setMoved(boolean moved)
|
void |
setRecruit(CreatureType recruit)
|
void |
setTeleported(boolean teleported)
|
void |
setupAcquirableDecisions(int score,
int points)
Calculate the acquirableDecisions and store them in the legion. |
java.lang.String |
toString()
Returns the markerId for debug and serialisation purposes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Comparator<Legion> ORDER_TITAN_THEN_POINTS
public static final java.util.Comparator<Legion> ORDER_TITAN_THEN_POINTS_THEN_MARKER
private final Player player
private MasterHex currentHex
private final java.util.List<Creature> creatures
private final java.lang.String markerId
private boolean moved
private boolean teleported
private EntrySide entrySide
protected java.util.List<Legion.AcquirableDecision> decisions
protected int angelsToAcquire
private CreatureType recruit
Constructor Detail |
---|
public Legion(Player player, java.lang.String markerId, MasterHex hex)
Method Detail |
---|
public Player getPlayer()
public void setCurrentHex(MasterHex newPosition)
newPosition
- the hex that will be the new position. Not null.getCurrentHex()
public MasterHex getCurrentHex()
setCurrentHex(MasterHex)
public java.util.List<? extends Creature> getCreatures()
public java.lang.String getMarkerId()
public boolean hasTitan()
public int getHeight()
public void setMoved(boolean moved)
public boolean hasMoved()
public void setTeleported(boolean teleported)
public boolean hasTeleported()
public boolean contains(CreatureType type)
public abstract void addCreature(CreatureType type)
public abstract void removeCreature(CreatureType type)
public void setEntrySide(EntrySide entrySide)
public EntrySide getEntrySide()
public abstract int getPointValue()
public CreatureType getRecruit()
public void setRecruit(CreatureType recruit)
public boolean hasRecruited()
public boolean hasSummonable()
public boolean canFlee()
public int numCreature(CreatureType creatureType)
public int numLords()
public int numRangestrikers()
public void setupAcquirableDecisions(int score, int points)
score
- points
- java.util.List<Legion.AcquirableDecision> calculateAcquirableDecisions(int score, int points)
score
- Current score of playerpoints
- Points to be added which entitle to acquiring
public java.util.List<CreatureType> getCreatureTypes()
public java.util.List<CreatureType> findEligibleAngels(int points)
points
- Score threshold (100, ..., 400, 500) for which to get angel
public final java.lang.String toString()
toString
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)
equals(Object)
and hashCode()
declared final.
equals
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |