public abstract class Legion
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Legion.AcquirableDecision
Data for one pending decision.
|
Modifier and Type | Field and Description |
---|---|
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 |
skipThisTime
Flag to remember a "skip (split|move|recruit) this time"
|
private boolean |
teleported
Flag if the legion has teleported in the current masterboard round.
|
private boolean |
visitedThisPhase
Flag to remember that legion has been visited this phase
|
Constructor and Description |
---|
Legion(Player player,
java.lang.String markerId,
MasterHex hex) |
Modifier and Type | Method and Description |
---|---|
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 |
getLongMarkerId() |
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() |
boolean |
getSkipThisTime() |
Creature |
getTitan() |
boolean |
getVisitedThisPhase() |
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 |
setSkipThisTime(boolean skipIt) |
void |
setTeleported(boolean teleported) |
void |
setupAcquirableDecisions(int score,
int points)
Calculate the acquirableDecisions and store them in the legion.
|
void |
setVisitedThisPhase(boolean visited) |
java.lang.String |
toString()
Returns the markerId for debug and serialisation purposes.
|
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
private boolean skipThisTime
private boolean visitedThisPhase
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 java.lang.String getLongMarkerId()
public boolean hasTitan()
public Creature getTitan()
public int getHeight()
public void setMoved(boolean moved)
public boolean hasMoved()
public void setTeleported(boolean teleported)
public boolean hasTeleported()
public void setSkipThisTime(boolean skipIt)
public boolean getSkipThisTime()
public void setVisitedThisPhase(boolean visited)
public boolean getVisitedThisPhase()
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 acquiringpublic java.util.List<CreatureType> getCreatureTypes()
public java.util.List<CreatureType> findEligibleAngels(int points)
points
- Score threshold (100, ..., 400, 500) for which to get angelpublic 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