|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.colossus.game.Creature
net.sf.colossus.server.CreatureServerSide
public class CreatureServerSide
Class Critter represents an individual Titan Character.
TODO this duplicates functionality from the 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.
Field Summary | |
---|---|
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. |
Fields inherited from class net.sf.colossus.game.Creature |
---|
IMPORTANCE_ORDER, legion |
Constructor Summary | |
---|---|
CreatureServerSide(CreatureType creature,
Legion legion,
GameServerSide game)
|
Method Summary | |
---|---|
(package private) void |
assignStrikePenalty(java.lang.String prompt)
Side effects. |
(package private) boolean |
canStrike(Creature target)
|
private void |
chooseStrikePenalty()
|
protected int |
countBrambleHexes(BattleHex targetHex)
Deprecated. another function with explicit reference to Bramble that should be fixed. |
(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 |
private int |
getAttackerSkill(Creature target)
WARNING: this is duplicated in Strike |
(package private) BattleServerSide |
getBattle()
|
protected int |
getDice(Creature target)
Return the number of dice that will be rolled when striking this target, including modifications for terrain. |
(package private) java.util.Set<PenaltyOption> |
getPenaltyOptions()
|
protected int |
getStrikeNumber(Creature target)
WARNING: this is duplicated in Strike |
(package private) int |
getTag()
|
int |
hashCode()
|
protected boolean |
isInContact(boolean countDead)
Return true if there are any enemies adjacent to this critter. |
private PenaltyOption |
matchingPenaltyOption(java.lang.String prompt)
Return true if the passed prompt matches one of the stored penalty options. |
(package private) void |
moveToHex(BattleHex hexLabel,
boolean tellClients)
Most code should use Battle.doMove() instead, since it checks for legality and logs the move. |
private int |
numInContact(boolean countDead)
Return the number of enemy creatures in contact with this critter. |
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()
|
Methods inherited from class net.sf.colossus.game.Creature |
---|
commitMove, getCurrentHex, getDescription, getHits, getImageNames, getLegion, getMarkerId, getMaxCount, getName, getPlayer, getPluralName, getPointValue, getPower, getSkill, getStartingHex, getStrikingPower, getStrikingSkill, getType, hasMoved, hasStruck, heal, isDead, isDemiLord, isFlier, isImmortal, isLord, isLordOrDemiLord, isNativeBramble, isNativeDune, isNativeHexside, isNativeRiver, isNativeSlope, isNativeStone, isNativeTerrain, isNativeVolcano, isRangestriker, isSummonable, isTitan, isWaterDwelling, moveToHex, setCurrentHex, setDead, setHits, setMoved, setStartingHex, setStruck, useMagicMissile, wound |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public CreatureServerSide(CreatureType creature, Legion legion, GameServerSide game)
Method Detail |
---|
void setBattleInfo(BattleHex currentHex, BattleHex startingHex, BattleServerSide battle)
void setLegion(LegionServerSide legion)
int getTag()
BattleServerSide getBattle()
private int numInContact(boolean countDead)
protected boolean isInContact(boolean countDead)
void moveToHex(BattleHex hexLabel, boolean tellClients)
void undoMove()
boolean canStrike(Creature target)
protected int getDice(Creature target)
private int getAttackerSkill(Creature target)
@Deprecated protected int countBrambleHexes(BattleHex targetHex)
protected int getStrikeNumber(Creature target)
void strike(CreatureServerSide target)
private void chooseStrikePenalty()
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |