Class PlayerServerSide
java.lang.Object
net.sf.colossus.game.Player
net.sf.colossus.server.PlayerServerSide
- All Implemented Interfaces:
Comparable<PlayerServerSide>
Class Player holds the data for one player in a Titan game.
- Author:
- David Ripton
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LegionServerSideThe legion which gave a summonable creature.private Stringprivate static final Loggerprivate intTODO this might be better as a state inGamesince there is always only one per game, not per playerprivate Stringprivate Legionprivate doubleprivate booleanprivate booleanTODOPlayerClientSidejust checks if any legion has teleported.private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddPoints(double points, boolean halfPoints) Add points to this player's score.(package private) voidawardPoints(int points, LegionServerSide legion, boolean halfPoints) Award points and handle all acquiring related issues.void(package private) booleanReturn true if any legion can recruit.(package private) voidintcompareTo(PlayerServerSide other) Players are sorted in order of decreasing starting tower.(package private) voidSet markersAvailable based on other available information.(package private) intReturn the number of this player's legions that have legal non-teleport moves remaining.(package private) voidTurns the player dead.(package private) void(package private) LegionServerSidegetDonor()(package private) StringgetGame()Overridden to return specific flavor of Game until the upper class is sufficient.TODO remove once noone needs the specific version anymore(package private) intintintgetScore()(package private) StringgetStatusInfo(boolean treatDeadAsAlive) Return a colon-separated string with a bunch of info for the status screen.voidhandleSlaying(Player slayer) (package private) booleanboolean(package private) void(package private) voidinitMarkersAvailable(String shortColor) (package private) boolean(package private) intReturn the number of this player's legions that have moved.(package private) void(package private) voidRemove all of this player's zero-height legions.(package private) voidboolean(package private) int(package private) voidsetDonor(LegionServerSide donor) (package private) voidsetFirstMarker(String firstMarker) (package private) voidsetMovementRoll(int movementRoll) voidsetScore(int score) (package private) voidsetSummoned(boolean summoned) (package private) voidsetTeleported(boolean teleported) void(package private) booleanReturn true if two or more of this player's legions share a hex and they have a legal non-teleport move.(package private) void(package private) voidRemove half-points.(package private) void(package private) void(package private) voidundoRecruit(Legion legion) Tell legion to do undo the recruiting and trigger needed messages to be sent to clients(package private) voidundoReinforcement(Legion legion) Tell legion to do undo the reinforcement and trigger needed messages to be sent to clients (quite similar to undorecuit, but not exactly the same)(package private) voidMethods inherited from class Player
addLegion, addMarkerAvailable, addPlayerElim, canTitanTeleport, clearMarkersAvailable, getAngelBasename, getColor, getDeadBeforeSave, getFirstAvailableMarker, getLegionByMarkerId, getMarkersAvailable, getMulligansLeft, getName, getNumber, getNumCreatures, getNumLegions, getNumMarkersAvailable, getPlayersElim, getShortColor, getStartingTower, getTitanBasename, getTitanLegion, getTitanPower, getTotalPointValue, getType, hasLegion, hasMoved, isAI, isDead, isHuman, isLocalHuman, isMarkerAvailable, isNetwork, isNone, removeAllLegions, removeLegion, removeMarkerAvailable, selectMarkerId, setColor, setDead, setDeadBeforeSave, setMulligansLeft, setName, setPlayersElim, setStartingTower, toString
-
Field Details
-
LOGGER
-
score
private double score -
summoned
private boolean summoned -
teleported
private boolean teleportedTODOPlayerClientSidejust checks if any legion has teleported. Pick one version and move up intoPlayer. -
movementRoll
private int movementRollTODO this might be better as a state inGamesince there is always only one per game, not per player -
titanEliminated
private boolean titanEliminated -
donor
The legion which gave a summonable creature. -
firstMarker
-
playersEliminatedBackup
-
legionsBackup
-
previousUndoRecruitLegion
-
-
Constructor Details
-
PlayerServerSide
PlayerServerSide(String name, GameServerSide game, String shortTypeName)
-
-
Method Details
-
getGame
Overridden to return specific flavor of Game until the upper class is sufficient. -
setType
-
initMarkersAvailable
void initMarkersAvailable() -
initMarkersAvailable
-
computeMarkersAvailable
void computeMarkersAvailable()Set markersAvailable based on other available information. NOTE: to be used only during loading a Game! -
setFirstMarker
-
getFirstMarker
String getFirstMarker() -
compareTo
Players are sorted in order of decreasing starting tower. This is inconsistent with equals().- Specified by:
compareToin interfaceComparable<PlayerServerSide>
-
hasTeleported
public boolean hasTeleported()- Overrides:
hasTeleportedin classPlayer
-
setTeleported
void setTeleported(boolean teleported) -
hasSummoned
boolean hasSummoned() -
setSummoned
void setSummoned(boolean summoned) -
getDonor
LegionServerSide getDonor() -
setDonor
-
removeEmptyLegions
void removeEmptyLegions()Remove all of this player's zero-height legions. -
getLegions
TODO remove once noone needs the specific version anymore- Overrides:
getLegionsin classPlayer
-
legionsMoved
int legionsMoved()Return the number of this player's legions that have moved. -
countMobileLegions
int countMobileLegions()Return the number of this player's legions that have legal non-teleport moves remaining. -
commitMoves
void commitMoves() -
getMovementRollSS
public int getMovementRollSS() -
getMovementRoll
int getMovementRoll() -
setMovementRoll
void setMovementRoll(int movementRoll) -
resetTurnState
void resetTurnState() -
rollMovement
int rollMovement() -
takeMulligan
void takeMulligan() -
undoMove
-
undoAllMoves
void undoAllMoves() -
splitLegionHasForcedMove
boolean splitLegionHasForcedMove()Return true if two or more of this player's legions share a hex and they have a legal non-teleport move. -
canRecruit
boolean canRecruit()Return true if any legion can recruit. -
undoRecruit
Tell legion to do undo the recruiting and trigger needed messages to be sent to clients- Parameters:
legion- The legion which undoes the recruiting
-
undoReinforcement
Tell legion to do undo the reinforcement and trigger needed messages to be sent to clients (quite similar to undorecuit, but not exactly the same)- Parameters:
legion- The legion which cancels the reinforcement
-
undoSplit
-
recombineIllegalSplits
void recombineIllegalSplits() -
setScore
-
getScore
-
addPoints
void addPoints(double points, boolean halfPoints) Add points to this player's score. Update the status window to reflect the addition. -
truncScore
void truncScore()Remove half-points. -
awardPoints
Award points and handle all acquiring related issues. Note that this is not used for adding points for cleaning up legions of a dead player!- Parameters:
points- the points to awardlegion- the legion which is entitled to acquire due to thathalfPoints- this are already halfPoints (from fleeing)
-
die
Turns the player dead. This method calculates the points other players get, adds them to their score and then cleans up this player and marks him dead. TODO is it really the Player's role to assign points? I'd rather see that responsibility with the Game object TODO the slayer could be non-null if we introduce a null object (some object called e.g. "NOONE" that behaves like a Player as far as possible, giving a name and swallowing points)- Parameters:
slayer- The player who killed us. May be null if we just gave up or it is a draw.
-
handleSlaying
-
eliminateTitan
void eliminateTitan() -
isTitanEliminated
boolean isTitanEliminated() -
getStatusInfo
Return a colon-separated string with a bunch of info for the status screen. -
backupLoadedData
public void backupLoadedData() -
resyncBackupData
public boolean resyncBackupData()
-