Class StatefulAttributeValueAura
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Entity>
,HasDesc<AuraDesc>
,HasCard
,Trigger
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:
-
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 TypeMethodDescriptionprotected void
applyAuraEffect
(GameContext context, Entity target) clone()
Clone an entity, including its ID and location.protected Attribute
void
onGameEvent
(GameEvent event) Handles an event this triggerTrigger.queues(GameEvent)
for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType)
.protected void
removeAuraEffect
(GameContext context, Entity target) 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, cast, expire, getAffectedEntities, getCondition, getCopy, getDefaultTriggers, getDesc, getDescription, getEntityFilter, getName, getSecondaryTarget, getTargets, isPersistentOwner, notApplied, onAdd, 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
-
StatefulAttributeValueAura
-
-
Method Details
-
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. -
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 classAura
- Parameters:
event
- The game event this trigger is now processing.
-
applyAuraEffect
- Overrides:
applyAuraEffect
in classAura
-
removeAuraEffect
- Overrides:
removeAuraEffect
in classAura
-
getAttribute
-