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, zones
Fields inherited from class net.demilich.metastone.game.entities.Entity
attributes, effectSource, entityLocation, name, NO_OWNER, sourceCard
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
appliesTo
(GameContext context, Card card, Player player) Determines whether this modifier applies to the specified card.clone()
Clone an entity, including its ID and location.boolean
interestedIn
(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType eventType) Returns true if this trigger is a listener for the givenSpellsource.GameEventTypeMessage.GameEventType
.void
onGameEvent
(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, targetsSelf
Methods 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, toString
Methods 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:CardCostModifier
Determines whether this modifier applies to the specified card.First, the method checks if the modifier has been
Enchantment.expired
due to itsCardCostModifierArg.EXPIRATION_TRIGGER
. For aOneTurnCostModifier
, the expiration trigger is assumed to be aTurnEndTrigger
.Then, the modifier evaluates its
CardCostModifierArg.TARGET
andCardCostModifierArg.FILTER
and sees if the card is equal to or is contained within the resulting set ofEntity
objects. When not specified, theCardCostModifierArg.TARGET
is assumed to be theEntityReference.FRIENDLY_HAND
.The
CardCostModifierArg.RACE
argument, if specified, is compared to thecard
instance'sCard.getRace()
.The
CardCostModifierArg.CARD_TYPE
argument, if specified, is compared to thecard
instance'sCard.getCardType()
.Finally, the
CardCostModifierArg.TARGET_PLAYER
argument, if specified, is compared to thecard
instance'sEntity.getOwner()
with respect to theEnchantment.getHostReference()
of this modifier. For example, ifCardCostModifierArg.TARGET_PLAYER
isTargetPlayer.SELF
, then the card'sEntity.getOwner()
is compared to theEnchantment.getHostReference()
Entity.getOwner()
.- Overrides:
appliesTo
in classCardCostModifier
- Parameters:
context
- The game context.card
- The card to evaluate.player
- The player from whose point of view this should be evaluated.- Returns:
true
if the modifier applies to this card.
-
clone
Description copied from class:Entity
Clone 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:
clone
in interfaceTrigger
- Overrides:
clone
in classCardCostModifier
- Returns:
- An exact clone.
-
onGameEvent
Description copied from interface:Trigger
Handles an event this triggerTrigger.queues(GameEvent)
for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType)
.- Specified by:
onGameEvent
in interfaceTrigger
- Overrides:
onGameEvent
in classEnchantment
- Parameters:
event
- The game event this trigger is now processing.
-