|
JSettlers v1.0.6 API Built ${date} |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoc.game.SOCPlayer
A class for holding and manipulating player data
Field Summary | |
protected int |
lastRoadCoord
The coordinates of our most recent road |
protected int |
lastSettlementCoord
The coordinates of our most recent settlement |
Fields inherited from interface soc.game.SOCResourceConstants |
CLAY, MAXPLUSONE, MIN, ORE, SHEEP, UNKNOWN, WHEAT, WOOD |
Fields inherited from interface soc.game.SOCDevCardConstants |
CAP, DISC, KNIGHT, LIB, MAXPLUSONE, MIN, MONO, ROADS, TEMP, TOW, UNIV, UNKNOWN |
Constructor Summary | |
SOCPlayer(int pn,
SOCGame ga)
create a new player |
|
SOCPlayer(SOCPlayer player)
create a copy of the player |
Method Summary | |
int |
calcLongestRoad2()
Calculates the longest road for a player |
void |
clearPotentialSettlements()
Set all nodes to not be potential settlements |
SOCPlayer |
copy()
|
void |
destroyPlayer()
set vars to null so gc can clean up |
java.util.Vector |
getCities()
|
SOCTradeOffer |
getCurrentOffer()
|
SOCDevCardSet |
getDevCards()
|
int |
getFaceId()
get the face image id |
SOCGame |
getGame()
|
int |
getLastRoadCoord()
|
int |
getLastSettlementCoord()
|
int |
getLongestRoadLength()
|
java.util.Vector |
getLRPaths()
|
java.lang.String |
getName()
|
boolean |
getNeedToDiscard()
|
SOCPlayerNumbers |
getNumbers()
|
int |
getNumKnights()
|
int |
getNumPieces(int ptype)
|
java.util.Vector |
getPieces()
|
int |
getPlayerNumber()
|
boolean |
getPortFlag(int portType)
|
boolean[] |
getPortFlags()
|
int |
getPublicVP()
|
SOCResourceSet |
getResources()
|
java.util.Vector |
getRoadNodes()
|
java.util.Vector |
getRoads()
|
java.util.Vector |
getSettlements()
|
int |
getTotalVP()
|
boolean |
hasLargestArmy()
|
boolean |
hasLongestRoad()
|
boolean |
hasPlayedDevCard()
|
boolean |
hasPotentialCity()
|
boolean |
hasPotentialRoad()
|
boolean |
hasPotentialSettlement()
|
void |
incrementNumKnights()
increment the number of knights in play |
boolean |
isConnectedByRoad(int node1,
int node2)
|
boolean |
isLegalRoad(int edge)
|
boolean |
isPotentialCity(int node)
|
boolean |
isPotentialRoad(int edge)
|
boolean |
isPotentialSettlement(int node)
|
boolean |
isRobot()
|
void |
putPiece(SOCPlayingPiece piece)
put a piece into play note: placing a city automatically removes the settlement there |
void |
removePiece(SOCPlayingPiece piece)
remove a player's piece from the board2 and put it back in the player's hand NOTE: Does NOT update the potential building lists for removing settlements or cities. |
void |
setCurrentOffer(SOCTradeOffer of)
set the current offer for this player |
void |
setFaceId(int id)
set the face image id |
void |
setLongestRoadLength(int len)
set the longest road length |
void |
setLRPaths(java.util.Vector vec)
set the longest paths vector |
void |
setName(java.lang.String na)
set the name of the player |
void |
setNeedToDiscard(boolean value)
set the "need to discard" flag |
void |
setNumKnights(int nk)
set the number of knights in play |
void |
setNumPieces(int ptype,
int amt)
set the amount of pieces not in play for a particular type of piece |
void |
setPlayedDevCard(boolean value)
set the playedDevCard flag |
void |
setPortFlag(int portType,
boolean value)
set a port flag |
void |
setPotentialSettlements(java.util.Vector psList)
set which nodes are potential settlements |
void |
setRobotFlag(boolean value)
set the robot flag |
void |
undoPutPiece(SOCPlayingPiece piece)
undo the putting of a piece |
protected void |
undoPutPieceAuxSettlement(int settlementNode)
Auxiliary function for undoing settlement placement |
void |
updatePotentials(SOCPlayingPiece piece)
update the arrays that keep track of where this player can play a piece |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int lastSettlementCoord
protected int lastRoadCoord
Constructor Detail |
public SOCPlayer(SOCPlayer player)
player
- the player to copypublic SOCPlayer(int pn, SOCGame ga)
pn
- the player numberga
- the game that the player is inMethod Detail |
public void clearPotentialSettlements()
public void setName(java.lang.String na)
na
- the namepublic java.lang.String getName()
public int getPlayerNumber()
public SOCGame getGame()
public boolean hasPlayedDevCard()
public void setPlayedDevCard(boolean value)
value
- the value of the flagpublic void setNeedToDiscard(boolean value)
value
- the value of the flagpublic boolean getNeedToDiscard()
public void setRobotFlag(boolean value)
value
- public boolean isRobot()
public void setFaceId(int id)
id
- the image idpublic int getFaceId()
public SOCPlayerNumbers getNumbers()
public int getNumPieces(int ptype)
ptype
- the type of piece
public void setNumPieces(int ptype, int amt)
ptype
- the type of pieceamt
- the amountpublic java.util.Vector getPieces()
public java.util.Vector getRoads()
public java.util.Vector getSettlements()
public java.util.Vector getCities()
public int getLastSettlementCoord()
public int getLastRoadCoord()
public int getLongestRoadLength()
public java.util.Vector getLRPaths()
public void setLRPaths(java.util.Vector vec)
vec
- the vectorpublic void setLongestRoadLength(int len)
len
- the lengthpublic SOCResourceSet getResources()
public SOCDevCardSet getDevCards()
public int getNumKnights()
public void setNumKnights(int nk)
nk
- the number of knightspublic void incrementNumKnights()
public boolean hasLongestRoad()
public boolean hasLargestArmy()
public int getPublicVP()
public int getTotalVP()
public java.util.Vector getRoadNodes()
public SOCTradeOffer getCurrentOffer()
public void setCurrentOffer(SOCTradeOffer of)
of
- the offerpublic boolean isConnectedByRoad(int node1, int node2)
node1
- coordinates of first nodenode2
- coordinates of second node
public void putPiece(SOCPlayingPiece piece)
piece
- the piece to be put into playpublic void undoPutPiece(SOCPlayingPiece piece)
piece
- the piece to be put into playprotected void undoPutPieceAuxSettlement(int settlementNode)
settlementNode
- the node we want to considerpublic void removePiece(SOCPlayingPiece piece)
public void updatePotentials(SOCPlayingPiece piece)
piece
- a piece that has just been playedpublic void setPotentialSettlements(java.util.Vector psList)
psList
- the list of potential settlementspublic boolean isPotentialSettlement(int node)
node
- the coordinates of a node on the board
public boolean isPotentialCity(int node)
node
- the coordinates of a node on the board
public boolean isPotentialRoad(int edge)
edge
- the coordinates of an edge on the board
public boolean isLegalRoad(int edge)
edge
- the coordinates of an edge on the board
public boolean hasPotentialRoad()
public boolean hasPotentialSettlement()
public boolean hasPotentialCity()
public int calcLongestRoad2()
public void setPortFlag(int portType, boolean value)
portType
- the type of port, see SOCBoardvalue
- true or falsepublic boolean getPortFlag(int portType)
portType
- the type of port, see SOCBoard
public boolean[] getPortFlags()
public SOCPlayer copy()
public void destroyPlayer()
|
JSettlers v1.0.6 API Built ${date} |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |