Class CardCostInsteadAura

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Entity>, HasDesc<AuraDesc>, HasCard, Trigger

public class CardCostInsteadAura extends EffectlessAura
When this is in play, the player can only afford to play a card if 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:
  • Constructor Details

    • CardCostInsteadAura

      public CardCostInsteadAura(AuraDesc desc)
  • Method Details