Class ToggleCostModifier
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Entity>,HasDesc<CardCostModifierDesc>,HasCard,Trigger
CardCostModifierArg.TOGGLE_ON_TRIGGER and CardCostModifierArg.TOGGLE_OFF_TRIGGER triggers fire.- See Also:
-
Field Summary
Fields inherited from class net.demilich.metastone.game.spells.trigger.Enchantment
activated, activationTriggers, added, copyToActor, countByValue, countUntilCast, expirationTriggers, expired, firesThisSequence, hostReference, keepAfterTransform, maxFiresPerSequence, oneTurn, persistentOwner, spell, triggers, usesSpellTrigger, zonesFields inherited from class net.demilich.metastone.game.entities.Entity
attributes, effectSource, entityLocation, name, NO_OWNER, sourceCard -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanappliesTo(GameContext context, Card card, Player player) Determines whether this modifier applies to the specified card.clone()Clone an entity, including its ID and location.booleaninterestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType eventType) Returns true if this trigger is a listener for the givenSpellsource.GameEventTypeMessage.GameEventType.voidonGameEvent(GameEvent event) Handles an event this triggerTrigger.queues(GameEvent)for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).Methods inherited from class net.demilich.metastone.game.cards.costmodifier.CardCostModifier
cast, get, getCardType, getDefaultTriggers, getDefaultZones, getDesc, getFilter, getMinValue, getRequiredAttribute, getRequiredRace, getTargetPlayer, isPersistentOwner, onAdd, process, setDesc, shouldNotifyEnchantmentFired, targetsSelfMethods inherited from class net.demilich.metastone.game.spells.trigger.Enchantment
activate, endOfSequence, expire, fires, getActivationTriggers, getCopy, getCountUntilCast, getDefaultBattlefieldZones, getDefaultBattlefieldZonesSet, getDefaultDeckZones, getDefaultGameZones, getDefaultPassiveZones, getEntityType, getEntrySet, getExpirationTriggers, getFires, getHostReference, getMaxFires, getMaxFiresPerSequence, getOneTurn, getSourceCard, getSpell, getTriggers, getUsesSpellTrigger, getZones, innerQueues, isActivated, isCopyToActor, isCountByValue, isExpired, isKeptAfterTransform, oneTurnOnly, process, queues, setActivated, setActivationTriggers, setCopyToActor, setCountByValue, setCountUntilCast, setExpirationTriggers, setFires, setHostReference, setKeepAfterTransform, setMaxFires, setMaxFiresPerSequence, setOneTurn, setPersistentOwner, setSpell, setTriggers, setUsesSpellTrigger, setZones, toStringMethods inherited from class net.demilich.metastone.game.entities.Entity
compareTo, diedOnBattlefield, evaluateDescriptions, getAttribute, getAttributes, getAttributeValue, getAttributeValue, getCardInventoryId, getCopySource, getDescription, getDescription, getDynamicDescription, getEffectSource, getEntityLocation, getGameTriggers, getId, getIndex, getMaxNumberOfAttacks, getName, getOwner, getRace, getReference, getUserId, getZone, hasAttribute, hasPersistentEffects, isDestroyed, isInPlay, isRemovedPeacefully, modifyAttribute, modifyHpBonus, moveOrAddTo, moveOrAddTo, resetEntityLocations, setAttribute, setAttribute, setAttribute, setDescription, setEffectSource, setEntityLocation, setId, setName, setOwner, setSourceCard, setUserId, transformResolved, transformResolved
-
Constructor Details
-
ToggleCostModifier
-
-
Method Details
-
appliesTo
Description copied from class:CardCostModifierDetermines whether this modifier applies to the specified card.First, the method checks if the modifier has been
Enchantment.expireddue to itsCardCostModifierArg.EXPIRATION_TRIGGER. For aOneTurnCostModifier, the expiration trigger is assumed to be aTurnEndTrigger.Then, the modifier evaluates its
CardCostModifierArg.TARGETandCardCostModifierArg.FILTERand sees if the card is equal to or is contained within the resulting set ofEntityobjects. When not specified, theCardCostModifierArg.TARGETis assumed to be theEntityReference.FRIENDLY_HAND.The
CardCostModifierArg.RACEargument, if specified, is compared to thecardinstance'sCard.getRace().The
CardCostModifierArg.CARD_TYPEargument, if specified, is compared to thecardinstance'sCard.getCardType().Finally, the
CardCostModifierArg.TARGET_PLAYERargument, if specified, is compared to thecardinstance'sEntity.getOwner()with respect to theEnchantment.getHostReference()of this modifier. For example, ifCardCostModifierArg.TARGET_PLAYERisTargetPlayer.SELF, then the card'sEntity.getOwner()is compared to theEnchantment.getHostReference()Entity.getOwner().- Overrides:
appliesToin classCardCostModifier- Parameters:
context- The game context.card- The card to evaluate.player- The player from whose point of view this should be evaluated.- Returns:
trueif the modifier applies to this card.
-
clone
Description copied from class:EntityClone an entity, including its ID and location.Use this method for emulating an "immutable" view on an entity. This kind of cloning is not suitable for most gameplay situations, because using the clone will cause two entities with identical IDs and locations to exist. Instead, a subclass will provide a
getCopy()method that is more helpful for gameplay.- Specified by:
clonein interfaceTrigger- Overrides:
clonein classCardCostModifier- Returns:
- An exact clone.
-
onGameEvent
Description copied from interface:TriggerHandles an event this triggerTrigger.queues(GameEvent)for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).- Specified by:
onGameEventin interfaceTrigger- Overrides:
onGameEventin classEnchantment- Parameters:
event- The game event this trigger is now processing.
-