Class StatefulAttributeValueAura

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

public final class StatefulAttributeValueAura extends EffectlessAura
This class maintains a stateful aura for an Attribute, increasing or decreasing its value by the appropriate amount whenever the main aura triggers (WillEndSequenceTrigger and BoardChangedTrigger) fire and any additional triggers in AuraArg.TRIGGERS fire. The target value that should be contributed by this aura to the attribute's value is determined by AuraArg.VALUE at the time that any of its triggers fire.

For example, suppose you want to provide an attack bonus that changes over time: "Has +1 Attack for each other friendly minion on the battlefield." If you used an BuffAura, the amount that the buff increases may differ from thea mount the buff decreases throughout the lifetime of the aura, due to the consequences of recalculating the number of minions on the battlefield at different times. This would be incorrect. Instead, use this aura:

   "aura": {
     "class": "StatefulAttributeValueAura",
     "attribute": "AURA_ATTACK_BONUS",
     "value": {
       "class": "EntityCountValueProvider",
       "target": "OTHER_FRIENDLY_MINIONS"
     },
     "target": "SELF"
   }
 
Observe that the amount that should be buffed is equal to the value.

Consider this more complex example: "Has +1 Attack for each damage your hero has taken this turn." This value should be reevaluated whenever a turn starts and whenever the owner's hero has taken damage. We'll add triggers to the AuraArg.TRIGGERS array to cause the aura to update whenever those events occur.

   "aura": {
     "class": "StatefulAttributeValueAura",
     "attribute": "AURA_ATTACK_BONUS",
     "value": {
       "class": "AttributeValueProvider",
       "attribute": "DAMAGE_THIS_TURN",
       "target": "FRIENDLY_HERO"
     },
     "target": "SELF",
     "triggers": [
       {
         "class": "TurnStartTrigger",
         "targetPlayer": "BOTH"
       },
       {
         "class": "DamageReceivedTrigger",
         "targetEntityType": "HERO",
         "targetPlayer": "SELF"
       }
     ]
   }
 
See Also: