Class CreatureServerSide
java.lang.Object
net.sf.colossus.game.Creature
net.sf.colossus.server.CreatureServerSide
- All Implemented Interfaces:
BattleCritter
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.- Author:
- David Ripton, Romain Dolbeau
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BattleServerSideprivate booleanprivate final GameServerSideThe game this creature belongs to.private static final Loggerprivate final SortedSet<PenaltyOption> private final intUnique identifier for each critter.private static intCounter used to assign unique tags.Fields inherited from class Creature
IMPORTANCE_ORDER, legion -
Constructor Summary
ConstructorsConstructorDescriptionCreatureServerSide(CreatureType creature, Legion legion, GameServerSide game) -
Method Summary
Modifier and TypeMethodDescription(package private) voidassignStrikePenalty(String prompt) Side effects.(package private) boolean(package private) voidfindCarries(CreatureServerSide target) Side effects on penaltyOptions, Battle.carryTargetsprivate voidfindCarry(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.carryTargetsgetGame()(package private) Set<PenaltyOption> intgetTag()inthashCode()booleanprivate PenaltyOptionmatchingPenaltyOption(String prompt) Return true if the passed prompt matches one of the stored penalty options.private booleanpossibleCarryToDir(BattleHex targetHex, int dir) Return true if carries are possible to the hex in direction dir, considering only terrain.(package private) voidsetBattleInfo(BattleHex currentHex, BattleHex startingHex, BattleServerSide battle) (package private) voidsetLegion(LegionServerSide legion) (package private) voidstrike(CreatureServerSide target) Calculate number of dice and strike number needed to hit target, and whether any carries and strike penalties are possible.private voidstrike2(CreatureServerSide target, int dice, int strikeNumber) Called after strike penalties are chosen.toString()(package private) voidundoMove()Methods inherited from class Creature
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, wouldDieFromMethods inherited from class Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface BattleCritter
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
-
Field Details
-
LOGGER
-
battle
-
game
The game this creature belongs to. Never null. -
tag
private final int tagUnique identifier for each critter. -
tagCounter
private static int tagCounterCounter used to assign unique tags. -
penaltyOptions
-
carryPossible
private boolean carryPossible
-
-
Constructor Details
-
CreatureServerSide
-
-
Method Details
-
setBattleInfo
-
setLegion
-
getGame
-
getTag
public int getTag()- Specified by:
getTagin interfaceBattleCritter
-
isDefender
public boolean isDefender()- Specified by:
isDefenderin interfaceBattleCritter
-
undoMove
void undoMove() -
canStrike
-
strike
Calculate number of dice and strike number needed to hit target, and whether any carries and strike penalties are possible. The actual striking is now deferred to strike2(). -
assignStrikePenalty
Side effects. -
matchingPenaltyOption
Return true if the passed prompt matches one of the stored penalty options. -
findCarries
Side effects on penaltyOptions, Battle.carryTargets -
possibleCarryToDir
Return true if carries are possible to the hex in direction dir, considering only terrain. -
findCarry
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 -
strike2
Called after strike penalties are chosen. Roll the dice and apply damage. Highlight legal carry targets. -
getPenaltyOptions
Set<PenaltyOption> getPenaltyOptions() -
toString
-
hashCode
-