|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.game.SOCForceEndTurnResult
public class SOCForceEndTurnResult
This class holds the results of a call to SOCGame.forceEndTurn()
.
Specifically, the resulting action type, and possibly list of discarded
or returned resources or dev card/inventory item.
forceEndTurn() may also set the game state to SOCGame.OVER
.
Check for that; it's not reported as part of this object.
The result object isn't intended to be conveyed over a network to clients; the server should translate it into standard SOCMessages which change game state.
Field Summary | |
---|---|
static int |
FORCE_ENDTURN_LOST_CHOICE
Choice lost; a development card or item may be returned to hand, see getReturnedInvItem() . |
static int |
FORCE_ENDTURN_MAX
Highest valid FORCE_ENDTURN_ value for SOCGame.forceEndTurn() |
static int |
FORCE_ENDTURN_MIN
SOCGame.forceEndTurn() return values. |
static int |
FORCE_ENDTURN_NONE
Since state is already SOCGame.PLAY1 , already OK to end turn. |
static int |
FORCE_ENDTURN_RSRC_DISCARD
Resources have been randomly discarded, or gained from SOCBoardLarge.GOLD_HEX
or a canceled piece placement. |
static int |
FORCE_ENDTURN_RSRC_DISCARD_WAIT
Resources have been randomly discarded, or gained from SOCBoardLarge.GOLD_HEX
or a canceled piece placement. |
static int |
FORCE_ENDTURN_RSRC_RET_UNPLACE
Sent both for placement of bought pieces, and for "free" pieces from road-building cards. |
static int |
FORCE_ENDTURN_SKIP_START_ADV
Skip an initial road or settlement; current player has advanced forward, state changes to SOCGame.START1A or SOCGame.START3A . |
static int |
FORCE_ENDTURN_SKIP_START_ADVBACK
Skip an initial road or settlement; current player has advanced backward, state changes to SOCGame.START2A . |
static int |
FORCE_ENDTURN_SKIP_START_TURN
Skip an initial road or settlement; state changes to SOCGame.PLAY1 , and SOCGame.endTurn() should be called. |
static int |
FORCE_ENDTURN_UNPLACE_ROBBER
Robber movement has been cancelled. |
private SOCResourceSet |
gainLoss
Resources gained (returned to cancel piece placement) or lost (discarded), or null. |
private SOCInventoryItem |
invCard
Development card type / item returned to player's inventory, or null . |
private int |
result
Result type, like FORCE_ENDTURN_NONE |
private boolean |
rsrcLoss
If true, player's resources are lost (discarded), not gained (returned). |
private boolean |
updatedFP
If true, game's SOCGame.getFirstPlayer() was changed. |
private boolean |
updatedLP
If true, game's lastPlayer was changed. |
Constructor Summary | |
---|---|
|
SOCForceEndTurnResult(int res)
Creates a new SOCForceEndTurnResult object, no resources gained/lost. |
|
SOCForceEndTurnResult(int res,
boolean updateFirstPlayer,
boolean updateLastPlayer,
SOCResourceSet rsrcGained)
Creates a new SOCForceEndTurnResult object, from start states, possibly changing the game's firstplayer or lastplayer. |
|
SOCForceEndTurnResult(int res,
SOCInventoryItem item)
Creates a new SOCForceEndTurnResult object, optionally with a development card or inventory option regained (returned to the player's hand). |
|
SOCForceEndTurnResult(int res,
SOCResourceSet gained)
Creates a new SOCForceEndTurnResult object, with resources gained. |
|
SOCForceEndTurnResult(int res,
SOCResourceSet gainedLost,
boolean isLoss)
Creates a new SOCForceEndTurnResult object, with resources gained/lost. |
private |
SOCForceEndTurnResult(int res,
SOCResourceSet gainedLost,
boolean isLoss,
boolean updateFirstPlayer,
boolean updateLastPlayer)
Creates a new SOCForceEndTurnResult object. |
Method Summary | |
---|---|
boolean |
didUpdateFP()
Did the game's SOCGame.getFirstPlayer() change? |
boolean |
didUpdateLP()
Did the game's lastPlayer change? Calling SOCGame.setFirstPlayer(int) will also calculate
its lastPlayer based on vacant seats and firstPlayer. |
SOCResourceSet |
getResourcesGainedLost()
Get the resources gained (returned to cancel piece placement, or received from placing at a gold hex) or lost (discarded), if any. |
int |
getResult()
Get the force result type. |
SOCInventoryItem |
getReturnedInvItem()
Is a development card or inventory item being returned to the player's hand? |
boolean |
isLoss()
Is player losing, or gaining, the resources of getResourcesGainedLost() ? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int result
FORCE_ENDTURN_NONE
private SOCResourceSet gainLoss
private boolean rsrcLoss
private SOCInventoryItem invCard
null
.
Currently used with FORCE_ENDTURN_LOST_CHOICE
and FORCE_ENDTURN_UNPLACE_ROBBER
.
private boolean updatedFP
SOCGame.getFirstPlayer()
was changed.
private boolean updatedLP
SOCGame.setFirstPlayer(int)
will also calculate
its lastPlayer based on vacant seats and firstPlayer.
public static final int FORCE_ENDTURN_MIN
SOCGame.forceEndTurn()
return values. FORCE_ENDTURN_MIN is the lowest valid value.
public static final int FORCE_ENDTURN_NONE
SOCGame.PLAY1
, already OK to end turn. No action was taken by forceEndTurn.
public static final int FORCE_ENDTURN_SKIP_START_ADV
SOCGame.START1A
or SOCGame.START3A
.
May have changed game's firstPlayer or lastPlayer; check didUpdateFP()
and didUpdateLP()
.
public static final int FORCE_ENDTURN_SKIP_START_ADVBACK
SOCGame.START2A
.
May have changed game's firstPlayer or lastPlayer; check didUpdateFP()
and didUpdateLP()
.
public static final int FORCE_ENDTURN_SKIP_START_TURN
SOCGame.PLAY1
, and SOCGame.endTurn()
should be called.
public static final int FORCE_ENDTURN_RSRC_RET_UNPLACE
getResourcesGainedLost()
contains the returned resources, or nothing if the piece was free.
public static final int FORCE_ENDTURN_UNPLACE_ROBBER
getReturnedInvItem()
to see if a Knight card was returned.
public static final int FORCE_ENDTURN_RSRC_DISCARD
SOCBoardLarge.GOLD_HEX
or a canceled piece placement. Ready to end turn.
rsrcLoss
is set or cleared.
getResourcesGainedLost()
contains the resources.
public static final int FORCE_ENDTURN_RSRC_DISCARD_WAIT
SOCBoardLarge.GOLD_HEX
or a canceled piece placement. Cannot end turn yet; other players must discard or gain.
SOCGame.isForcingEndTurn()
is set.
rsrcLoss
is set or cleared.
getResourcesGainedLost()
contains the resources.
public static final int FORCE_ENDTURN_LOST_CHOICE
getReturnedInvItem()
.
public static final int FORCE_ENDTURN_MAX
SOCGame.forceEndTurn()
Constructor Detail |
---|
public SOCForceEndTurnResult(int res) throws java.lang.IllegalArgumentException
res
- Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
.public SOCForceEndTurnResult(int res, boolean updateFirstPlayer, boolean updateLastPlayer, SOCResourceSet rsrcGained) throws java.lang.IllegalArgumentException
res
- Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)updateFirstPlayer
- Was SOCGame.getFirstPlayer()
changed?updateLastPlayer
- Was game's lastPlayer changed?rsrcGained
- null, or randomly picked resources from gold hex
from state STARTS_WAITING_FOR_PICK_GOLD_RESOURCE
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
.public SOCForceEndTurnResult(int res, SOCInventoryItem item) throws java.lang.IllegalArgumentException
getReturnedInvItem()
.
res
- Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)item
- Development card or inventory item regained, or null
if none
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
public SOCForceEndTurnResult(int res, SOCResourceSet gained) throws java.lang.IllegalArgumentException
res
- Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)gained
- Resources gained (returned to cancel piece
placement), or null.
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
.public SOCForceEndTurnResult(int res, SOCResourceSet gainedLost, boolean isLoss) throws java.lang.IllegalArgumentException
res
- Result type, from constants in this class
(FORCE_ENDTURN_RSRC_DISCARD
, etc.)gainedLost
- Resources gained (returned to cancel piece
placement) or lost (discarded), or null.isLoss
- Resources are lost (discarded), not gained (returned to player).
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
.private SOCForceEndTurnResult(int res, SOCResourceSet gainedLost, boolean isLoss, boolean updateFirstPlayer, boolean updateLastPlayer) throws java.lang.IllegalArgumentException
res
- Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)gainedLost
- Resources gained (returned to cancel piece
placement) or lost (discarded), or null.isLoss
- Resources are lost (discarded), not gained (returned to player).updateFirstPlayer
- Was SOCGame.getFirstPlayer()
changed?updateLastPlayer
- Was game's lastPlayer changed?
java.lang.IllegalArgumentException
- If res is not in the range
FORCE_ENDTURN_MIN
to FORCE_ENDTURN_MAX
.Method Detail |
---|
public int getResult()
FORCE_ENDTURN_UNPLACE_ROBBER
, etc.)public SOCResourceSet getResourcesGainedLost()
isLoss()
.
public boolean isLoss()
getResourcesGainedLost()
?
public boolean didUpdateFP()
SOCGame.getFirstPlayer()
change?
public boolean didUpdateLP()
SOCGame.setFirstPlayer(int)
will also calculate
its lastPlayer based on vacant seats and firstPlayer.
public SOCInventoryItem getReturnedInvItem()
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |