Interface Trigger

All Superinterfaces:
All Known Implementing Classes:
AbstractFriendlyCardAura, Aftermath, AttributeAura, AttributeValueAura, Aura, BuffAura, CaptnCookishAura, CardAura, CardCostInsteadAura, CardCostModifier, ChooseOneOverrideAura, DiscoverNotSelectedSpellBonusAura, DoubleBattlecriesAura, DoubleCombosAura, DoubleDeathrattlesAura, DoubleTurnEndTriggersAura, EffectlessAura, Enchantment, EnrageAura, GatekeeperShaAura, HeroPowerBonusAura, HoardingWhelpAura, IncorruptibilityAura, LifedrainGrantsArmorInsteadAura, LifedrainHealsAdditionalAura, MenagerieMogulAura, ModifyBuffSpellAura, ModifyTemporaryAttackSpellAura, NoggenfoggerAura, OneTurnCostModifier, Opener, PhysicalAttackTargetOverrideAura, Quest, ReservoirsAlwaysActiveAura, ReservoirsNeverActiveAura, Secret, SecretsTriggerTwiceAura, SpecificCardFilterOverrideAura, SpellAura, SpellEffectsCastTwiceAura, SpellOverrideAura, SpellsCastThriceAura, SpellsCastTwiceAura, SpellTargetsAdjacentAura, StatefulAttributeValueAura, SupremaciesTriggerTwiceAura, SupremacyBonusEffectAura, TargetSelectionOverrideAura, TheliaSilentdreamerAura, ToggleCostModifier, WhereverTheyAreEnchantment

public interface Trigger
Triggers respond to GameEvent objects that are raised by various GameLogic methods, implementing cards that do something when something else happens.
See Also:
for an implementation that casts a spell when an event is raised. Most trigger effects behave like this.
  • Method Details

    • clone

      Trigger clone()
      Clones the trigger with any internal state.
      A clone of this trigger.
    • queues

      @Suspendable boolean queues​(GameEvent event)
      Checks if a trigger should queue in response to a specific event.
      event - A game event.
      true if the trigger should queue in response to this event.
    • getHostReference

      EntityReference getHostReference()
      Gets a reference to the Entity that is "hosting," or owning, the trigger.
      An entity reference. This is typically not null.
    • getOwner

      int getOwner()
      Gets the player who owns this trigger.
      GameContext.PLAYER_1 or GameContext.PLAYER_2.
    • interestedIn

      boolean interestedIn​(com.hiddenswitch.spellsource.client.models.GameEvent.EventTypeEnum eventType)
      Returns true if this trigger is a listener for the given GameEvent.EventTypeEnum.
      eventType - The event type.
      true if this trigger wants its onGameEvent(GameEvent) method called whenever it queues(GameEvent) to the specified eventType.
    • isExpired

      boolean isExpired()
      Checks if, due to the execution of possibly complex rules inside or outside the trigger, the trigger is expired (no longer should fire).
      true if the trigger should be removed and will no longer fire.
    • onAdd

      @Suspendable void onAdd​(GameContext context, Player player, Entity source, Entity host)
      Called when the trigger is added into a GameContext's state.
      context - The game context.
      player -
      source -
      host -
    • onGameEvent

      @Suspendable void onGameEvent​(GameEvent event)
      event - The game event this trigger is now processing.
    • setHostReference

      void setHostReference​(EntityReference entityReference)
      Sets or changes the Entity that is the owner / host of this trigger.
      entityReference - The host Entity/
    • setOwner

      void setOwner​(int playerIndex)
      Sets the player who is the owner of this trigger.
      playerIndex - GameContext.PLAYER_1 or GameContext.PLAYER_2.
    • isPersistentOwner

      boolean isPersistentOwner()
      Indicates this trigger cannot change owners. For example, a Secret does not have a persistent owner, because card texts can steal secrets. However, the trigger described by Blessing of Wisdom does have a persistent owner, since the casting player of that spell should always draw the card it receives.
      true if the trigger's onGameEvent(GameEvent) should be evaluated from the point of view of the owner when the trigger was created, as opposed to what the owner is right now (which may have changed).
    • oneTurnOnly

      boolean oneTurnOnly()
      Indicates this trigger is only active for the current turn, then it should expire(GameContext).
      true if this is a one-turn long trigger.
    • expire

      @Suspendable void expire​(GameContext context)
      Expires the trigger; marks it for removal and prevents it from executing in the future.
      context -
    • fires

      @Suspendable default boolean fires​(GameEvent event)
      Returns true if the trigger fire in response to the given GameEvent.

      It is already queued in this situation.

      event - The currently raised event.
      true if the trigger can fire.
    • isActivated

      boolean isActivated()