Interface Trigger
- All Superinterfaces:
Serializable
- 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
-
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the trigger with any internal state.voidexpire(GameContext context) Expires the trigger; marks it for removal and prevents it from executing in the future.default booleanReturnstrueif the trigger fire in response to the givenGameEvent.Gets a reference to theEntitythat is "hosting," or owning, the trigger.intgetOwner()Gets the player who owns this trigger.booleaninterestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType eventType) Returns true if this trigger is a listener for the givenSpellsource.GameEventTypeMessage.GameEventType.booleanbooleanChecks if, due to the execution of possibly complex rules inside or outside the trigger, the trigger is expired (no longer should fire).booleanIndicates this trigger cannot change owners.voidonAdd(GameContext context, Player player, Entity source, Entity host) Called when the trigger is added into aGameContext's state.booleanIndicates this trigger is only active for the current turn, then it shouldexpire(GameContext).voidonGameEvent(GameEvent event) Handles an event this triggerqueues(GameEvent)for and isinterestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).booleanChecks if a trigger should queue in response to a specific event.voidsetHostReference(EntityReference entityReference) Sets or changes theEntitythat is the owner / host of this trigger.voidsetOwner(int playerIndex) Sets the player who is the owner of this trigger.
-
Method Details
-
clone
Trigger clone()Clones the trigger with any internal state.- Returns:
- A clone of this trigger.
-
queues
Checks if a trigger should queue in response to a specific event.- Parameters:
event- A game event.- Returns:
trueif the trigger should queue in response to this event.
-
getHostReference
EntityReference getHostReference()Gets a reference to theEntitythat is "hosting," or owning, the trigger.- Returns:
- An entity reference. This is typically not null.
-
getOwner
int getOwner()Gets the player who owns this trigger.- Returns:
GameContext.PLAYER_1orGameContext.PLAYER_2.
-
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).- Returns:
trueif the trigger should be removed and will no longer fire.
-
onAdd
Called when the trigger is added into aGameContext's state.- Parameters:
context- The game context.player-source-host-
-
onGameEvent
Handles an event this triggerqueues(GameEvent)for and isinterestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).- Parameters:
event- The game event this trigger is now processing.
-
setHostReference
Sets or changes theEntitythat is the owner / host of this trigger.- Parameters:
entityReference- The hostEntity/
-
setOwner
void setOwner(int playerIndex) Sets the player who is the owner of this trigger.- Parameters:
playerIndex-GameContext.PLAYER_1orGameContext.PLAYER_2.
-
isPersistentOwner
boolean isPersistentOwner()Indicates this trigger cannot change owners. For example, aSecretdoes 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.- Returns:
trueif the trigger'sonGameEvent(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 shouldexpire(GameContext).- Returns:
trueif this is a one-turn long trigger.
-
expire
Expires the trigger; marks it for removal and prevents it from executing in the future.- Parameters:
context-
-
fires
Returnstrueif the trigger fire in response to the givenGameEvent.It is already queued in this situation.
- Parameters:
event- The currently raised event.- Returns:
trueif the trigger can fire.
-
isActivated
boolean isActivated()
-