public class CreatureServerSide extends Creature implements BattleCritter
CreatureType
class,
mostly due to the fact that the latter doesn't handle the Titans
properly
TODO a lot of the code in here is about the battle rules, often
implemented in combination with the Battle class. It would be much
easier if this class was just a dumb critter and the rules of battles
are all in the Battle class.Modifier and Type | Field and Description |
---|---|
private BattleServerSide |
battle |
private boolean |
carryPossible |
private GameServerSide |
game
The game this creature belongs to.
|
private static java.util.logging.Logger |
LOGGER |
private java.util.SortedSet<PenaltyOption> |
penaltyOptions |
private int |
tag
Unique identifier for each critter.
|
private static int |
tagCounter
Counter used to assign unique tags.
|
IMPORTANCE_ORDER, legion
Constructor and Description |
---|
CreatureServerSide(CreatureType creature,
Legion legion,
GameServerSide game) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
assignStrikePenalty(java.lang.String prompt)
Side effects.
|
(package private) boolean |
canStrike(Creature target) |
(package private) void |
findCarries(CreatureServerSide target)
Side effects on penaltyOptions, Battle.carryTargets
|
private void |
findCarry(CreatureServerSide target,
BattleHex neighbor)
For a strike on target, find any carries (including those
only allowed via strike penalty) to the creature in neighbor
Side effects on penaltyOptions, Battle.carryTargets
|
Game |
getGame() |
(package private) java.util.Set<PenaltyOption> |
getPenaltyOptions() |
int |
getTag() |
int |
hashCode() |
boolean |
isDefender() |
private PenaltyOption |
matchingPenaltyOption(java.lang.String prompt)
Return true if the passed prompt matches one of the stored
penalty options.
|
private boolean |
possibleCarryToDir(BattleHex targetHex,
int dir)
Return true if carries are possible to the hex in direction
dir, considering only terrain.
|
(package private) void |
setBattleInfo(BattleHex currentHex,
BattleHex startingHex,
BattleServerSide battle) |
(package private) void |
setLegion(LegionServerSide legion) |
(package private) void |
strike(CreatureServerSide target)
Calculate number of dice and strike number needed to hit target,
and whether any carries and strike penalties are possible.
|
private void |
strike2(CreatureServerSide target,
int dice,
int strikeNumber)
Called after strike penalties are chosen.
|
java.lang.String |
toString() |
(package private) void |
undoMove() |
addPoisonDamage, addSlowed, adjustHits, commitMove, getCurrentHex, getDescription, getHits, getImageNames, getLegion, getMarkerId, getMaxCount, getName, getPlayer, getPluralName, getPointValue, getPoison, getPoisonDamage, getPower, getSkill, getSlowed, getSlows, getStartingHex, getStrikingPower, getStrikingSkill, getTitanPower, getType, hasMoved, hasStruck, heal, isDead, isDemiLord, isFlier, isImmortal, isLord, isLordOrDemiLord, isNativeAt, isNativeIn, isRangestriker, isSummonable, isTitan, moveToHex, setCurrentHex, setDead, setHits, setMoved, setPoisonDamage, setSlowed, setStartingHex, setStruck, useMagicMissile, wouldDieFrom
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
addPoisonDamage, addSlowed, getCurrentHex, getDescription, getHits, getPointValue, getPoison, getPoisonDamage, getPower, getSkill, getSlowed, getSlows, getStartingHex, getTitanPower, getType, hasMoved, hasStruck, isDead, isDemiLord, isLord, isRangestriker, isTitan, moveToHex, setCurrentHex, setDead, setHits, setMoved, setPoisonDamage, setSlowed, setStruck, useMagicMissile, wouldDieFrom
private static final java.util.logging.Logger LOGGER
private BattleServerSide battle
private final GameServerSide game
private final int tag
private static int tagCounter
private final java.util.SortedSet<PenaltyOption> penaltyOptions
private boolean carryPossible
public CreatureServerSide(CreatureType creature, Legion legion, GameServerSide game)
void setBattleInfo(BattleHex currentHex, BattleHex startingHex, BattleServerSide battle)
void setLegion(LegionServerSide legion)
public Game getGame()
public int getTag()
getTag
in interface BattleCritter
public boolean isDefender()
isDefender
in interface BattleCritter
void undoMove()
boolean canStrike(Creature target)
void strike(CreatureServerSide target)
void assignStrikePenalty(java.lang.String prompt)
private PenaltyOption matchingPenaltyOption(java.lang.String prompt)
void findCarries(CreatureServerSide target)
private boolean possibleCarryToDir(BattleHex targetHex, int dir)
private void findCarry(CreatureServerSide target, BattleHex neighbor)
private void strike2(CreatureServerSide target, int dice, int strikeNumber)
java.util.Set<PenaltyOption> getPenaltyOptions()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object