Class GameEvent

java.lang.Object
net.demilich.metastone.game.events.GameEvent
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Notification
Direct Known Subclasses:
BasicGameEvent, JoustEvent

public abstract class GameEvent
extends java.lang.Object
implements Notification, java.lang.Cloneable
The base class for game events, or things that happen during the execution of a GameAction that other game rules may react to.

A null source will resolve to the EntityReference.TRIGGER_HOST when evaluating queueing and firing conditions.

See Also:
for how to use game events to implement card text., for how game events are fired., Serialized Form
  • Constructor Details

  • Method Details

    • getSource

      public Entity getSource()
      Description copied from interface: Notification
      For visualization purposes, what is the source of this notification?
      Specified by:
      getSource in interface Notification
      Returns:
      A reference to the entity that is the visualizable source of this notification.
    • getTarget

      public Entity getTarget()
    • getTargets

      public java.util.List<Entity> getTargets​(GameContext context, int player)
      Description copied from interface: Notification
      For visualization purposes, what are the targets of this notification?
      Specified by:
      getTargets in interface Notification
      Parameters:
      context - game context
      player - the player
      Returns:
      A reference to the entity that is the visualizable target of this notification.
    • getEventType

      public abstract com.hiddenswitch.spellsource.client.models.GameEvent.EventTypeEnum getEventType()
    • getGameContext

      public GameContext getGameContext()
    • getTargetPlayerId

      public int getTargetPlayerId()
    • getSourcePlayerId

      public int getSourcePlayerId()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • isPowerHistory

      public boolean isPowerHistory()
      Description copied from interface: Notification
      When true, indicates to processors of this notification that it belongs in the power history.
      Specified by:
      isPowerHistory in interface Notification
      Returns:
      true if this notification should be stored in the power history of the game where it occurred.
    • getDescription

      public java.lang.String getDescription​(GameContext context, int playerId)
      Description copied from interface: Notification
      A user-renderable description of what occurred in this notification.
      Specified by:
      getDescription in interface Notification
      Parameters:
      context - the game context
      playerId - the player ID
      Returns:
      a description string
    • clone

      protected GameEvent clone()
      Overrides:
      clone in class java.lang.Object