Class SpellDesc

All Implemented Interfaces:
Serializable, Cloneable, Map<SpellArg,Object>, HasDesc<Desc<SpellArg,Spell>>, HasEntrySet<SpellArg,Object>, AbstractEnchantmentDesc<Aftermath>
Direct Known Subclasses:
LambdaSpellDesc

public class SpellDesc extends Desc<SpellArg,Spell> implements AbstractEnchantmentDesc<Aftermath>
A definition for a spell.

A spell description has a variety of arguments of type SpellArg. Each SpellArg is transformed into a "camelCase" form and become the keys of the JSON version of an instance.

For example, the following JSON implements the spell effect, "Summon a Bloodfen Raptor. Summon an extra one for each attack your Hero has.":

     {
         "class": "SummonSpell",
         "card": "minion_bloodfen_raptor",
         "value": {
             "class": "AttributeValueProvider",
             "target": "FRIENDLY_HERO",
             "attribute": "ATTACK",
             "offset": 1
         }
     }
 
This JSON would deserialize into a SpellDesc instance that would equal the following code:
   
      final Map<SpellArg, Object> arguments = SpellDesc.build(SummonSpell.class);
      arguments.put(SpellArg.CARD, "minion_bloodfen_raptor");
      final Map<ValueProviderArg, Object> valueProvider = ValueProviderDesc.build(AttributeValueProvider.class);
      valueProvider.put(ValueProviderArg.TARGET, EntityReference.FRIENDLY_HERO);
      valueProvider.put(ValueProviderArg.ATTRIBUTE, Attribute.ATTACK);
      valueProvider.put(ValueProviderArg.OFFSET, 1);
      arguments.put(SpellArg.VALUE, new ValueProviderDesc(valueProvider).createInstance());
      SpellDesc spellDesc = new SpellDesc(arguments);
   
 
Notice that the keys of the objects in the JSON are transformed, "camelCase", from the names in the enum in SpellArg. Deathrattles

This class also describes an actor's deathrattle.

The spell here is cast with the dying minion as the source (e.g., EntityReference.SELF will refer to the now-destroyed minion).

Deathrattles are resolved whenever an actor is destroyed before an GameLogic.endOfSequence() occurs, which is generally at the end of any action besides discovering.

See Also: