|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.colossus.client.Client
public final class Client
Lives on the client side and handles all communication
with the server. It talks to the Server via the network protocol
and to Client side classes locally, but to all GUI related classes
it should only communicate via ClientGUI class.
There is one client per player.
TODO Handle GUI related issues purely via ClientGUI
TODO All GUI classes should talk to the server purely through
ClientGUI which handles it via the Client.
TODO the logic for the battles could probably be separated from the
rest of this code. At the moment the battle logic seems to bounce
back and forth between BattleBoard (which is really a GUI class) and
this class.
TODO this class also has the functionality of a GameClientSide class,
which should be separated and ideally moved up into the Game
class. The whole IOracle interface is part of that.
One approach would be moving code from GameServerSide
up into Game and then reuse it here in the matching methods,
then inlining it into the calling code. Another one would be creating
the GameClientSide for now and relocating code there.
==> Clemens march 2009: I started the GameClientSide approach :)
| Nested Class Summary | |
|---|---|
private static class |
Client.ClosedByConstant
Constants modelling the party who closed this client. |
static class |
Client.ConnectionInitException
|
| Field Summary | |
|---|---|
private AI |
ai
|
private BattleMovement |
battleMovement
|
private java.util.List<CritterMove> |
bestMoveOrder
For battle AI. |
private Client.ClosedByConstant |
closedBy
|
private PlayerColor |
color
Starting marker color of player who owns this client. |
private IServerConnection |
connection
The object that actually handles the physical server communication for this client. |
private java.lang.String |
currentLegionMarkerId
|
private int |
delay
|
private boolean |
disposeInProgress
|
private boolean |
failed
Client constructor sets this to true if something goes wrong with the SocketClientThread initialization. |
private java.util.List<CritterMove> |
failedBattleMoves
|
private GameClientSide |
game
The game in progress. |
private boolean |
gotDisposeAlready
Once we got dispose from server (or user initiated it himself), we'll ignore it if we we get it from server again - it's then up to the user to do some "disposing" action. |
private IClientGUI |
gui
This can be an actual ClientGUI, or a NullClientGUI (which does simply nothing, so that we don't need to check for null everywhere). |
private int |
lastMsgNr
is != -1 only from the point on when client abandons the connection, until sync is completed. |
private Server |
localServer
|
private static java.util.logging.Logger |
LOGGER
|
private static int |
MAX_RECONNECT_ATTEMPTS
|
private MovementClientSide |
movement
|
private int |
numSplitsThisTurn
|
private java.lang.Runnable |
oneConnectAttemptsRound
|
private java.lang.Object |
oneConnectAttemptsRoundMutex
|
private Options |
options
|
private PlayerClientSide |
owningPlayer
Player who owns this client. |
private boolean |
paused
|
private boolean |
playerAlive
|
private boolean |
playersNotInitialized
At first time we get "all player info", they are created; at all later calls just update them. |
private IServerConnection |
previousConn
|
private static int |
RECONNECT_RETRY_INTERVAL
|
private java.util.Hashtable<CreatureType,java.lang.Integer> |
recruitReservations
|
private boolean |
redoOngoing
Redo of the events since last commit phase is ongoing. |
private boolean |
replayOngoing
Replay during load of a saved game is ongoing. |
private ResourceLoader |
resourceLoader
A first start to get rid of the static-access-everywhere to ResourceLoader. |
private IServer |
server
This "server" is the access to the connector object which actually acts for us as server. |
private int |
syncRequestCounter
Everytime we request server to sync data (typically after reconnect), we pass with a request counter, so that we can distinct the syncCompleted responses. |
boolean |
testCaseAutoDenyNegotiate
|
boolean |
testCaseAutoDontFlee
|
private boolean |
tookMulligan
|
| Constructor Summary | |
|---|---|
Client(java.lang.String playerName,
java.lang.String playerType,
WhatNextManager whatNextMgr,
Server theServer,
boolean byWebClient,
boolean noOptionsFile,
boolean createGUI,
ResourceLoader resLoader,
IServerConnection conn,
Variant variant)
Client is the main hub for info exchange on client side. |
|
| Method Summary | |
|---|---|
void |
abandonCurrentConnection()
|
void |
acquireAngelCallback(Legion legion,
CreatureType angelType)
|
void |
addCreature(Legion legion,
CreatureType creature,
java.lang.String reason)
Add a new creature to this legion. |
void |
aiDoneWithStrikes()
|
private void |
aiPause()
Wait for aiDelay. |
void |
answerConcede(Legion legion,
boolean answer)
|
void |
answerFlee(Legion ally,
boolean answer)
|
void |
answerPickColor(PlayerColor color)
|
void |
appendToConnectionLog(java.lang.String s)
|
void |
applyCarries(BattleHex hex)
Attempt to apply carries to the critter in hex. |
void |
askAcquireAngel(Legion legion,
java.util.List<CreatureType> recruits)
recruits is the list of acquirables that can be chosen from for a certain point value reached. |
void |
askChooseStrikePenalty(java.util.List<java.lang.String> choices)
Allow the player to choose whether to take a penalty (fewer dice or higher strike number) in order to be allowed to carry. |
void |
askConcede(Legion ally,
Legion enemy)
|
void |
askFlee(Legion ally,
Legion enemy)
|
void |
askNegotiate(Legion attacker,
Legion defender)
|
void |
askPickColor(java.util.List<PlayerColor> colorsLeft)
|
void |
askPickFirstMarker()
|
void |
assignFirstMarker(java.lang.String markerId)
|
void |
assignStrikePenalty(java.lang.String prompt)
|
boolean |
canRecruit(Legion legion)
|
CreatureType |
chooseBestPotentialRecruit(LegionClientSide legion,
MasterHex hex,
java.util.List<CreatureType> recruits)
|
private boolean |
chooseWhetherToTeleport(MasterHex hex)
Present a dialog allowing the player to enter via land or teleport. |
void |
cleanupBattle()
|
void |
concede()
|
private void |
concede(Legion legion)
|
void |
confirmWhenCaughtUp()
|
private AI |
createAI(java.lang.String playerType)
Create the AI for this Client. |
static Client |
createClient(java.lang.String host,
int port,
java.lang.String playerName,
java.lang.String playerType,
WhatNextManager whatNextMgr,
Server theServer,
boolean byWebClient,
boolean noOptionsFile,
boolean createGUI)
Create a Client object and other related objects |
void |
createSummonAngel(Legion legion)
|
private boolean |
decideWhetherClose()
|
void |
didMove(Legion legion,
MasterHex startingHex,
MasterHex currentHex,
EntrySide entrySide,
boolean teleport,
CreatureType teleportingLord,
boolean splitLegionHasForcedMove)
|
void |
didRecruit(Legion legion,
CreatureType recruit,
CreatureType recruiter,
int numRecruiters)
|
void |
didSplit(MasterHex hex,
Legion parent,
Legion child,
int childHeight,
java.util.List<CreatureType> splitoffs,
int turn)
Callback from server after any successful split. |
void |
didSummon(Legion summoner,
Legion donor,
CreatureType summon)
|
private void |
disposeAll()
|
void |
disposeClient()
|
void |
disposeClientOriginated()
|
private void |
disposeWholeClient()
|
void |
doAdditionalCleanup()
|
private void |
doAutoMoves()
|
private void |
doAutoStrikes()
Handle both forced strikes and AI strikes. |
void |
doBattleMove(int tag,
BattleHex hex)
|
void |
doCheckServerConnection()
|
void |
doFight(MasterHex hex)
|
boolean |
doMove(Legion mover,
MasterHex hex)
If the move looks legal, forward it to server and return true; otherwise returns false. |
void |
doneWithBattleMoves()
|
void |
doneWithEngagements()
|
void |
doneWithMoves()
|
void |
doneWithRecruits()
|
void |
doneWithSplits()
|
void |
doneWithStrikes()
|
private void |
doNotConcede(Legion legion)
|
void |
doRecruit(Legion legion)
Used for human players only. |
void |
doRecruit(Legion legion,
java.lang.String recruitName,
java.lang.String recruiterName)
|
void |
doReinforce(Legion legion)
Always needs to call server.doRecruit(), even if no recruit is wanted, to get past the reinforcing phase. |
void |
doSplit(Legion parent)
Called by MasterBoard.actOnLegion() when human user clicked on a legion to split it. |
void |
doSplit(Legion parent,
java.lang.String childMarkerId,
java.util.List<CreatureType> results)
Called by AI and by doSplit() |
void |
doSummon(SummonInfo summonInfo)
Legion target summons unit from Legion donor. |
void |
doTheSplitting(Legion parent,
java.lang.String childId)
|
void |
editAddCreature(java.lang.String markerId,
java.lang.String creatureType)
|
void |
editRelocateLegion(java.lang.String markerId,
java.lang.String hexLabel)
|
void |
editRemoveCreature(java.lang.String markerId,
java.lang.String creatureType)
|
void |
enforcedDisconnect()
|
void |
enforcedDisconnectByServer()
|
void |
engage(MasterHex hex)
Resolve engagement in land. |
boolean |
ensureThatConnected()
|
private void |
fight(MasterHex hex)
Cease negotiations and fight a battle in land. |
private CreatureType |
figureTeleportingLord(Legion legion,
MasterHex hex)
|
java.util.Set<BattleHex> |
findCrittersWithTargets()
|
java.util.List<java.lang.String> |
findEligibleRecruiters(Legion legion,
CreatureType recruit)
Return a list of creature name strings. |
java.util.List<CreatureType> |
findEligibleRecruits(Legion legion,
MasterHex hex)
Return a list of Creatures (ignore reservations). |
java.util.List<CreatureType> |
findEligibleRecruits(Legion legion,
MasterHex hex,
boolean considerReservations)
Return a list of Creatures and consider reservations if wanted. |
java.util.Set<BattleUnit> |
findMobileBattleUnits()
Return a set of BattleUnits. |
java.util.Set<BattleHex> |
findMobileCritterHexes()
Return a set of hexLabels. |
private java.lang.String |
findRecruiterName(Legion legion,
CreatureType recruit,
java.lang.String hexDescription)
null means cancel. |
java.util.Set<BattleHex> |
findStrikes(int tag)
|
java.util.Set<MasterHex> |
findTallLegionHexes()
Return a set of hexLabels for the active player's legions with 7 or more creatures, and which are not marked as skip this turn. |
java.util.Set<MasterHex> |
findTallLegionHexes(int minHeight,
boolean ignoreSkipFlag)
Return a set of hexLabels for the active player's legions with minHeight or more creatures. |
java.util.Set<MasterHex> |
findUnmovedLegionHexes(boolean considerSkippedAsMoved,
java.util.HashSet<Legion> pendingLegions)
|
private void |
fireOneReconnectRunnable(boolean automatic)
Creates a runnable that executes one reconnect round (several attempts) |
java.util.List<BattleUnit> |
getActiveBattleUnits()
|
Player |
getActivePlayer()
|
Legion |
getAttacker()
|
Player |
getBattleActivePlayer()
|
BattleClientSide |
getBattleCS()
|
BattlePhase |
getBattlePhase()
|
MasterHex |
getBattleSite()
|
int |
getBattleTurnNumber()
|
PlayerColor |
getColor()
|
java.lang.String |
getCurrentLegionMarkerId()
|
Legion |
getDefender()
|
Engagement |
getEngagement()
|
boolean |
getFailed()
|
Game |
getGame()
|
GameClientSide |
getGameClientSide()
|
IClientGUI |
getGUI()
|
java.util.List<BattleUnit> |
getInactiveBattleUnits()
|
LegionClientSide |
getLegion(java.lang.String markerId)
Get this legion's info or create if necessary. |
java.util.List<java.lang.Boolean> |
getLegionCreatureCertainties(Legion legion)
|
int |
getLegionHeight(java.lang.String markerId)
|
java.util.List<java.lang.String> |
getLegionImageNames(Legion legion)
|
MovementClientSide |
getMovement()
|
Legion |
getMyEngagedLegion()
|
int |
getNumPlayers()
|
Options |
getOptions()
|
PlayerClientSide |
getOwningPlayer()
|
Phase |
getPhase()
|
Player |
getPlayerByName(java.lang.String name)
|
private java.util.Set<MasterHex> |
getPossibleRecruitActionHexes()
Return a set of hexLabels with legions that could do a recruit or undo recruit. |
java.util.Set<MasterHex> |
getPossibleRecruitHexes()
Return a set of hexes with legions that can (still) muster anything and are not marked as skip. |
java.util.List<CreatureType> |
getPossibleRecruits(MasterBoardTerrain terrain,
MasterHex hex)
TODO get from Variant instead of static TerrainRecruitLoader access Just forwarding the query, to get at least the GUI classes get rid of dependency to static TerrainRecruitLoader access. |
int |
getReservedRemain(CreatureType recruitType)
|
java.lang.String |
getShortColor()
|
java.util.Collection<MasterBoardTerrain> |
getTerrains()
Return a collection of all possible terrains. |
int |
getTurnNumber()
|
void |
guiTriggeredTryReconnect()
|
private void |
handleFailedBattleMove(java.lang.String errmsg)
|
void |
initBattle(MasterHex hex,
int battleTurnNumber,
Player battleActivePlayer,
BattlePhase battlePhase,
Legion attacker,
Legion defender)
|
void |
initBoard()
|
boolean |
isAlive()
|
boolean |
isConnected()
|
boolean |
isConnectRoundOngoing()
|
boolean |
isInContact(BattleCritter critter,
boolean countDead)
|
boolean |
isMyBattlePhase()
|
boolean |
isMyLegion(Legion legion)
|
boolean |
isMyTurn()
|
boolean |
isPaused()
|
boolean |
isRedoOngoing()
|
boolean |
isRemote()
|
boolean |
isReplayOngoing()
|
boolean |
isSctAlreadyDown()
|
private void |
kickBattleMove()
|
private void |
kickFight()
|
private void |
kickMoves()
|
private void |
kickMuster()
|
void |
kickPhase()
|
private void |
kickSplit()
|
void |
leaveCarryMode()
Called from BattleBoard to leave carry mode. |
void |
legionsNotMoved(int[] legionStatus,
boolean have_roll)
Returns status of client's legions |
java.util.Set<MasterHex> |
listNormalMoves(Legion legion)
Return a set of hexLabels. |
private java.util.List<CreatureType> |
listTeleportingLords(Legion legion,
MasterHex hex)
List the lords eligible to teleport this legion to hexLabel. |
java.util.Set<MasterHex> |
listTeleportMoves(Legion legion)
Return a set of hexLabels. |
void |
locallyInitiateSaveGame(java.lang.String filename)
|
void |
log(java.lang.String message)
|
private boolean |
makeForcedStrikes()
Return true if any strikes were taken. |
private void |
makeProposal(Proposal proposal)
|
private void |
markBattleMoveSuccessful(int tag,
BattleHex endingHex)
|
void |
messageFromServer(java.lang.String message)
|
void |
mulligan()
Take a mulligan. |
void |
nak(java.lang.String reason,
java.lang.String errmsg)
|
void |
negotiateCallback(Proposal proposal,
boolean respawn)
Called from both Negotiate and ReplyToProposal. |
void |
nextEngagement()
|
boolean |
noRecruitActionPossible()
Check whether any legion has possibility to recruit at all, no matter whether it could or has already. |
void |
notifyServer()
|
void |
notifyThatNotConnected()
|
int |
numberOfRecruiterNeeded(CreatureType recruiter,
CreatureType recruit,
MasterBoardTerrain terrain,
MasterHex hex)
TODO get from Variant instead of static TerrainRecruitLoader access Just forwarding the query, to get at least the GUI classes get rid of dependency to static TerrainRecruitLoader access. |
private void |
pickCarries(int carryDamage,
java.util.Set<java.lang.String> carryTargetDescriptions)
|
void |
pingRequest()
|
void |
placeNewChit(java.lang.String bareImageName,
boolean inverted,
int tag,
BattleHex hex)
Create a new BattleUnit and (if GUI) a new GUIBattleChit with the given parameters. |
private void |
recoverFromNak(java.lang.String reason,
java.lang.String errmsg)
|
void |
relocateLegion(Legion legion,
MasterHex destination)
|
void |
removeCreature(Legion legion,
CreatureType creature,
java.lang.String reason)
|
void |
removeDeadBattleChits()
|
void |
removeLegion(Legion legion)
Remove this eliminated legion, and clean up related stuff. |
boolean |
reserveRecruit(CreatureType recruitType)
|
private void |
resetLegionMovesAndRecruitData()
|
void |
resetRecruitReservations()
|
private void |
retryFailedBattleMoves()
|
void |
revealCreatures(Legion legion,
java.util.List<CreatureType> creatures,
java.lang.String reason)
Reveal creatures in this legion, some of which already may be known. |
void |
revealEngagedCreatures(Legion legion,
java.util.List<CreatureType> names,
boolean isAttacker,
java.lang.String reason)
|
private boolean |
sansLordAutoBattleApplies()
|
void |
serverConfirmsConnection()
Upon request with checkServerConnection, server sends a confirmation. |
void |
setBoardActive(boolean val)
|
(package private) void |
setClosedByServer()
|
void |
setColor(PlayerColor color)
|
private void |
setConnectAttemptsRoundCompleted()
|
void |
setCurrentLegionMarkerId(java.lang.String MarkerId)
|
void |
setLegionStatus(Legion legion,
boolean moved,
boolean teleported,
EntrySide entrySide,
CreatureType lastRecruit)
Needed when loading a game outside split phase. |
void |
setPauseState(boolean newState)
|
void |
setPlayerName(java.lang.String playerName)
|
void |
setPreferencesCheckBoxValue(java.lang.String name,
boolean value)
|
void |
setPreferencesRadioButtonValue(java.lang.String name,
boolean value)
|
void |
setupBattleFight(BattlePhase battlePhase,
Player battleActivePlayer)
Used for both strike and strikeback. |
void |
setupBattleMove(Player battleActivePlayer,
int battleTurnNumber)
|
void |
setupBattleRecruit(Player battleActivePlayer,
int battleTurnNumber)
|
void |
setupBattleSummon(Player battleActivePlayer,
int battleTurnNumber)
|
private void |
setupDelay()
|
void |
setupFight()
|
void |
setupMove()
|
void |
setupMuster()
|
void |
setupSplit(Player activePlayer,
int turnNumber)
|
void |
setupTurnState(Player activePlayer,
int turnNumber)
Called by server when activePlayer changes |
java.util.Set<BattleHex> |
showBattleMoves(BattleCritter battleCritter)
|
void |
showMessageDialog(java.lang.String message)
|
void |
strike(int tag,
BattleHex hex)
Attempt to have critter tag strike the critter in hex. |
private boolean |
strikeMakeForcedStrikes(boolean autoRangeSingle)
|
void |
syncOption(java.lang.String optname,
java.lang.String value)
Server sends Client some option setting (e.g. |
void |
tellBattleMove(int tag,
BattleHex startingHex,
BattleHex endingHex,
boolean undo)
|
void |
tellEngagement(MasterHex hex,
Legion attacker,
Legion defender)
|
void |
tellEngagementResults(Legion winner,
java.lang.String method,
int points,
int turns)
|
void |
tellGameOver(java.lang.String message,
boolean disposeFollows)
|
void |
tellLegionLocation(Legion legion,
MasterHex hex)
Create marker if necessary, and place it in hexLabel. |
void |
tellMovementRoll(int roll)
|
void |
tellPlayerElim(Player deadPlayer,
Player slayer)
|
void |
tellProposal(java.lang.String proposalString)
Inform this player about the other player's proposal. |
void |
tellRedo(boolean val)
|
void |
tellReplay(boolean val,
int maxTurn)
|
void |
tellSlowResults(int targetTag,
int slowValue)
|
void |
tellStrikeResults(int strikerTag,
int targetTag,
int strikeNumber,
java.util.List<java.lang.String> rolls,
int damage,
boolean killed,
boolean wasCarry,
int carryDamageLeft,
java.util.Set<java.lang.String> carryTargetDescriptions)
|
void |
tellSyncCompleted(int syncRequestNumber)
|
void |
tellWhatsHappening(java.lang.String message)
|
boolean |
testBattleMove(BattleCritter battleUnit,
BattleHex hex)
|
boolean |
tookMulligan()
|
void |
tryBattleMove(CritterMove cm)
|
void |
tryReconnect(boolean automatic)
|
void |
undidMove(Legion legion,
MasterHex formerHex,
MasterHex currentHex,
boolean splitLegionHasForcedMove)
|
void |
undidRecruit(Legion legion,
CreatureType recruit)
|
void |
undidSplit(Legion splitoff,
Legion survivor,
int turn)
|
void |
undoBattleMove(BattleHex hex)
|
void |
undoMove(Legion legion)
|
void |
undoRecruit(Legion legion)
|
void |
undoSplit(Legion splitoff)
|
void |
updateCreatureCount(CreatureType type,
int count,
int deadCount)
|
void |
updatePlayerInfo(java.util.List<java.lang.String> infoStrings)
|
void |
withdrawFromGame()
This player quits the whole game. |
| 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 IServer server
private IServerConnection connection
private final ResourceLoader resourceLoader
private final boolean failed
private boolean replayOngoing
private boolean redoOngoing
private final IClientGUI gui
private final Options options
private boolean playersNotInitialized
private PlayerClientSide owningPlayer
private boolean playerAlive
private final GameClientSide game
private PlayerColor color
private final AI ai
private MovementClientSide movement
private BattleMovement battleMovement
private final Server localServer
private Client.ClosedByConstant closedBy
private static final int MAX_RECONNECT_ATTEMPTS
private static final int RECONNECT_RETRY_INTERVAL
private boolean tookMulligan
private int numSplitsThisTurn
private int delay
private java.util.List<CritterMove> bestMoveOrder
private java.util.List<CritterMove> failedBattleMoves
private final java.util.Hashtable<CreatureType,java.lang.Integer> recruitReservations
private boolean gotDisposeAlready
private boolean disposeInProgress
private int syncRequestCounter
private boolean paused
private java.lang.String currentLegionMarkerId
private int lastMsgNr
private IServerConnection previousConn
private final java.lang.Object oneConnectAttemptsRoundMutex
private java.lang.Runnable oneConnectAttemptsRound
public boolean testCaseAutoDontFlee
public boolean testCaseAutoDenyNegotiate
| Constructor Detail |
|---|
public Client(java.lang.String playerName,
java.lang.String playerType,
WhatNextManager whatNextMgr,
Server theServer,
boolean byWebClient,
boolean noOptionsFile,
boolean createGUI,
ResourceLoader resLoader,
IServerConnection conn,
Variant variant)
playerName - Name of the player (might still be one of the
playerType - Type of player, e.g. Human, Network, or some
concrete AI type (but not "AnyAI").
Given type must include the package name.whatNextMgr - The main controller over which to handle what to do
next when this game is over and exitingtheServer - The Server object, if this is a local clientbyWebClient - If true, this was instantiated by a WebClientnoOptionsFile - E.g. AIs should not read/save any options filecreateGUI - Whether to create a GUI (AI's usually not, but server
might override that e.g. in stresstest)resLoader - The ResourceLoader object that gives us access to
load images, files etc (from disk or from server)conn - The connection to server (so far, SocketClientThread)variant - The variant instance| Method Detail |
|---|
public static Client createClient(java.lang.String host,
int port,
java.lang.String playerName,
java.lang.String playerType,
WhatNextManager whatNextMgr,
Server theServer,
boolean byWebClient,
boolean noOptionsFile,
boolean createGUI)
throws Client.ConnectionInitException
host - The host to which SocketClientThread shall connectport - The port to which SocketClientThread shall connectplayerName - Name of the player (might still be one of the
playerType - Type of player, e.g. Human, Network, or some
concrete AI type (but not "AnyAI").
Given type must include the package name.whatNextMgr - The main controller over which to handle what to do
next when this game is over and exitingtheServer - The Server object, if this is a local clientbyWebClient - If true, this was instantiated by a WebClientnoOptionsFile - E.g. AIs should not read/save any options filecreateGUI - Whether to create a GUI (AI's usually not, but server
might override that e.g. in stresstest)
Client.ConnectionInitExceptionpublic void appendToConnectionLog(java.lang.String s)
appendToConnectionLog in interface IClientpublic boolean isRemote()
public boolean isAlive()
public boolean isPaused()
public void setCurrentLegionMarkerId(java.lang.String MarkerId)
public java.lang.String getCurrentLegionMarkerId()
public void setPauseState(boolean newState)
public void enforcedDisconnect()
public boolean ensureThatConnected()
public void notifyThatNotConnected()
public void enforcedDisconnectByServer()
public boolean isConnected()
public void abandonCurrentConnection()
public void tryReconnect(boolean automatic)
automatic - true if was triggered automatically e.g. by a Socket Exception,
false if triggered manually (e.g. MasterBoard File menu).public void guiTriggeredTryReconnect()
private void setConnectAttemptsRoundCompleted()
public boolean isConnectRoundOngoing()
private void fireOneReconnectRunnable(boolean automatic)
public void tellSyncCompleted(int syncRequestNumber)
tellSyncCompleted in interface IClientpublic void doCheckServerConnection()
public void serverConfirmsConnection()
serverConfirmsConnection in interface IClientpublic void locallyInitiateSaveGame(java.lang.String filename)
public boolean getFailed()
public void undoSplit(Legion splitoff)
public void mulligan()
public boolean tookMulligan()
public void engage(MasterHex hex)
public Legion getMyEngagedLegion()
public void concede()
private void concede(Legion legion)
private void doNotConcede(Legion legion)
private void fight(MasterHex hex)
public void tellEngagement(MasterHex hex,
Legion attacker,
Legion defender)
tellEngagement in interface IClient
public void tellEngagementResults(Legion winner,
java.lang.String method,
int points,
int turns)
tellEngagementResults in interface IClientpublic void doSummon(SummonInfo summonInfo)
summonInfo - A SummonInfo object that contains the values
for target, donor and unit.
public void didSummon(Legion summoner,
Legion donor,
CreatureType summon)
didSummon in interface IClientpublic void withdrawFromGame()
public void tellMovementRoll(int roll)
tellMovementRoll in interface IClientpublic void tellWhatsHappening(java.lang.String message)
tellWhatsHappening in interface IClientpublic void kickPhase()
kickPhase in interface IClientprivate void kickMoves()
private void doAutoMoves()
public void syncOption(java.lang.String optname,
java.lang.String value)
syncOption in interface IClientpublic int getNumPlayers()
getNumPlayers in interface IOraclepublic void updatePlayerInfo(java.util.List<java.lang.String> infoStrings)
updatePlayerInfo in interface IClientpublic PlayerClientSide getOwningPlayer()
public void setColor(PlayerColor color)
setColor in interface IClient
public void updateCreatureCount(CreatureType type,
int count,
int deadCount)
updateCreatureCount in interface IClientvoid setClosedByServer()
public void disposeClientOriginated()
public void disposeClient()
disposeClient in interface IClientprivate void disposeWholeClient()
private boolean decideWhetherClose()
private void disposeAll()
public void doAdditionalCleanup()
public void leaveCarryMode()
public void doneWithBattleMoves()
public java.util.List<BattleUnit> getActiveBattleUnits()
private boolean sansLordAutoBattleApplies()
public java.util.List<BattleUnit> getInactiveBattleUnits()
public void aiDoneWithStrikes()
public void doneWithStrikes()
private boolean makeForcedStrikes()
private boolean strikeMakeForcedStrikes(boolean autoRangeSingle)
private void doAutoStrikes()
public LegionClientSide getLegion(java.lang.String markerId)
Player
public void removeLegion(Legion legion)
removeLegion in interface IClientpublic int getLegionHeight(java.lang.String markerId)
public void setLegionStatus(Legion legion,
boolean moved,
boolean teleported,
EntrySide entrySide,
CreatureType lastRecruit)
setLegionStatus in interface IClientpublic java.util.List<java.lang.String> getLegionImageNames(Legion legion)
getLegionImageNames in interface IOraclepublic java.util.List<java.lang.Boolean> getLegionCreatureCertainties(Legion legion)
getLegionCreatureCertainties in interface IOracle
public void addCreature(Legion legion,
CreatureType creature,
java.lang.String reason)
addCreature in interface IClient
public void removeCreature(Legion legion,
CreatureType creature,
java.lang.String reason)
removeCreature in interface IClient
public void revealCreatures(Legion legion,
java.util.List<CreatureType> creatures,
java.lang.String reason)
revealCreatures in interface IClient
public void revealEngagedCreatures(Legion legion,
java.util.List<CreatureType> names,
boolean isAttacker,
java.lang.String reason)
revealEngagedCreatures in interface IClientpublic void removeDeadBattleChits()
removeDeadBattleChits in interface IClient
public void placeNewChit(java.lang.String bareImageName,
boolean inverted,
int tag,
BattleHex hex)
placeNewChit in interface IClient
public CreatureType chooseBestPotentialRecruit(LegionClientSide legion,
MasterHex hex,
java.util.List<CreatureType> recruits)
public IClientGUI getGUI()
public void tellReplay(boolean val,
int maxTurn)
tellReplay in interface IClientpublic boolean isReplayOngoing()
public void tellRedo(boolean val)
tellRedo in interface IClientpublic boolean isRedoOngoing()
public void confirmWhenCaughtUp()
confirmWhenCaughtUp in interface IClientpublic void initBoard()
initBoard in interface IClientpublic void setPlayerName(java.lang.String playerName)
setPlayerName in interface IClientpublic void createSummonAngel(Legion legion)
createSummonAngel in interface IClient
public void askAcquireAngel(Legion legion,
java.util.List<CreatureType> recruits)
askAcquireAngel in interface IClient
public void acquireAngelCallback(Legion legion,
CreatureType angelType)
private boolean chooseWhetherToTeleport(MasterHex hex)
public void askChooseStrikePenalty(java.util.List<java.lang.String> choices)
askChooseStrikePenalty in interface IClientpublic void assignStrikePenalty(java.lang.String prompt)
public void tellPlayerElim(Player deadPlayer,
Player slayer)
tellPlayerElim in interface IClient
public void tellGameOver(java.lang.String message,
boolean disposeFollows)
tellGameOver in interface IClientpublic void doFight(MasterHex hex)
public void askConcede(Legion ally,
Legion enemy)
askConcede in interface IClient
public void askFlee(Legion ally,
Legion enemy)
askFlee in interface IClient
public void answerFlee(Legion ally,
boolean answer)
public void answerConcede(Legion legion,
boolean answer)
public void askNegotiate(Legion attacker,
Legion defender)
askNegotiate in interface IClientpublic void tellProposal(java.lang.String proposalString)
tellProposal in interface IClient
public void negotiateCallback(Proposal proposal,
boolean respawn)
private void makeProposal(Proposal proposal)
public void tellSlowResults(int targetTag,
int slowValue)
tellSlowResults in interface IClient
public void tellStrikeResults(int strikerTag,
int targetTag,
int strikeNumber,
java.util.List<java.lang.String> rolls,
int damage,
boolean killed,
boolean wasCarry,
int carryDamageLeft,
java.util.Set<java.lang.String> carryTargetDescriptions)
tellStrikeResults in interface IClient
public void nak(java.lang.String reason,
java.lang.String errmsg)
nak in interface IClient
private void recoverFromNak(java.lang.String reason,
java.lang.String errmsg)
private void pickCarries(int carryDamage,
java.util.Set<java.lang.String> carryTargetDescriptions)
public void initBattle(MasterHex hex,
int battleTurnNumber,
Player battleActivePlayer,
BattlePhase battlePhase,
Legion attacker,
Legion defender)
initBattle in interface IClientpublic void messageFromServer(java.lang.String message)
messageFromServer in interface IClientpublic void showMessageDialog(java.lang.String message)
public void cleanupBattle()
cleanupBattle in interface IClientpublic boolean canRecruit(Legion legion)
public void doRecruit(Legion legion)
public void doRecruit(Legion legion,
java.lang.String recruitName,
java.lang.String recruiterName)
public void doReinforce(Legion legion)
doReinforce in interface IClient
public void didRecruit(Legion legion,
CreatureType recruit,
CreatureType recruiter,
int numRecruiters)
didRecruit in interface IClientpublic void undoRecruit(Legion legion)
public void undidRecruit(Legion legion,
CreatureType recruit)
undidRecruit in interface IClient
private java.lang.String findRecruiterName(Legion legion,
CreatureType recruit,
java.lang.String hexDescription)
private void resetLegionMovesAndRecruitData()
public void setBoardActive(boolean val)
setBoardActive in interface IClient
public void setupTurnState(Player activePlayer,
int turnNumber)
setupTurnState in interface IClient
public void setupSplit(Player activePlayer,
int turnNumber)
setupSplit in interface IClientprivate void kickSplit()
public void setupMove()
setupMove in interface IClientpublic void setupFight()
setupFight in interface IClientprivate void kickFight()
public void nextEngagement()
nextEngagement in interface IClientpublic void setupMuster()
setupMuster in interface IClientprivate void kickMuster()
public void setupBattleSummon(Player battleActivePlayer,
int battleTurnNumber)
setupBattleSummon in interface IClient
public void setupBattleRecruit(Player battleActivePlayer,
int battleTurnNumber)
setupBattleRecruit in interface IClient
public void setupBattleMove(Player battleActivePlayer,
int battleTurnNumber)
setupBattleMove in interface IClientprivate void kickBattleMove()
public void tryBattleMove(CritterMove cm)
private void retryFailedBattleMoves()
public BattleClientSide getBattleCS()
getBattleCS in interface IOracle
public void setupBattleFight(BattlePhase battlePhase,
Player battleActivePlayer)
setupBattleFight in interface IClient
public void tellLegionLocation(Legion legion,
MasterHex hex)
tellLegionLocation in interface IClientpublic PlayerColor getColor()
public java.lang.String getShortColor()
public Player getBattleActivePlayer()
getBattleActivePlayer in interface IOraclepublic Engagement getEngagement()
getEngagement in interface IOraclepublic Legion getDefender()
public Legion getAttacker()
public MasterHex getBattleSite()
public BattlePhase getBattlePhase()
getBattlePhase in interface IOraclepublic int getBattleTurnNumber()
public void doBattleMove(int tag,
BattleHex hex)
public void undoBattleMove(BattleHex hex)
private void markBattleMoveSuccessful(int tag,
BattleHex endingHex)
private void handleFailedBattleMove(java.lang.String errmsg)
public void tellBattleMove(int tag,
BattleHex startingHex,
BattleHex endingHex,
boolean undo)
tellBattleMove in interface IClient
public void strike(int tag,
BattleHex hex)
public void applyCarries(BattleHex hex)
public boolean isInContact(BattleCritter critter,
boolean countDead)
public java.util.Set<BattleHex> findMobileCritterHexes()
public java.util.Set<BattleUnit> findMobileBattleUnits()
public java.util.Set<BattleHex> showBattleMoves(BattleCritter battleCritter)
public java.util.Set<BattleHex> findCrittersWithTargets()
public java.util.Set<BattleHex> findStrikes(int tag)
public Player getPlayerByName(java.lang.String name)
public Player getActivePlayer()
getActivePlayer in interface IOraclepublic Phase getPhase()
public int getTurnNumber()
getTurnNumber in interface IOracle
private CreatureType figureTeleportingLord(Legion legion,
MasterHex hex)
private java.util.List<CreatureType> listTeleportingLords(Legion legion,
MasterHex hex)
public boolean doMove(Legion mover,
MasterHex hex)
public void didMove(Legion legion,
MasterHex startingHex,
MasterHex currentHex,
EntrySide entrySide,
boolean teleport,
CreatureType teleportingLord,
boolean splitLegionHasForcedMove)
didMove in interface IClientpublic void undoMove(Legion legion)
public void undidMove(Legion legion,
MasterHex formerHex,
MasterHex currentHex,
boolean splitLegionHasForcedMove)
undidMove in interface IClient
public void relocateLegion(Legion legion,
MasterHex destination)
public void resetRecruitReservations()
public boolean reserveRecruit(CreatureType recruitType)
public int getReservedRemain(CreatureType recruitType)
public java.util.List<CreatureType> findEligibleRecruits(Legion legion,
MasterHex hex)
public java.util.List<CreatureType> findEligibleRecruits(Legion legion,
MasterHex hex,
boolean considerReservations)
legion - The legion to recruit with.hex - The hex in which to recruit (not necessarily the same as the legion's position). Not null.considerReservations - Flag to determine if reservations should be considered.
public java.util.List<java.lang.String> findEligibleRecruiters(Legion legion,
CreatureType recruit)
public java.util.Set<MasterHex> getPossibleRecruitHexes()
private java.util.Set<MasterHex> getPossibleRecruitActionHexes()
public boolean noRecruitActionPossible()
public MovementClientSide getMovement()
public java.util.Set<MasterHex> listTeleportMoves(Legion legion)
public java.util.Set<MasterHex> listNormalMoves(Legion legion)
public void legionsNotMoved(int[] legionStatus,
boolean have_roll)
legionStatus - an array of integers with various status
states to be set. Array should be initialized to all zeroes
Current array contents:
[Constants.legionStatusCount] == count of legions
[Constants.legionStatusMoved] == legions that have moved
[Constants.legionStatusBlocked] == unmoved legions with no legal move
[Constants.legionStatusNotVisitedSkippedBlocked] == legions that have not been moved,
are not blocked and have not been skipped
public java.util.Set<MasterHex> findUnmovedLegionHexes(boolean considerSkippedAsMoved,
java.util.HashSet<Legion> pendingLegions)
public java.util.Set<MasterHex> findTallLegionHexes()
public java.util.Set<MasterHex> findTallLegionHexes(int minHeight,
boolean ignoreSkipFlag)
ignoreSkipFlag - Set to true, legion will be considered even if
it was marked as "skip this time".public void notifyServer()
public boolean isSctAlreadyDown()
public void undidSplit(Legion splitoff,
Legion survivor,
int turn)
undidSplit in interface IClientpublic void doneWithSplits()
public void doneWithMoves()
public void doneWithEngagements()
public void doneWithRecruits()
public boolean isMyLegion(Legion legion)
public boolean isMyTurn()
public boolean isMyBattlePhase()
public void doSplit(Legion parent)
parent - The legion selected to split
public void doTheSplitting(Legion parent,
java.lang.String childId)
public void doSplit(Legion parent,
java.lang.String childMarkerId,
java.util.List<CreatureType> results)
public void didSplit(MasterHex hex,
Legion parent,
Legion child,
int childHeight,
java.util.List<CreatureType> splitoffs,
int turn)
didSplit in interface IClientpublic void askPickColor(java.util.List<PlayerColor> colorsLeft)
askPickColor in interface IClientpublic void answerPickColor(PlayerColor color)
public void askPickFirstMarker()
askPickFirstMarker in interface IClientpublic void assignFirstMarker(java.lang.String markerId)
public void log(java.lang.String message)
log in interface IClientpublic void pingRequest()
pingRequest in interface IClient
public boolean testBattleMove(BattleCritter battleUnit,
BattleHex hex)
private AI createAI(java.lang.String playerType)
playerType - Type of player for which to create an AI
private void aiPause()
private void setupDelay()
public Game getGame()
public GameClientSide getGameClientSide()
public Options getOptions()
getOptions in interface OptionObjectProvider
public java.util.List<CreatureType> getPossibleRecruits(MasterBoardTerrain terrain,
MasterHex hex)
TerrainRecruitLoader.getPossibleRecruits(MasterBoardTerrain, MasterHex)
getPossibleRecruits in interface IVariant
public int numberOfRecruiterNeeded(CreatureType recruiter,
CreatureType recruit,
MasterBoardTerrain terrain,
MasterHex hex)
TerrainRecruitLoader.numberOfRecruiterNeeded(CreatureType,
CreatureType, MasterBoardTerrain, MasterHex)
numberOfRecruiterNeeded in interface IVariantpublic java.util.Collection<MasterBoardTerrain> getTerrains()
MasterBoardTerrain.
public void setPreferencesCheckBoxValue(java.lang.String name,
boolean value)
public void setPreferencesRadioButtonValue(java.lang.String name,
boolean value)
public void editAddCreature(java.lang.String markerId,
java.lang.String creatureType)
public void editRemoveCreature(java.lang.String markerId,
java.lang.String creatureType)
public void editRelocateLegion(java.lang.String markerId,
java.lang.String hexLabel)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||