Class CardCostInsteadAura
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Entity>
,HasDesc<AuraDesc>
,HasCard
,Trigger
AuraArg.CAN_AFFORD_CONDITION
is met. If it
is, the AuraArg.PAY_EFFECT
will be cast with the card as the target
.
To use the mana cost in the pay affect, use a ManaCostProvider
.
Some effects like Attribute.INVOKE
need to know how much "currency" (mana or whatever) you have to spend is.
Specify the current amount of currency using AuraArg.AMOUNT_OF_CURRENCY
.
Currently, legacy card cost substitution effects like paying for spells or murlocs using health (Attribute.MURLOCS_COST_HEALTH
, Attribute.SPELLS_COST_HEALTH
and Attribute.COSTS_HEALTH_INSTEAD_OF_MANA
and Attribute.AURA_COSTS_HEALTH_INSTEAD_OF_MANA
) take precedence over
any CardCostInsteadAura
.
For example, to make the player pay for a card by milling cards:
{ "class": "CardCostInsteadAura", "target": "FRIENDLY_HAND", "amountOfCurrency": { "class": "EntityCountValueProvider", "target": "FRIENDLY_DECK" }, "canAffordCondition": { "class": "ComparisonCondition", "operation": "GREATER_OR_EQUAL", "value1": { "class": "EntityCountValueProvider", "target": "FRIENDLY_DECK" }, "value2": { "class": "ManaCostProvider" } }, "payEffect": { "class": "RoastSpell", "value": { "class": "ManaCostProvider" } } }Observe
"amountOfCurrency"
returns the number of cards in the deck, because that's the amount of cards
available to roast.
To put this aura into "play" while the host card is ordinarily in the hand, use a passive trigger to put the aura onto the player entity. For example, suppose we had a card "spell_cheap_damage", a cost 2 that reads: "Deal $6 damage. Pay for this by destroying random friendly minions instead of spending mana.":
"baseManaCost": 2, "spell": { "class": "MetaSpell", "spells": [ { "class": "DamageSpell", "value": 6 }, { "class": "RemoveEnchantmentSpell", "target": "FRIENDLY_PLAYER", "card": "spell_cheap_damage", "howMany": 1 } ] }, "passiveTriggers": { "eventTrigger": { "class": "CardReceivedTrigger", "hostTargetType": "IGNORE_OTHER_TARGETS" }, "spell": { "class": "AddEnchantmentSpell", "target": "FRIENDLY_PLAYER", "aura": { "class": "CardCostInsteadAura", "target": "FRIENDLY_HAND", "filter": { "class": "SpecificCardFilter", "card": "spell_cheap_damage" }, "amountOfCurrency": { "class": "EntityCountValueProvider", "target": "FRIENDLY_MINIONS" }, "canAffordCondition": { "class": "ComparisonCondition", "operation": "GREATER_OR_EQUAL", "value1": { "class": "EntityCountValueProvider", "target": "FRIENDLY_MINIONS" }, "value2": { "class": "ManaCostProvider" } }, "payEffect": { "class": "RecastWhileSpell", "howMany": { "class": "ManaCostProvider" }, "spell": { "class": "DestroySpell", "target": "FRIENDLY_MINIONS", "randomTarget": true } } } } }Observe that a passive trigger adds an aura to the friendly player. This aura implements the cost substitution. Then, whenever the card is cast, removes just one instance of the aura from the friendly player.
- See Also:
-
Field Summary
Fields inherited from class net.demilich.metastone.game.spells.aura.Aura
DEFAULT_TRIGGERS, EMPTY_TRIGGERS
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 TypeMethodDescriptionint
getAmountOfCurrency
(GameContext context, Player player, Entity target, Entity host) Methods inherited from class net.demilich.metastone.game.spells.aura.EffectlessAura
getApplyAuraEffect, getRemoveAuraEffect
Methods inherited from class net.demilich.metastone.game.spells.aura.Aura
affects, applied, applyAuraEffect, cast, clone, expire, getAffectedEntities, getCondition, getCopy, getDefaultTriggers, getDesc, getDescription, getEntityFilter, getName, getSecondaryTarget, getTargets, isPersistentOwner, notApplied, onAdd, onGameEvent, removeAuraEffect, setDesc
Methods inherited from class net.demilich.metastone.game.spells.trigger.Enchantment
activate, endOfSequence, fires, getActivationTriggers, getCountUntilCast, getDefaultBattlefieldZones, getDefaultBattlefieldZonesSet, getDefaultDeckZones, getDefaultGameZones, getDefaultPassiveZones, getDefaultZones, getEntityType, getEntrySet, getExpirationTriggers, getFires, getHostReference, getMaxFires, getMaxFiresPerSequence, getOneTurn, getSourceCard, getSpell, getTriggers, getUsesSpellTrigger, getZones, innerQueues, interestedIn, 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, shouldNotifyEnchantmentFired, toString
Methods inherited from class net.demilich.metastone.game.entities.Entity
compareTo, diedOnBattlefield, evaluateDescriptions, getAttribute, getAttributes, getAttributeValue, getAttributeValue, getCardInventoryId, getCopySource, getDescription, getDynamicDescription, getEffectSource, getEntityLocation, getGameTriggers, getId, getIndex, getMaxNumberOfAttacks, 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
-
CardCostInsteadAura
-
-
Method Details
-
getAmountOfCurrency
-
getCanAffordCondition
-
getPayEffect
-