|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.game.SOCPlayingPiece soc.game.SOCVillage
public class SOCVillage
A village playing piece, used on the large sea board (SOCBoardLarge
) with some scenarios.
Villages are in a game only if scenario option SOCGameOption.K_SC_CLVI
is set.
Villages belong to the game board, not to any player, and new villages cannot be built after the game starts.
Trying to call village.getPlayer()
will throw an exception.
Field Summary | |
---|---|
int |
diceNum
Village's dice number, for giving cloth to players who've established a trade route to here. |
private int |
numCloth
How many cloth does this village have? |
private static long |
serialVersionUID
|
static int |
STARTING_CLOTH
Default starting amount of cloth for a village (5). |
static int |
STARTING_GENERAL_CLOTH
Default starting amount of cloth for the board general supply (10). |
private java.util.List<SOCPlayer> |
traders
Players who have established trade with this village. |
Fields inherited from class soc.game.SOCPlayingPiece |
---|
board, CITY, coord, FORTRESS, MAXPLUSONE, MIN, pieceType, player, ROAD, SETTLEMENT, SHIP, specialVP, specialVPEvent, VILLAGE |
Constructor Summary | |
---|---|
SOCVillage(int node,
int dice,
int cloth,
SOCBoard board)
Make a new village, which has a certain amount of cloth. |
|
SOCVillage(int node,
SOCBoard board)
|
Method Summary | |
---|---|
boolean |
addTradingPlayer(SOCPlayer pl)
Add this player to the list of trading players. |
int[] |
distributeCloth(SOCGame game)
Game action: Distribute cloth to players from this village and (if needed) from the board general supply. |
int |
getCloth()
Get how many cloth this village currently has. |
void |
setCloth(int numCloth)
Set how many cloth this village currently has. |
int |
takeCloth(int numTake)
Take this many cloth, if available, from this village. |
Methods inherited from class soc.game.SOCPlayingPiece |
---|
equals, getAdjacentEdges, getCoordinates, getPlayer, getPlayerNumber, getResourcesToBuild, getType, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final int STARTING_GENERAL_CLOTH
STARTING_CLOTH
,
Constant Field Valuespublic static final int STARTING_CLOTH
STARTING_GENERAL_CLOTH
,
Constant Field Valuespublic final int diceNum
private int numCloth
private java.util.List<SOCPlayer> traders
Constructor Detail |
---|
public SOCVillage(int node, SOCBoard board) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public SOCVillage(int node, int dice, int cloth, SOCBoard board) throws java.lang.IllegalArgumentException
node
- node coordinate of villagedice
- dice number for giving cloth to players.
To simplify cloth distribution when remaining cloth
is low, no other village should share the same dice number.cloth
- number of pieces of cloth, such as STARTING_CLOTH
board
- board
java.lang.IllegalArgumentException
- if board nullMethod Detail |
---|
public int getCloth()
takeCloth(int)
public void setCloth(int numCloth)
numCloth
- Number of clothpublic int takeCloth(int numTake)
numTake
- Number of cloth to try and take
getCloth()
,
SOCBoardLarge.takeCloth(int)
public boolean addTradingPlayer(SOCPlayer pl)
getCloth()
remaining,
gives pl 1 cloth now (at server only).
pl
- Player who's just established trade with this village
public int[] distributeCloth(SOCGame game)
addTradingPlayer(SOCPlayer)
gets at most 1 cloth.
If the village has no cloth remaining, does nothing (returns null).
Calls takeCloth(int)
, SOCBoardLarge.takeCloth(int)
, SOCPlayer.setCloth(int)
, etc.
If the village has some cloth, but not enough to distribute to all trading players (including from the general supply), then start with the current player if they're trading with this village. Then, the players with first pick are those who established trade first.
game
- Game with this village
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |