Class Aura
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Entity>,HasDesc<AuraDesc>,HasCard,Trigger
- Direct Known Subclasses:
EffectlessAura,SpellAura
Because auras evaluate which entities they affect on board changes and sequence endings, they aren't affecting
entities the moment they "come into play" (are attached to a host that is Entity.isInPlay()). However, since
a BoardChangedEvent is fired right after a minion is put on the Spellsource.ZonesMessage.Zones.BATTLEFIELD during a GameLogic.summon(int, Minion, Entity, int, boolean) call, in practice auras come
into play immediately. Specifically, a minion with an aura written on it will not be affecting entities by the BeforeSummonEvent event, but only by the first BoardChangedEvent (which
comes before any battlecries are resolved or before control is given back to the player).
Auras have the following format (corresponding to AuraDesc):
{
"class": An Aura class. When the class is Aura, the apply and remove effects below are used. Otherwise,
for classes like BuffAura, the apply and remove effects are provided by the class.
"target": An EntityReference for all the entities affected by this aura
"filter": A filter on those entities. Evaluated against every target entity in the
"target" specified.
"applyEffect": A SpellDesc that corresponds to the spell to cast on a given entity when it transitions
from being unaffected to affected by this aura. The target is the entity newly under
the influence of the aura and source is the EntityReference.TRIGGER_HOST /
host of the aura.
"removeEffect": A SpellDesc that corresponds to the spell to cast on an entity when it was previously
affected and it is now transitioning into not being affected. The target is the
entity newly under the influence of the aura and source is the
EntityReference.TRIGGER_HOST / host of the aura.
"condition": A condition that is evaluated whenever the BoardChangedEvent is raised; the
WillEndSequenceEvent is raised; or "secondaryTrigger" is fired, against every entity that
could be or currently is affected by this aura. When the condition is true, the entity that is
affected remains affected; the entity that could not be affected is affected. When false, the entity
that is affected stops being affected, and an entity that is not yet affected will still not be
affected. target in the condition will be the entity, and source will be the
EntityReference.TRIGGER_HOST / host of the aura.
"secondaryTrigger": Another trigger that, when fired, will cause this aura to reevaluate which entities are
affected. EntityReference.EVENT_TARGET will correspond to the
GameEvent.getTarget() processed by that trigger.
}
An aura is not an abstract class; it can be directly specified using an AuraDesc with a specific
AuraArg.APPLY_EFFECT and AuraArg.REMOVE_EFFECT. The remove effect should reverse the consequences of
the add effect. Since this is challenging to come up with without a background in software engineering, the BuffAura and AttributeAura should cover most cases of ongoing effects correctly.
The onGameEvent(GameEvent) method actually implements the evaluation of the condition, the filter, the
target and the add/remove effects. Observe that unlike an Enchantment, which it inherits, auras do not
respect configuration features like Enchantment.getMaxFires(). It is unclear how such features should be interpreted.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static EventTriggerDesc[]protected static EventTriggerDesc[]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, zonesFields inherited from class net.demilich.metastone.game.entities.Entity
attributes, effectSource, entityLocation, name, NO_OWNER, sourceCard -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected booleanprotected voidapplyAuraEffect(GameContext context, Entity target) protected voidclone()Clone an entity, including its ID and location.voidexpire(GameContext context) Expires the trigger; marks it for removal and prevents it from executing in the future.getCopy()protected EventTriggerDesc[]getDesc()Gets the possibly modified description of the entity to render to the end user.getName()Gets the name of the entity (typically the name of the card that created this entity).protected EntityReferencebooleanIndicates this trigger cannot change owners.protected booleannotApplied(Entity target) voidonAdd(GameContext context, Player player, Entity source, Entity host) Called when the trigger is added into aGameContext's state.voidonGameEvent(GameEvent event) Handles an event this triggerTrigger.queues(GameEvent)for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).protected voidremoveAuraEffect(GameContext context, Entity target) voidMethods 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, toStringMethods 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
-
Field Details
-
DEFAULT_TRIGGERS
-
EMPTY_TRIGGERS
-
-
Constructor Details
-
Aura
-
-
Method Details
-
getDefaultTriggers
- Overrides:
getDefaultTriggersin classEnchantment
-
getName
Description copied from class:EntityGets the name of the entity (typically the name of the card that created this entity). Or, overridden by theAttribute.NAMEattribute set in this entity's attributes. -
getCopy
- Overrides:
getCopyin classEnchantment
-
getDescription
Description copied from class:EntityGets the possibly modified description of the entity to render to the end user.- Overrides:
getDescriptionin classEntity- Returns:
- The
Entity.getSourceCard()'sCard.getDescription()field, or the value specified inAttribute.DESCRIPTION.
-
affects
protected boolean affects(GameContext context, Player player, Entity target, List<Entity> resolvedTargets) -
clone
Description copied from class:EntityClone 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.- Specified by:
clonein interfaceTrigger- Overrides:
clonein classEnchantment- Returns:
- An exact clone.
-
onAdd
Description copied from interface:TriggerCalled when the trigger is added into aGameContext's state.- Specified by:
onAddin interfaceTrigger- Overrides:
onAddin classEnchantment- Parameters:
context- The game context.
-
onGameEvent
Description copied from interface:TriggerHandles an event this triggerTrigger.queues(GameEvent)for and isTrigger.interestedIn(com.hiddenswitch.spellsource.rpc.Spellsource.GameEventTypeMessage.GameEventType).- Specified by:
onGameEventin interfaceTrigger- Overrides:
onGameEventin classEnchantment- Parameters:
event- The game event this trigger is now processing.
-
getTargets
-
applied
-
notApplied
-
removeAuraEffect
-
applyAuraEffect
-
expire
Description copied from interface:TriggerExpires the trigger; marks it for removal and prevents it from executing in the future.- Specified by:
expirein interfaceTrigger- Overrides:
expirein classEnchantment
-
getEntityFilter
-
getCondition
-
getDesc
-
setDesc
-
getAffectedEntities
-
isPersistentOwner
public boolean isPersistentOwner()Description copied from interface:TriggerIndicates this trigger cannot change owners. For example, aSecretdoes not have a persistent owner, because card texts can steal secrets. However, the trigger described by Blessing of Wisdom does have a persistent owner, since the casting player of that spell should always draw the card it receives.- Specified by:
isPersistentOwnerin interfaceTrigger- Overrides:
isPersistentOwnerin classEnchantment- Returns:
trueif the trigger'sTrigger.onGameEvent(GameEvent)should be evaluated from the point of view of the owner when the trigger was created, as opposed to what the owner is right now (which may have changed).
-
getSecondaryTarget
-
getApplyAuraEffect
-
getRemoveAuraEffect
-
cast
- Overrides:
castin classEnchantment
-