|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<SOCScenarioPlayerEvent> soc.game.SOCScenarioPlayerEvent
public enum SOCScenarioPlayerEvent
Per-player scenario event codes.
Used by SOCScenarioEventListener
s.
Each event also has a SOCGameOption
to indicate its scenario rules are active; see enum value javadocs.
Not all scenario-related rules changes have or need an event. For example, in
_SC_PIRI
, the Knight/Soldier card is used only to
convert ships to warships. This happens every time the card is played, so there's
no event for it. The game/server logic for playing dev cards checks for _SC_PIRI
right there, instead of code elsewhere in an event listener. However, in
_SC_SANY
, the player will sometimes get an
SVP for settling a new island; it doesn't happen each time the player builds a settlement.
So, a scenario event communicates the new SVP.
SOCScenarioGameEvent
Enum Constant Summary | |
---|---|
CLOTH_TRADE_ESTABLISHED_VILLAGE
Cloth trade route established with a neutral village . |
|
DEV_CARD_REACHED_SPECIAL_EDGE
Dev Card awarded for reaching a Special Edge that gives that reward (Special Edge type SOCBoardLarge.SPECIAL_EDGE_DEV_CARD ). |
|
PIRI_FORTRESS_RECAPTURED
Player's corresponding pirate fortress ( SOCFortress ) has been recaptured. |
|
REMOVED_TRADE_PORT
Player's ships have reached a "gift" port, and removed that trade port from the board. |
|
SVP_REACHED_SPECIAL_EDGE
Special victory point awarded for reaching a Special Edge that gives that reward (Special Edge type SOCBoardLarge.SPECIAL_EDGE_SVP ). |
|
SVP_SETTLED_ANY_NEW_LANDAREA
Special victory point awarded for first settlement in any land area past the starting land area. |
|
SVP_SETTLED_EACH_NEW_LANDAREA
2 SVP awarded each time player settles in another new land area past the starting land area. |
Field Summary | |
---|---|
int |
flagValue
Value for sending event codes over a network. |
Method Summary | |
---|---|
static SOCScenarioPlayerEvent |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static SOCScenarioPlayerEvent[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final SOCScenarioPlayerEvent SVP_SETTLED_ANY_NEW_LANDAREA
_SC_SANY
.
The new SOCSettlement
will be passed as obj to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
public static final SOCScenarioPlayerEvent SVP_SETTLED_EACH_NEW_LANDAREA
_SC_SEAC
.
The new SOCSettlement
will be passed as obj to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
Because there can be many land areas, this event flag isn't part of
SOCPlayer.getScenarioPlayerEvents()
; instead see
SOCPlayer.getScenarioSVPLandAreas()
.
public static final SOCScenarioPlayerEvent CLOTH_TRADE_ESTABLISHED_VILLAGE
village
.
(Player cannot move the Pirate before Cloth Trade is established.)
Once per player per game, although the player is free to make routes to other villages.
This event flag doesn't immediately give the player an SVP;
players gain VP by having pairs of cloth.
Villages are in a game only if scenario option _SC_CLVI
is set.
public static final SOCScenarioPlayerEvent PIRI_FORTRESS_RECAPTURED
SOCFortress
) has been recaptured.
Scenario option _SC_PIRI
.
The fortress has now been recaptured as a settlement owned by the player.
The new SOCSettlement
will be passed as obj
to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
public static final SOCScenarioPlayerEvent DEV_CARD_REACHED_SPECIAL_EDGE
SOCBoardLarge.SPECIAL_EDGE_DEV_CARD
).
Once the edge is claimed, no other player can be rewarded at that edge, but there are others on the board.
Game option _SC_FTRI
.
The edge coordinate and dev card type will be passed in an IntPair
as obj
to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
The server has the full game state and knows the dev card type revealed. At the client, the event's dev card
type will be SOCDevCardConstants.UNKNOWN
, and the server must send a message to the player's client
with the awarded card type, as if they have just purchased it. Other players' clients will be sent
UNKNOWN
since each player's dev cards in hand are a secret.
At server and at each client, the game will clear the Special Edge's type before firing the event. After the event, for clarity the server will also send a message to the game to clear the edge.
public static final SOCScenarioPlayerEvent SVP_REACHED_SPECIAL_EDGE
SOCBoardLarge.SPECIAL_EDGE_SVP
).
Once the edge is claimed, no other player can be rewarded at that edge, but there are others on the board.
Game option _SC_FTRI
.
The edge coordinate will be passed as obj
to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
At server and at each client, the game will clear the Special Edge's type before firing the event. After the event, for clarity the server will also send a message to the game to clear the edge.
public static final SOCScenarioPlayerEvent REMOVED_TRADE_PORT
_SC_FTRI
.
An IntPair
with the port's edge coordinate and type (in range
MISC_PORT
to WOOD_PORT
) will be passed as obj
to
SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object)
.
If the game state became SOCGame.PLACING_INV_ITEM
, the player must now pick a coastal edge with an adjacent
settlement to place the port. Otherwise the port's been added to their inventory as a SOCInventoryItem
to be placed later when possible. Placement is done (now or later) by calling SOCGame.placePort(int)
.
This event is fired at server only, not at client, in SOCGame.removePort(SOCPlayer, int)
.
The server will send messages to the game's clients about the event's result.
Field Detail |
---|
public final int flagValue
flagValue
can be 0.
Each event code must be a different bit. (0x01, 0x02, 0x04, etc)
Some events happen only once per player, flagValue
is
also used in the player's bitmap field that tracks those
(SOCPlayer.getScenarioPlayerEvents()
).
Method Detail |
---|
public static SOCScenarioPlayerEvent[] values()
for (SOCScenarioPlayerEvent c : SOCScenarioPlayerEvent.values()) System.out.println(c);
public static SOCScenarioPlayerEvent valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |