soc.game
Enum SOCScenarioGameEvent

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

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

Scenario event codes which affect the game or board, not only a specific player. 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, only those that sometimes fire and sometimes don't when a player takes an action. See SOCScenarioPlayerEvent for more details.
Game Event example: Not every hex is a fog hex (SGE_FOG_HEX_REVEALED), so fog isn't revealed every time a player builds a settlement or road. If this happened each time, the scenario-related code might be clearer if it was located at the game/server logic for placing pieces, instead of code elsewhere in an event listener.

Since:
2.0.00
Author:
Jeremy D Monin <jeremy@nand.net>
See Also:
SOCScenarioPlayerEvent

Enum Constant Summary
SGE_CLVI_WIN_VILLAGE_CLOTH_EMPTY
          Special win condition for this scenario: A player has won because less than half the villages have cloth remaining.
SGE_FOG_HEX_REVEALED
          A hex hidden by fog has been revealed by road or ship placement.
SGE_PIRI_LAST_FORTRESS_FLEET_DEFEATED
          The last pirate fortress was recaptured by the current player, and the pirate fleet defeated and removed from the board.
SGE_STARTPLAY_BOARD_SPECIAL_NODES_EMPTIED
          Normal game play is starting at the end of initial placement, and one or more sets of special nodes (Added Layout Parts "N1" - "N9") was emptied out.
 
Field Summary
 int flagValue
          Value for sending event codes over a network.
 
Method Summary
static SOCScenarioGameEvent valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static SOCScenarioGameEvent[] 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

SGE_STARTPLAY_BOARD_SPECIAL_NODES_EMPTIED

public static final SOCScenarioGameEvent SGE_STARTPLAY_BOARD_SPECIAL_NODES_EMPTIED
Normal game play is starting at the end of initial placement, and one or more sets of special nodes (Added Layout Parts "N1" - "N9") was emptied out. Any graphical client should redraw the board to show any remaining sets.

Fired locally at server or client from SOCGame.updateAtGameFirstTurn(), not sent over the network. In SOCScenarioEventListener.gameEvent(SOCGame, SOCScenarioGameEvent, Object), the detail parameter is unused.


SGE_FOG_HEX_REVEALED

public static final SOCScenarioGameEvent SGE_FOG_HEX_REVEALED
A hex hidden by fog has been revealed by road or ship placement. Game option _SC_FOG. Revealing a normal land hex (clay, ore, sheep, wheat, wood) gives the player 1 of that resource immediately.

This event fires only at the server. During initial placement, placing a settlement at a node next to fog could reveal up to 3 hexes. This event fires once for each hex revealed.

In SOCScenarioEventListener.gameEvent(SOCGame, SOCScenarioGameEvent, Object), detail is the revealed hex's coordinate as an Integer.


SGE_CLVI_WIN_VILLAGE_CLOTH_EMPTY

public static final SOCScenarioGameEvent SGE_CLVI_WIN_VILLAGE_CLOTH_EMPTY
Special win condition for this scenario: A player has won because less than half the villages have cloth remaining. The winning player's VP total might be less than SOCGame.vp_winner.

In SOCScenarioEventListener.gameEvent(SOCGame, SOCScenarioGameEvent, Object), detail is the winning SOCPlayer.

Checked in private method SOCGame.checkForWinner_SC_CLVI()


SGE_PIRI_LAST_FORTRESS_FLEET_DEFEATED

public static final SOCScenarioGameEvent SGE_PIRI_LAST_FORTRESS_FLEET_DEFEATED
The last pirate fortress was recaptured by the current player, and the pirate fleet defeated and removed from the board. Triggered by game on server only, not sent to client.

Field Detail

flagValue

public final int flagValue
Value for sending event codes over a network. Each event code must be a different bit. (0x01, 0x02, 0x04, etc) Not all events are sent over a network; local-only events can use 0 for their flagValue.

Method Detail

values

public static SOCScenarioGameEvent[] 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 (SOCScenarioGameEvent c : SOCScenarioGameEvent.values())
    System.out.println(c);

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

valueOf

public static SOCScenarioGameEvent 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