|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.colossus.game.Battle
net.sf.colossus.server.BattleServerSide
public final class BattleServerSide
Class Battle holds data about a Titan battle. It has utility functions related to incrementing the phase, managing moves, and managing strikes.
Nested Class Summary | |
---|---|
static class |
BattleServerSide.AngelSummoningStates
|
private class |
BattleServerSide.BattlePhaseAdvancer
|
static class |
BattleServerSide.LegionTags
|
Field Summary | |
---|---|
private BattleServerSide.LegionTags |
activeLegionTag
|
private boolean |
attackerElim
|
private boolean |
attackerEntered
|
private boolean |
battleOver
|
private int |
carryDamage
|
private java.util.Set<BattleHex> |
carryTargets
Set of hexes for valid carry targets |
private boolean |
conceded
|
private boolean |
defenderElim
|
private boolean |
driftDamageApplied
|
private static java.util.logging.Logger |
LOGGER
|
private BattlePhase |
phase
|
private PhaseAdvancer |
phaseAdvancer
|
private int |
pointsScored
|
private Server |
server
|
private BattleServerSide.AngelSummoningStates |
summonState
|
private int |
turnNumber
|
Fields inherited from class net.sf.colossus.game.Battle |
---|
attacker, defender, game |
Constructor Summary | |
---|---|
BattleServerSide(GameServerSide game,
Legion attacker,
Legion defender,
BattleServerSide.LegionTags activeLegionTag,
MasterHex masterHex,
int turnNumber,
BattlePhase phase)
|
Method Summary | |
---|---|
(package private) void |
addCarryTarget(BattleHex hex)
|
private void |
advancePhase()
|
(package private) void |
applyCarries(CreatureServerSide target)
|
private void |
applyDriftDamage()
|
private void |
checkForElimination()
|
void |
cleanRefs()
|
private void |
cleanup()
|
private void |
cleanupOneDeadCritter(Creature critter)
|
(package private) void |
clearCarryTargets()
|
private void |
commitMoves()
|
private void |
commitStrikes()
|
(package private) void |
concede(Player player)
Mark all of the conceding player's critters as dead. |
(package private) int |
countBrambleHexes(BattleHex hex1,
BattleHex hex2)
Deprecated. |
private int |
countBrambleHexesDir(BattleHex hex1,
BattleHex hex2,
boolean left,
int previousCount)
Deprecated. another function with explicit reference to Bramble that should be fixed. |
(package private) boolean |
doMove(int tag,
BattleHex hex)
If legal, move critter to hex and return true. |
(package private) void |
doneReinforcing()
Needs to be called when reinforcement is done. |
(package private) void |
doneWithMoves()
|
(package private) boolean |
doneWithStrikes()
Return true if okay, or false if forced strikes remain. |
private java.util.Set<BattleHex> |
findMoves(BattleHex hex,
CreatureServerSide critter,
boolean flies,
int movesLeft,
int cameFrom,
boolean ignoreMobileAllies,
boolean first)
Recursively find moves from this hex. |
(package private) java.util.Set<java.lang.String> |
findStrikes(CreatureServerSide critter,
boolean rangestrike)
Return a set of hex labels for hexes containing targets that the critter may strike. |
private java.util.Set<BattleHex> |
findUnoccupiedStartlistHexes(boolean ignoreMobileAllies,
MasterBoardTerrain terrain)
This method is called by the defender on turn 1 in a Startlisted Terrain, so we know that there are no enemies on board, and all allies are mobile. |
(package private) void |
finishSummoningAngel(boolean placeNewChit)
Called from Game after the SummonAngel finishes. |
(package private) LegionServerSide |
getActiveLegion()
|
(package private) Player |
getActivePlayer()
|
private java.util.List<CreatureServerSide> |
getAllCritters()
Return a list of all critters in the battle. |
LegionServerSide |
getAttackingLegion()
Override with covariant return type to ease transition into new model. |
(package private) BattlePhase |
getBattlePhase()
|
(package private) int |
getCarryDamage()
|
(package private) java.util.Set<java.lang.String> |
getCarryTargetDescriptions()
|
(package private) java.util.Set<BattleHex> |
getCarryTargets()
Return the set of hexes with valid carry targets. |
(package private) CreatureServerSide |
getCritter(BattleHex hex)
|
LegionServerSide |
getDefendingLegion()
Override with covariant return type to ease transition into new model. |
GameServerSide |
getGame()
Override with covariant return type to ease transition into new model. |
private LegionServerSide |
getInactiveLegion()
|
private LegionServerSide |
getLegion(BattleServerSide.LegionTags legionTag)
|
(package private) BattleServerSide.AngelSummoningStates |
getSummonState()
|
(package private) int |
getTurnNumber()
|
(package private) void |
init()
We need to do two-stage construction so that game.battle is non-null earlier. |
private void |
initBattleChits(LegionServerSide legion)
|
(package private) boolean |
isDriftDamageApplied()
|
private boolean |
isForcedStrikeRemaining()
|
protected boolean |
isOccupied(BattleHex hex)
Whether the hex is occupied by a critter/creature/chit/... |
private boolean |
isOccupied(java.lang.String hexLabel)
|
private boolean |
isOver()
|
(package private) void |
leaveCarryMode()
|
private void |
placeCritter(CreatureServerSide critter)
|
private void |
placeLegion(Legion legion)
|
private boolean |
recruitReinforcement()
|
private void |
removeDeadCreatures()
|
private void |
removeDeadCreaturesFromLegion(LegionServerSide legion)
|
private void |
removeOffboardCreatures()
If any creatures were left off-board, kill them. |
(package private) void |
setCarryDamage(int carryDamage)
|
(package private) void |
setCarryTargets(java.util.Set<BattleHex> carryTargets)
|
(package private) void |
setDriftDamageApplied(boolean driftDamageApplied)
|
void |
setServer(Server server)
|
(package private) void |
setSummonState(BattleServerSide.AngelSummoningStates summonState)
|
private boolean |
setupFight()
|
private boolean |
setupMove()
|
private boolean |
setupRecruit()
|
private boolean |
setupSummon()
|
private java.util.Set<BattleHex> |
showMoves(CreatureServerSide critter,
boolean ignoreMobileAllies)
Find all legal moves for this critter. |
(package private) void |
undoMove(BattleHex hex)
|
Methods inherited from class net.sf.colossus.game.Battle |
---|
computeSkillPenaltyRangestrikeThrough, getDirection, getLegionByPlayer, getLocation, getRange, isLOSBlocked, isLOSBlockedDir, isRangestrikePossible, toLeft |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
private Server server
private BattleServerSide.LegionTags activeLegionTag
private int turnNumber
private BattlePhase phase
private BattleServerSide.AngelSummoningStates summonState
private int carryDamage
private boolean attackerElim
private boolean defenderElim
private boolean battleOver
private boolean attackerEntered
private boolean conceded
private boolean driftDamageApplied
private final java.util.Set<BattleHex> carryTargets
private final PhaseAdvancer phaseAdvancer
private int pointsScored
Constructor Detail |
---|
BattleServerSide(GameServerSide game, Legion attacker, Legion defender, BattleServerSide.LegionTags activeLegionTag, MasterHex masterHex, int turnNumber, BattlePhase phase)
Method Detail |
---|
public void setServer(Server server)
public void cleanRefs()
private void placeLegion(Legion legion)
private void placeCritter(CreatureServerSide critter)
private void initBattleChits(LegionServerSide legion)
void init()
public GameServerSide getGame()
getGame
in class Battle
Player getActivePlayer()
public LegionServerSide getAttackingLegion()
getAttackingLegion
in class Battle
public LegionServerSide getDefendingLegion()
getDefendingLegion
in class Battle
LegionServerSide getActiveLegion()
private LegionServerSide getInactiveLegion()
private LegionServerSide getLegion(BattleServerSide.LegionTags legionTag)
BattlePhase getBattlePhase()
int getTurnNumber()
private boolean isOver()
private void advancePhase()
private boolean setupSummon()
private boolean setupRecruit()
private boolean setupMove()
private boolean setupFight()
BattleServerSide.AngelSummoningStates getSummonState()
void setSummonState(BattleServerSide.AngelSummoningStates summonState)
void finishSummoningAngel(boolean placeNewChit)
private boolean recruitReinforcement()
void doneReinforcing()
int getCarryDamage()
void setCarryDamage(int carryDamage)
private java.util.Set<BattleHex> findMoves(BattleHex hex, CreatureServerSide critter, boolean flies, int movesLeft, int cameFrom, boolean ignoreMobileAllies, boolean first)
private java.util.Set<BattleHex> findUnoccupiedStartlistHexes(boolean ignoreMobileAllies, MasterBoardTerrain terrain)
private java.util.Set<BattleHex> showMoves(CreatureServerSide critter, boolean ignoreMobileAllies)
void undoMove(BattleHex hex)
void concede(Player player)
private void removeOffboardCreatures()
private void commitMoves()
void doneWithMoves()
private void applyDriftDamage()
boolean isDriftDamageApplied()
void setDriftDamageApplied(boolean driftDamageApplied)
void leaveCarryMode()
private void removeDeadCreatures()
private void removeDeadCreaturesFromLegion(LegionServerSide legion)
private void cleanupOneDeadCritter(Creature critter)
private void checkForElimination()
private void commitStrikes()
private boolean isForcedStrikeRemaining()
boolean doneWithStrikes()
java.util.Set<java.lang.String> findStrikes(CreatureServerSide critter, boolean rangestrike)
java.util.Set<BattleHex> getCarryTargets()
java.util.Set<java.lang.String> getCarryTargetDescriptions()
void clearCarryTargets()
void setCarryTargets(java.util.Set<BattleHex> carryTargets)
void addCarryTarget(BattleHex hex)
void applyCarries(CreatureServerSide target)
@Deprecated private int countBrambleHexesDir(BattleHex hex1, BattleHex hex2, boolean left, int previousCount)
@Deprecated int countBrambleHexes(BattleHex hex1, BattleHex hex2)
boolean doMove(int tag, BattleHex hex)
private void cleanup()
private java.util.List<CreatureServerSide> getAllCritters()
private boolean isOccupied(java.lang.String hexLabel)
protected boolean isOccupied(BattleHex hex)
Battle
isOccupied
in class Battle
hex
- The hex whose occupancy is being checked
CreatureServerSide getCritter(BattleHex hex)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |