soc.game
Enum SOCScenarioPlayerEvent

java.lang.Object
  extended by java.lang.Enum<SOCScenarioPlayerEvent>
      extended by soc.game.SOCScenarioPlayerEvent
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SOCScenarioPlayerEvent>

public enum SOCScenarioPlayerEvent
extends java.lang.Enum<SOCScenarioPlayerEvent>

Per-player scenario event codes. Used by SOCScenarioEventListeners. 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.

Since:
2.0.00
Author:
Jeremy D Monin <jeremy@nand.net>
See Also:
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

SVP_SETTLED_ANY_NEW_LANDAREA

public static final SOCScenarioPlayerEvent SVP_SETTLED_ANY_NEW_LANDAREA
Special victory point awarded for first settlement in any land area past the starting land area. Once per player per game (not once per player in each other land area). Game option _SC_SANY.

The new SOCSettlement will be passed as obj to SOCScenarioEventListener.playerEvent(SOCGame, SOCPlayer, SOCScenarioPlayerEvent, boolean, Object).


SVP_SETTLED_EACH_NEW_LANDAREA

public static final SOCScenarioPlayerEvent SVP_SETTLED_EACH_NEW_LANDAREA
2 SVP awarded each time player settles in another new land area past the starting land area. Once per area per player per game. Game option _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().


CLOTH_TRADE_ESTABLISHED_VILLAGE

public static final SOCScenarioPlayerEvent CLOTH_TRADE_ESTABLISHED_VILLAGE
Cloth trade route established with a neutral 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.


PIRI_FORTRESS_RECAPTURED

public static final SOCScenarioPlayerEvent PIRI_FORTRESS_RECAPTURED
Player's corresponding pirate fortress (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).


DEV_CARD_REACHED_SPECIAL_EDGE

public static final SOCScenarioPlayerEvent 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). 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.


SVP_REACHED_SPECIAL_EDGE

public static final SOCScenarioPlayerEvent SVP_REACHED_SPECIAL_EDGE
Special victory point awarded for reaching a Special Edge that gives that reward (Special Edge type 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.


REMOVED_TRADE_PORT

public static final SOCScenarioPlayerEvent REMOVED_TRADE_PORT
Player's ships have reached a "gift" port, and removed that trade port from the board. It must be placed elsewhere now or later. Occurs only in scenario game option _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

flagValue

public final int flagValue
Value for sending event codes over a network. Not all player events are sent over the network; if not sent, event's 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

values

public static SOCScenarioPlayerEvent[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SOCScenarioPlayerEvent c : SOCScenarioPlayerEvent.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SOCScenarioPlayerEvent valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null