|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsoc.game.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.
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 | |
private int |
devCardType
Development card type re-gained, or -1; from constants such as SOCDevCardConstants.DISC. |
static int |
FORCE_ENDTURN_LOST_CHOICE
Choice lost; a development card may be returned to hand, see getDevCardType(). |
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. |
static int |
FORCE_ENDTURN_RSRC_DISCARD_WAIT
Resources have been randomly discarded. |
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. |
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 int |
result
Result type, like FORCE_ENDTURN_NONE |
private boolean |
rsrcLoss
If true, player's resources are lost (discarded), not gained (returned). |
| Constructor Summary | |
SOCForceEndTurnResult(int res)
Creates a new SOCForceEndTurnResult object, no resources gained/lost. |
|
SOCForceEndTurnResult(int res,
int dtype)
Creates a new SOCForceEndTurnResult object, with a development card regained. |
|
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. |
|
| Method Summary | |
int |
getDevCardType()
Is a development card being returned to the player's hand? |
SOCResourceSet |
getResourcesGainedLost()
Get the resources gained (returned to cancel piece placement) or lost (discarded), if any. |
int |
getResult()
Get the force result type. |
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 int devCardType
SOCDevCardConstants.DISC.
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.
public static final int FORCE_ENDTURN_SKIP_START_ADVBACK
SOCGame.START2A.
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
public static final int FORCE_ENDTURN_UNPLACE_ROBBER
public static final int FORCE_ENDTURN_RSRC_DISCARD
public static final int FORCE_ENDTURN_RSRC_DISCARD_WAIT
SOCGame.isForcingEndTurn() is set.
public static final int FORCE_ENDTURN_LOST_CHOICE
getDevCardType().
public static final int FORCE_ENDTURN_MAX
SOCGame.forceEndTurn()
| Constructor Detail |
public SOCForceEndTurnResult(int res)
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,
int dtype)
res - Result type, from constants in this class
(FORCE_ENDTURN_UNPLACE_ROBBER, etc.)dtype - Development card type, like SOCDevCardConstants.DISC, or -1 for none.
java.lang.IllegalArgumentException - If res is not in the range
FORCE_ENDTURN_MIN to FORCE_ENDTURN_MAX,
or if dtype is not -1 and not in the range
SOCDevCardConstants.MIN to SOCDevCardConstants.MAX_KNOWN.
public SOCForceEndTurnResult(int res,
SOCResourceSet gained)
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)
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).
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 int getDevCardType()
SOCDevCardConstants.DISC.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||