|
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.SOCGame
A class for holding and manipulating game data
Field Summary | |
static SOCResourceSet |
CARD_SET
the set of resources a player needs to buy a development card |
static SOCResourceSet |
CITY_SET
the set of resources a player needs to build a city |
static SOCResourceSet |
EMPTY_RESOURCES
the set of resources a player needs to build a settlement |
static boolean |
LOCKED
|
static int |
MAXPLAYERS
maximum number of players in a game |
static int |
NEW
game states |
static int |
OCCUPIED
|
static int |
OVER
|
static int |
PLACING_CITY
|
static int |
PLACING_FREE_ROAD1
|
static int |
PLACING_FREE_ROAD2
|
static int |
PLACING_ROAD
|
static int |
PLACING_ROBBER
|
static int |
PLACING_SETTLEMENT
|
static int |
PLAY
|
static int |
PLAY1
|
static int |
READY
|
static SOCResourceSet |
ROAD_SET
the set of resources a player needs to build a road |
static SOCResourceSet |
SETTLEMENT_SET
the set of resources a player needs to build a settlement |
static int |
START1A
|
static int |
START1B
|
static int |
START2A
|
static int |
START2B
|
static boolean |
UNLOCKED
|
static int |
VACANT
seat states |
static int |
WAITING_FOR_CHOICE
|
static int |
WAITING_FOR_DISCARDS
|
static int |
WAITING_FOR_DISCOVERY
|
static int |
WAITING_FOR_MONOPOLY
|
Constructor Summary | |
SOCGame(java.lang.String n)
create a new game |
|
SOCGame(java.lang.String n,
boolean a)
create a new game that can be INACTIVE |
Method Summary | |
void |
addPlayer(java.lang.String name,
int pn)
add a new player |
protected void |
advanceTurn()
advance the turn to the next player |
protected void |
advanceTurnBackwards()
advance the turn to the next player |
boolean |
allOriginalPlayers()
|
void |
buyCity(int pn)
a player is buying a city |
int |
buyDevCard()
the current player is buying a dev card |
void |
buyRoad(int pn)
a player is buying a road |
void |
buySettlement(int pn)
a player is buying a settlement |
void |
cancelBuildCity(int pn)
a player is UNbuying a city |
void |
cancelBuildRoad(int pn)
a player is UNbuying a road |
void |
cancelBuildSettlement(int pn)
a player is UNbuying a settlement |
boolean |
canChoosePlayer(int pn)
|
boolean |
canDiscard(int pn,
SOCResourceSet rs)
|
boolean |
canDoDiscoveryAction(SOCResourceSet pick)
|
boolean |
canDoMonopolyAction()
|
boolean |
canEndTurn(int pn)
|
boolean |
canMakeBankTrade(SOCResourceSet give,
SOCResourceSet get)
|
boolean |
canMakeTrade(int offering,
int accepting)
|
boolean |
canMoveRobber(int pn,
int co)
|
boolean |
canPlayDiscovery(int pn)
return true if the player can play a Discovery card |
boolean |
canPlayKnight(int pn)
|
boolean |
canPlayMonopoly(int pn)
return true if the player can play a Monopoly card |
boolean |
canPlayRoadBuilding(int pn)
return true if the player can play a Road Building card |
boolean |
canRollDice(int pn)
|
void |
checkForWinner()
check all the vp totals to see if the game is over |
boolean |
couldBuildCity(int pn)
|
boolean |
couldBuildRoad(int pn)
|
boolean |
couldBuildSettlement(int pn)
|
boolean |
couldBuyDevCard(int pn)
|
void |
destroyGame()
set vars to null so gc can clean up |
void |
discard(int pn,
SOCResourceSet rs)
A player is discarding resources |
void |
doDiscoveryAction(SOCResourceSet pick)
perform the Discovery card action |
void |
doMonopolyAction(int pick)
perform the Monopoly card action |
void |
endTurn()
end the turn for the current player |
SOCBoard |
getBoard()
|
int |
getCurrentDice()
|
int |
getCurrentPlayerNumber()
|
long |
getExpiration()
|
int |
getFirstPlayer()
|
int |
getGameState()
|
java.lang.String |
getName()
|
int |
getNumDevCards()
|
SOCPlayer |
getPlayer(int pn)
|
SOCPlayer |
getPlayer(java.lang.String nn)
|
SOCPlayer[] |
getPlayers()
|
java.util.Vector |
getPlayersOnHex(int hex)
|
SOCPlayer |
getPlayerWithLargestArmy()
|
SOCPlayer |
getPlayerWithLongestRoad()
|
java.util.Vector |
getPossibleVictims()
|
SOCResourceSet |
getResourcesGainedFromRoll(SOCPlayer player,
int roll)
figure out what resources a player would get on a given roll |
java.util.Date |
getStartTime()
|
boolean |
isSeatLocked(int pn)
|
boolean |
isSeatVacant(int pn)
|
void |
lockSeat(int pn)
locks a seat, so no one can take it |
void |
makeBankTrade(SOCResourceSet give,
SOCResourceSet get)
perform a bank trade |
void |
makeTrade(int offering,
int accepting)
perform a trade between two players the trade performed is described in the offering player's current offer |
SOCMoveRobberResult |
moveRobber(int pn,
int co)
move the robber |
void |
playDiscovery()
the current player plays a Discovery card |
void |
playKnight()
the current player plays a Knight card |
void |
playMonopoly()
the current player plays a monopoly card |
void |
playRoadBuilding()
the current player plays a Road Building card |
void |
putPiece(SOCPlayingPiece pp)
a piece has been put on the board |
void |
putTempPiece(SOCPlayingPiece pp)
a temporary piece has been put on the board |
void |
releaseMonitor()
release the monitor for this game |
void |
removePlayer(java.lang.String name)
remove a player |
void |
restoreLargestArmyState()
restore the state of who had largest army |
IntPair |
rollDice()
roll the dice |
void |
saveLargestArmyState()
save the state of who has largest army |
protected void |
setBoard(SOCBoard gb)
set the game board |
void |
setCurrentDice(int dr)
set the current dice result |
void |
setCurrentPlayerNumber(int pn)
set the number of the current player |
void |
setExpiration(long ex)
set the expiration time |
void |
setFirstPlayer(int pn)
sets who the first player is |
void |
setGameState(int gs)
set the current game state |
void |
setNumDevCards(int nd)
set the number of dev cards in the deck |
protected void |
setPlayer(int pn,
SOCPlayer pl)
set the data for a player |
void |
setPlayerWithLargestArmy(SOCPlayer pl)
set the player with the largest army |
void |
setPlayerWithLongestRoad(SOCPlayer pl)
set the player with the longest road |
void |
startGame()
do the things involved in starting a game shuffle the tiles and cards make a board |
int |
stealFromPlayer(int pn)
the current player has choosen a victim to rob. |
void |
takeMonitor()
take the monitor for this game |
void |
undoPutTempPiece(SOCPlayingPiece pp)
undo the putting of a temporary piece |
void |
unlockSeat(int pn)
unlocks a seat |
void |
updateLargestArmy()
update which player has the largest army larger than 2 |
void |
updateLongestRoad(int pn)
update which player has longest road longer than 4 this version only calculates the longest road for the player who is affected by the most recently placed piece |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NEW
public static final int READY
public static final int START1A
public static final int START1B
public static final int START2A
public static final int START2B
public static final int PLAY
public static final int PLAY1
public static final int PLACING_ROAD
public static final int PLACING_SETTLEMENT
public static final int PLACING_CITY
public static final int PLACING_ROBBER
public static final int PLACING_FREE_ROAD1
public static final int PLACING_FREE_ROAD2
public static final int WAITING_FOR_DISCARDS
public static final int WAITING_FOR_CHOICE
public static final int WAITING_FOR_DISCOVERY
public static final int WAITING_FOR_MONOPOLY
public static final int OVER
public static final int VACANT
public static final int OCCUPIED
public static final boolean LOCKED
public static final boolean UNLOCKED
public static final int MAXPLAYERS
public static final SOCResourceSet EMPTY_RESOURCES
public static final SOCResourceSet SETTLEMENT_SET
public static final SOCResourceSet ROAD_SET
public static final SOCResourceSet CITY_SET
public static final SOCResourceSet CARD_SET
Constructor Detail |
public SOCGame(java.lang.String n)
n
- the name of the gamepublic SOCGame(java.lang.String n, boolean a)
n
- the name of the gamea
- true if this is an active game, false for inactiveMethod Detail |
public void takeMonitor()
public void releaseMonitor()
public boolean allOriginalPlayers()
public java.util.Date getStartTime()
public long getExpiration()
public void setExpiration(long ex)
ex
- the expiration time in millisecondspublic void addPlayer(java.lang.String name, int pn)
name
- the player's namepn
- the player's numberpublic void removePlayer(java.lang.String name)
name
- the player's namepublic boolean isSeatVacant(int pn)
pn
- the number of the seat
public void lockSeat(int pn)
pn
- the number of the seatpublic void unlockSeat(int pn)
pn
- the number of the seatpublic boolean isSeatLocked(int pn)
pn
- the number of the seat
public SOCPlayer getPlayer(int pn)
pn
- the player number
public SOCPlayer getPlayer(java.lang.String nn)
nn
- the nickname
public java.lang.String getName()
public SOCBoard getBoard()
protected void setBoard(SOCBoard gb)
gb
- the game boardpublic SOCPlayer[] getPlayers()
protected void setPlayer(int pn, SOCPlayer pl)
pn
- the number of the playerpl
- the player datapublic int getCurrentPlayerNumber()
public void setCurrentPlayerNumber(int pn)
pn
- the player numberpublic int getCurrentDice()
public void setCurrentDice(int dr)
dr
- the dice resultpublic int getGameState()
public void setGameState(int gs)
gs
- the game statepublic int getNumDevCards()
public void setNumDevCards(int nd)
nd
- the number of dev cards in the deckpublic SOCPlayer getPlayerWithLargestArmy()
public void setPlayerWithLargestArmy(SOCPlayer pl)
pl
- the playerpublic SOCPlayer getPlayerWithLongestRoad()
public void setPlayerWithLongestRoad(SOCPlayer pl)
pl
- the playerprotected void advanceTurnBackwards()
protected void advanceTurn()
public void putPiece(SOCPlayingPiece pp)
pp
- the piece to put on the boardpublic void putTempPiece(SOCPlayingPiece pp)
pp
- the piece to put on the boardpublic void undoPutTempPiece(SOCPlayingPiece pp)
pp
- the piece to put on the boardpublic void startGame()
public void setFirstPlayer(int pn)
pn
- the seat number of the first playerpublic int getFirstPlayer()
public boolean canEndTurn(int pn)
pn
- player number of the player who wants to end the turn
public void endTurn()
public boolean canRollDice(int pn)
pn
- player number of the player who wants to roll
public IntPair rollDice()
public SOCResourceSet getResourcesGainedFromRoll(SOCPlayer player, int roll)
player
- the playerroll
- the roll
public boolean canDiscard(int pn, SOCResourceSet rs)
pn
- the number of the player that is discardingrs
- the resources that the player is discarding
public void discard(int pn, SOCResourceSet rs)
pn
- the number of the playerrs
- the resources that are being discardedpublic boolean canMoveRobber(int pn, int co)
pn
- the number of the player that is moving the robberco
- the coordinates
public SOCMoveRobberResult moveRobber(int pn, int co)
pn
- the number of the player that is moving the robberco
- the coordinates
public boolean canChoosePlayer(int pn)
pn
- the number of the player to rob
public java.util.Vector getPlayersOnHex(int hex)
hex
- the coordinates of the hex
public java.util.Vector getPossibleVictims()
public int stealFromPlayer(int pn)
pn
- the number of the player being robbed
public boolean canMakeTrade(int offering, int accepting)
offering
- the number of the player making the offeraccepting
- the number of the player accepting the offer
public void makeTrade(int offering, int accepting)
offering
- the number of the player making the offeraccepting
- the number of the player accepting the offerpublic boolean canMakeBankTrade(SOCResourceSet give, SOCResourceSet get)
give
- what the player will give to the bankget
- what the player wants from the bank
public void makeBankTrade(SOCResourceSet give, SOCResourceSet get)
give
- the number of the player making the offerget
- the number of the player accepting the offerpublic boolean couldBuildRoad(int pn)
pn
- the number of the player
public boolean couldBuildSettlement(int pn)
pn
- the number of the player
public boolean couldBuildCity(int pn)
pn
- the number of the player
public boolean couldBuyDevCard(int pn)
pn
- the number of the player
public void buyRoad(int pn)
pn
- the number of the playerpublic void buySettlement(int pn)
pn
- the number of the playerpublic void buyCity(int pn)
pn
- the number of the playerpublic void cancelBuildRoad(int pn)
pn
- the number of the playerpublic void cancelBuildSettlement(int pn)
pn
- the number of the playerpublic void cancelBuildCity(int pn)
pn
- the number of the playerpublic int buyDevCard()
public boolean canPlayKnight(int pn)
pn
- the number of the player
public boolean canPlayRoadBuilding(int pn)
pn
- the number of the playerpublic boolean canPlayDiscovery(int pn)
pn
- the number of the playerpublic boolean canPlayMonopoly(int pn)
pn
- the number of the playerpublic void playKnight()
public void playRoadBuilding()
public void playDiscovery()
public void playMonopoly()
public boolean canDoDiscoveryAction(SOCResourceSet pick)
pick
- the resources that the player wants
public boolean canDoMonopolyAction()
public void doDiscoveryAction(SOCResourceSet pick)
pick
- what the player pickedpublic void doMonopolyAction(int pick)
pick
- the type of resource to monopolizepublic void updateLargestArmy()
public void saveLargestArmyState()
public void restoreLargestArmyState()
public void updateLongestRoad(int pn)
pn
- the number of the player who is affectedpublic void checkForWinner()
public void destroyGame()
|
JSettlers v1.0.6 API Built ${date} |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |