Class EnchantmentDesc
- All Implemented Interfaces:
Serializable
,Cloneable
,HasEntrySet<EnchantmentDescArg,
,Object> AbstractEnchantmentDesc<Enchantment>
EnchantmentDesc
is expected.
In other words, an EnchantmentDesc looks like:
{ "eventTrigger": { An object corresponding to anEventTriggerDesc
} "spell": { An object corresponding to aSpellDesc
} "oneTurn": A boolean indicating that this Enchantment lasts one turn. "maxFires": The maximum number of times this enchantment will fire until it expires. "countUntilCast": The minimum number of times this enchantment must fire until its spell is cast "persistentOwner": SeepersistentOwner
"keepAfterTransform": SeekeepAfterTransform
"countByValue": SeecountByValue
}
This object is used to create an Enchantment
using its create()
function whenever entities like
actors come into play with a CardDesc.trigger
specified.
For example, the following JSON would belong on the CardDesc.trigger
field to describe a minion that draws a card whenever it is damaged, up to 3 times:
{ "eventTrigger": { "class": "DamagedReceivedTrigger", "hostTargetType": "IGNORE_OTHER_TARGETS" }, "spell": { "class": "DrawCardSpell", "targetPlayer": "SELF" }, "maxFires": 3 }Note, this is distinct from an
EventTriggerDesc
or EventTrigger
,
which defines how to react to which events in game.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.demilich.metastone.game.cards.desc.HasEntrySet
HasEntrySet.BfsEnum, HasEntrySet.BfsNode<T extends Enum,
V> -
Field Summary
Modifier and TypeFieldDescriptionprotected EventTriggerDesc[]
protected boolean
protected Integer
protected String
protected EventTriggerDesc
protected EventTriggerDesc[]
protected boolean
protected Integer
protected Integer
protected String
protected boolean
protected boolean
protected SpellDesc
protected com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Creates an enchantment represented by this configuration.entrySet()
Triggers that activate this enchantment when they fired.The number of times anEnchantment
fires until it actually casts its spell.A description field to use when rendering the enchantment on the client.The description of which "event trigger" (reacting to which event) this trigger will react toWhen set, these triggers will expire this enchantment when fired.The maximum number of times this trigger can fire until it expires.The maximum number of times this trigger can fire per sequence.getName()
A name field to use when rendering the enchantment on the clientgetSpell()
The spell that will be cast by anEnchantment.process(int, SpellDesc, GameEvent)
invocation.com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[]
getZones()
Zones where this enchantment is activated.boolean
Whentrue
, treats theGameContext.getEventValue()
as the amount to increment this enchantment's firing counter.boolean
Whentrue
, thisEnchantment
should not be removed by aGameLogic.transformMinion(SpellDesc, Entity, Minion, Minion, boolean)
orGameLogic.replaceCard(int, Card, Card)
effect.boolean
Whentrue
, indicates the enchantment should only last one turn.boolean
Whentrue
, indicates the owner of the enchantment for the purposes of evaluating theplayer
argument of aSpell.onCast(GameContext, Player, SpellDesc, Entity, Entity)
invocation shouldn't change if the owner of theEnchantment.hostReference
changes.setActivationTriggers
(EventTriggerDesc[] activationTriggers) setCountByValue
(boolean countByValue) setCountUntilCast
(Integer countUntilCast) setDescription
(String description) setEventTrigger
(EventTriggerDesc eventTrigger) setExpirationTriggers
(EventTriggerDesc[] expirationTriggers) setKeepAfterTransform
(boolean keepAfterTransform) setMaxFires
(Integer maxFires) setMaxFiresPerSequence
(Integer maxFiresPerSequence) setOneTurn
(boolean oneTurn) setPersistentOwner
(boolean persistentOwner) setZones
(com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[] zones) tryCreate
(GameContext context, Player player, Entity effectSource, Card enchantmentSource, Entity host, boolean force) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.demilich.metastone.game.cards.desc.HasEntrySet
bfs
-
Field Details
-
eventTrigger
-
spell
-
oneTurn
protected boolean oneTurn -
persistentOwner
protected boolean persistentOwner -
keepAfterTransform
protected boolean keepAfterTransform -
maxFires
-
maxFiresPerSequence
-
countUntilCast
-
countByValue
protected boolean countByValue -
activationTriggers
-
expirationTriggers
-
name
-
description
-
zones
protected com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[] zones
-
-
Constructor Details
-
EnchantmentDesc
public EnchantmentDesc()
-
-
Method Details
-
entrySet
- Specified by:
entrySet
in interfaceHasEntrySet<EnchantmentDescArg,
Object>
-
create
Creates an enchantment represented by this configuration.The enchantment's
Trigger.setHostReference(net.demilich.metastone.game.targeting.EntityReference)
call should be applied immediately afterwards to specify the host of this enchantment.Quest
andSecret
enchantments exist in play, and by convention they have unspecified hosts.- Returns:
- The enchantment
-
getEventTrigger
The description of which "event trigger" (reacting to which event) this trigger will react to -
setEventTrigger
-
getSpell
The spell that will be cast by anEnchantment.process(int, SpellDesc, GameEvent)
invocation.- See Also:
-
setSpell
-
isOneTurn
public boolean isOneTurn()Whentrue
, indicates the enchantment should only last one turn. -
setOneTurn
-
isPersistentOwner
public boolean isPersistentOwner()Whentrue
, indicates the owner of the enchantment for the purposes of evaluating theplayer
argument of aSpell.onCast(GameContext, Player, SpellDesc, Entity, Entity)
invocation shouldn't change if the owner of theEnchantment.hostReference
changes.This implements Blessing of Wisdom, Power Word: Glory and other effects whose text would change depending on whose perspective the text is read from.
-
setPersistentOwner
-
isKeepAfterTransform
public boolean isKeepAfterTransform()Whentrue
, thisEnchantment
should not be removed by aGameLogic.transformMinion(SpellDesc, Entity, Minion, Minion, boolean)
orGameLogic.replaceCard(int, Card, Card)
effect.Implements Shifter Zerus, Molten Blade and other in-hand every-turn-replacement effects.
-
setKeepAfterTransform
-
getMaxFires
The maximum number of times this trigger can fire until it expires.When
null
(the default), the trigger can fire an unlimited number of times. -
setMaxFires
-
getMaxFiresPerSequence
The maximum number of times this trigger can fire per sequence. This counter is reset at the beginning of the sequence. Does not expire the trigger when exceeded.When
null
(the default), the trigger can fire an unlimited number of times per sequence. -
setMaxFiresPerSequence
-
getCountUntilCast
The number of times anEnchantment
fires until it actually casts its spell.Implements Quests and many other counting behaviours in triggers.
Typically
maxFires
is set to the same value ascountUntilCast
to limit the trigger to casting a spell at most once, as soon as theeventTrigger
has firedcountUntilCast
times. -
setCountUntilCast
-
isCountByValue
public boolean isCountByValue()Whentrue
, treats theGameContext.getEventValue()
as the amount to increment this enchantment's firing counter.Implements spellstones.
-
setCountByValue
-
getActivationTriggers
Triggers that activate this enchantment when they fired.If any triggers are specified, the enchantment will come into play with
Enchantment.isActivated()
set tofalse
.Activation occurs during the queueing phase, and thus you should use a
EventTriggerArg.QUEUE_CONDITION
if the trigger should have a condition to determine whether or not it activates. Activations are NOT evaluated during the firing phase. -
setActivationTriggers
-
getExpirationTriggers
When set, these triggers will expire this enchantment when fired.Expiration triggers are evaluated during the queueing phase. If an expiration trigger queues, the trigger is expired and will not fired. Thus you should use a
EventTriggerArg.QUEUE_CONDITION
if the trigger should have a condition to determine whether or not it expires. -
setExpirationTriggers
-
getName
A name field to use when rendering the enchantment on the client -
setName
-
getDescription
A description field to use when rendering the enchantment on the client. -
setDescription
-
getZones
public com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[] getZones()Zones where this enchantment is activated. -
tryCreate
public Optional<Enchantment> tryCreate(GameContext context, Player player, Entity effectSource, Card enchantmentSource, Entity host, boolean force) - Specified by:
tryCreate
in interfaceAbstractEnchantmentDesc<Enchantment>
-