Package net.demilich.metastone.game.spells
package net.demilich.metastone.game.spells
Spells contain all the functional pieces of the card JSON (Click on description to learn more about how to use this).
Each of these classes correspond to the value part of a spell's "class"
key in the card JSON. For
example, if you saw the following in the card JSON:
{ "class": "DrawCardSpell" }You would look up
DrawCardSpell
here.
Then, SpellArg
referenced in the documentation correspond to keys in
the JSON. For example, if you saw the following in the card JSON:
{ "class": "DrawCardSpell", "value": 1 }You'll see that
DrawCardSpell
says that SpellArg.VALUE
is the number of cards to draw. That arg refers to the key
"value"
in the JSON. We refer to this change in casing as "camelCase"; each spell arg corresponds to a
camelCased version in the JSON, where you remove the underscores and start the first letter lowercase, subsequent
starts of words uppercase.-
ClassDescriptionA base class for spells that modify the enchantments hosted by
target
or thetarget
itself if it is an enchantment.Indicates this effect will remove a card somehow.Activates the enchantments hosted by the target or the enchantment targeted intarget
Simply performsSpellArg.SPELL1
if the target entity is an Actor, orSpellArg.SPELL2
if they are a Card.Gives thetarget
theSpellArg.SPELL
as a deathrattle.Adds theSpellArg.SECONDARY_TARGET
card's text to thetarget
's description, concatenating with a space.Adds anSpellArg.AURA
(Aura
) or aEnchantment
(in theSpellArg.TRIGGER
) to the specifiedtarget
and immediately puts that aura/enchantment into play (i.e., activates it).Adds the specifiedSpellArg.PACT
for the specifiedSpellArg.TARGET_PLAYER
.Adds the specifiedSpellArg.QUEST
for the specifiedSpellArg.TARGET_PLAYER
.Puts the specifiedSpellArg.SECRET
(anEnchantmentDesc
) into play.CastsSpellArg.SPELL1
on thetarget
minion, andSpellArg.SPELL2
on the minions adjacent to the target.An internal spell used to implementBuffAura
.Indicates that the effects should occur for both players, without using theTargetPlayer.BOTH
value inSpellArg.TARGET_PLAYER
.Deprecated.Gives thetarget
a stats boost of either *+SpellArg.VALUE
/ +SpellArg.VALUE
) or (+SpellArg.ATTACK_BONUS
/ +SpellArg.HP_BONUS
).Creates aCardCostModifier
specified bySpellArg.CARD_COST_MODIFIER
that is hosted by the specifiedSpellArg.TARGET
.Casts the subspell after the sequence has ended.Casts the specifiedSpellArg.CARD
or the card targeted bySpellArg.SECONDARY_TARGET
onto thetarget
.Use aDiscoverSpell
instead, since groups were never well thought-out anyway.Casts a random spell from theSpellArg.CARD_SOURCE
,SpellArg.CARD_FILTER
andSpellArg.CARDS
provided.Casts the specifiedSpellArg.SPELL
forSpellArg.HOW_MANY
times.Tries to cast the spell card (given either bySpellArg.CARD
orSpellArg.SECONDARY_TARGET
) onto the specified target.Changes theSpellArg.TARGET_PLAYER
hero power to a random hero power retrieved fromSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc)
.Changes the hero ofSpellArg.TARGET_PLAYER
to the specified hero card ID inSpellArg.CARD
.Prompts the player to choose among cards in their hand.The definition of aChooseOneSpell
's sub spells.Provides a choice betweenSpellArg.SPELL1
andSpellArg.SPELL2
, using theSpellArg.NAME
andSpellArg.DESCRIPTION
in those spells to generate the choice cards.Deprecated.Deprecated.Use SummonSpell instead.Shorthand for aConditionalEffectSpell
that only plays the spell if the player has activated a combo (i.e., previously played a card earlier this turn).Deprecated.Use aBuffAura
instead.CastsSpellArg.SPELL1
and evaluates theSpellArg.CONDITION
: if it is fulfilled, castsSpellArg.SPELL2
.Casts theSpellArg.SPELL
if theCondition
inSpellArg.CONDITION
is met; or, when aSpellArg.SPELLS
array is specified, casts the spell in the array if its correspondingSpellArg.CONDITIONS
array member is met.Copies atarget
's source card.Copies thetarget
actor's deathrattles onto thesource
(i.e., result ofEntityReference.SELF
) of this spell.CallsChangeHeroPowerSpell
withSpellArg.CARD
equal to the casting player's opponent's hero power card ID.Deprecated.This spell is fairly brittle and you will be better off implementing the intended effects directly.Deprecated.Deals damage to the specified actor, bypassing its armor.DealsSpellArg.VALUE
damage to the specifiedtarget
.Deactivates the enchantments hosted by the target or deactivates thetarget
enchantment.DealsSpellsource.DamageTypeMessage.DamageType.DECAY
damage to thesource
.Destroys all minions except one.Destroys all the secrets belonging toSpellArg.TARGET_PLAYER
.Destroys thetarget
Actor
.Discards or removes all cards fromSpellArg.TARGET_PLAYER
's deck, up toSpellArg.VALUE
random cards.Discards cards from theSpellsource.ZonesMessage.Zones.HAND
or from aCardSource
likeDeckSource
which does not generate new cards (does not implementHasCardCreationSideEffects
), likeDeckSource
.Deprecated.UseDiscoverSpell
with a"spell": {"class": "ReceiveCardSpell"}
instead.Deprecated.UseDiscoverSpell
instead.This class is currently only used for tri-class card discoveries.Deprecated.The discover option spell is fairly brittle.Deprecated.UseDiscoverSpell
with aSpellArg.CARD_FILTER
instead.Prompts the user to make an irreversible choice of some number of cards, and casts a spell for the chosen (and optionally, unchosen) cards.Doubles thetarget
Actor
's total attack.DealsSpellArg.VALUE
damage to thetarget
.Deprecated.Use aDrawCardSpell
with a sub spell like{"class": "DrawCardSpell", "spell": {"class": ..., "target": "OUTPUT"}}
instead.Draws a card from the graveyard.DrawsSpellArg.VALUE
cards from the top of the player's deck.Draws cards until a condition is met.Makes each actor inSpellArg.SECONDARY_TARGET
attack another random actor inSpellArg.TARGET
.Implements the attack bonus portion of a complete Enrage effect.Deprecated.byEquipWeaponSpell
.Equips the specified weapon inSpellArg.CARD
or chooses a random one based on theSpellArg.CARD_FILTER
andSpellArg.CARD_SOURCE
for the specifiedSpellArg.TARGET_PLAYER
.Performs aHealSpell
effect.Increments and deals fatigue damage to theplayer
(SpellArg.TARGET_PLAYER
).Causes thesource
or each entity inSpellArg.SECONDARY_TARGET
toGameLogic.fight(Player, Actor, Actor, PhysicalAttackAction)
thetarget
.LikeConditionalSpell
, except executes the first matching condition.At the moment this spell is invoked, the sequence is ended and dead entities are cleaned up from the board, triggering deathrattles.Moves a card from the deck to the hand.Implements "50% chance to target the wrong entity" when coupled with an appropriate trigger.Gives the hero of thetarget
's ownerSpellArg.VALUE
armor.Gives the player a temporary amount ofSpellArg.VALUE
mana.Used inMetaSpell
andGameValueProvider
to refer to specific values calculated at the timeMetaSpell
is evaluated.Casts healing missiles.Heals the specifiedtarget
forSpellArg.VALUE
amount.Signifies that the subspellsSpellArg.SPELL
,SpellArg.SPELLS
, etc.) represent the "hero power effect" for cards that interact with the hero power.Casts an Invoke effect specified inSpellArg.SPELL
forSpellArg.MANA
mana cost.When the player has at leastAttribute.INVOKE
additional unspent mana, source an extra bonus effect for that cost.A joust causes both players to show a random card satisfying theSpellArg.CARD_FILTER
and performs an action if the mana cost of the caster's card is higher than the opponent's card's cost.A class that defines a collection of spells that should be executed one after another in theSpellArg.SPELLS
argument.Takes control of atarget
, changing its owner to the caster.Misdirection overrides theEntityReference.ATTACKER
's current target to another random target withinSpellArg.SECONDARY_TARGET
.This spell castsSpellArg.HOW_MANY
missiles, each dealingSpellArg.VALUE
damage (with spell damage) to random targets.Increments (or decrements, if negative) bySpellArg.VALUE
theSpellArg.ATTRIBUTE
on the giventarget
.Modifies the amount of damage that is currently about to be dealt.Modifies the durability of a weapon regardless of which weapon is equipped.Adds or destroysSpellArg.VALUE
mana crystals.Gives a minionAttribute.WITHER
and the appropriate trigger if it does not already have it.CastsSpellArg.SPELL
on a random target from the list of targets inSpellArg.TARGET
at mostSpellArg.VALUE
times or until random targets are exhausted, whichever comes first.A spell that has no effects.Acts like anAdjacentEffectSpell
except on minions opposite of thetarget
This spell implements the new Overkill mechanic introduced in Rastakhan's Rumble.Overrides the target of the nextGameLogic.targetAcquisition(Player, Entity, GameAction)
call.Indicates a measurement about a player to use withPlayerAttributeValueProvider
.MakesSpellArg.HOW_MANY
copies of the base card of thetarget
.Puts the specified cards (target
or otherwise fromSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc, int)
) on the top of the deck.Puts the target minion card into theSpellsource.ZonesMessage.Zones.BATTLEFIELD
from theSpellsource.ZonesMessage.Zones.DECK
.Summons a minion from thetarget
card onto the board in a way that counts it as being played from the hand or deck.Puts the cards fromSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc, int)
on the bottom of the player's deck.Deprecated.TakesSpellArg.HOW_MANY
secret cards from theSpellArg.CARD_SOURCE
(defaulting to aDeckSource
) and puts those secrets directly into play without triggering aSecretPlayedTrigger
.Interprets the spell arguments as a query of targets and castsSpellArg.SPELL
on each resultingtarget
in order.Indicates that theSpellArg.SPELL
andSpellArg.SPELLS
on this spell are Quick Draw effects.Casts a spell card with random targets.Givem a list of effects inSpellArg.SPELLS
, randomly choose one to cast thetarget
.Deprecated.UseCastRandomSpellSpell
instead.Recasts theSpellArg.SPELL
SpellArg.HOW_MANY
times or up to 60 (14 if this is Grim Patron) by default.Deprecated.byReceiveCardSpell
, which supports sub spells inSpellArg.SPELL
.Puts a card in your hand.Retrieves the last card from the filtered list of cards specified bySpellArg.CARD_SOURCE
andSpellArg.CARD_FILTER
.Recruits (summons and removes the source card of)SpellArg.VALUE
minions fromSpellArg.CARD_LOCATION
location.Refreshes the caster's hero power so it can be used again.Refreshes the player's mana by gaining an amount of mana equal to the difference in their max mana and current mana.This abstract class provides a way to cast spell effects on targets.Removes atarget
actor peacefully (without triggering its deathrattles) from its current zone.Removes theSpellArg.ATTRIBUTE
from the specifiedtarget
.Removes "bonus" attributes, or attributes that didn't start on the text of the minion.Deprecated.Use aRemoveCardSpell
with a sub spell like{"class": "RemoveCardSpell", "spell": {"class": ..., "target": "OUTPUT"}}
instead.Removes thetarget
Card
by putting it directly from the zone it's currently in into theSpellsource.ZonesMessage.Zones.GRAVEYARD
.Expires and removesSpellArg.HOW_MANY
copies (defaultInteger.MAX_VALUE
) of the enchantments whoseEntity.getSourceCard()
has the card ID ofSpellArg.CARD
from thetarget
.Deprecated.Has no implementation.Deprecated.UseReplaceCardsSpell
instead.Replaces thetarget
with one of the cards fromSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc, int)
.Shorthand for aConditionalEffectSpell
that only plays the conditional (second) spell if the caster's deck has a number of cards greater than or equal to theSpellArg.VALUE
.Sets the deck to its initial state at the start of the game.Resurrects minions from both player's graveyards.Resurrects minions from the caster's graveyard.Deprecated.UseReturnTargetToHandSpell
instead.Returns thetarget
to the player's hand as a card.Returns thetarget
to the hand, keeping its enchantments.Reveals a card from a filter,SpellArg.CARD
or thetarget
if neither is specified.This spell is the base class for spells that can be undone by aSpellArg.REVERT_TRIGGER
orSpellArg.SECOND_REVERT_TRIGGER
.Reviving a minion, unlike resurrecting it, puts a minion back into the position on the board where it died.Roasting a card removes the card from the top of the deck and adds theAttribute.ROASTED
to it.During aTargetAcquisitionEvent
or aPhysicalAttackEvent
firing, changes theEntityReference.ATTACKER
to the specifiedtarget
.Sets thetarget
's attack-related attributes such that the result ofActor.getAttack()
orCard.getAttack()
is equal to theSpellArg.VALUE
.Sets thetarget
Card
'sAttribute.CARD_ID
orAttribute.AURA_CARD_ID
to the card ID specified inSpellArg.CARD
.Sets thetarget
entity'sAttribute.DESCRIPTION
to the string specified inSpellArg.DESCRIPTION
, or clears it if no description is specified.Deprecated.Sets theActor
orCard
's hitpoints to the specifiedSpellArg.VALUE
, overriding any existing bonuses stored inAttribute.HP_BONUS
.Sets a player's max mana to the givenSpellArg.VALUE
Peacefully removes thetarget
minion and shuffles it into the caster's deck.Shuffles a card directly into the deck, not its copy.Shuffles copies of the specifiedtarget
orSpellArg.CARD_SOURCE
&SpellArg.CARD_FILTER
cards into the deck.Shuffles thetarget
Spellsource.EntityTypeMessage.EntityType.MINION
into the player's deck with the enchantmentsSilences the specifiedActor
.Sorts a deck by mana costs, putting the lowest cost cards on top.The base class for "spells," or collections of effects in the engine.A set of utilities to help write spells.An object that contains results of aSpellUtils.determineCastingPlayer(GameContext, Player, Entity, TargetPlayer)
call.Steals thetarget
card and moves it to the caster's zone fromSpellArg.CARD_LOCATION
.Steals a random secret belonging to the opponent ofSpellArg.TARGET_PLAYER
.Reads a card ID from the specified attributeSpellArg.ATTRIBUTE
.Summons minions specified by cards; summons random minions from card filters; or copies minions according to targets.Indicates that the subspells should be cast as the "Supremacy" effect.Swaps thetarget
's attack and hitpoints, making the target's hitpoints its attack value and vice versa.Swaps thetarget
's attack with thesource
actor's attack.Swaps thetarget
's hitpoints with thesource
actor's hitpoints.Swaps the minion specified bySpellArg.SECONDARY_TARGET
with thetarget
.DealsSpellArg.VALUE
damage to thetarget
andSpellArg.SECONDARY_VALUE
damage to theSpellArg.SECONDARY_TARGET
actors.Indicates a player reference.Puts thetarget
that's passed into this spell as the sub spell'ssource
.Gives thetarget
actorSpellArg.VALUE
bonus attack until the end of the current turn.Transforms atarget
card to the specifiedSpellArg.CARD
by removing the old card and receiving a new one.Transforms thetarget
minion into theSpellArg.CARD
or the source card of the entity pointed to bySpellArg.SECONDARY_TARGET
.Transforms thetarget
into a random base minion fromSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc, int)
.Triggers thetarget
entity's aftermaths.Triggers the opener written on eachtarget
entity with random targets (except itself).Triggers the Quick Draw effect wrapped by theQuickDrawSpell
written on thetarget
.Triggers a specific secret, either from theSpellArg.CARD
if specified or thetarget
card.Uses theSpellArg.TARGET_PLAYER
's hero power, choosing a target randomly.Deals magical damage from the weapon equipped by theplayer
(SpellArg.TARGET_PLAYER
), correctly accounting for effects likeAttribute.LIFESTEAL
andAttribute.POISONOUS
.Casts a spell on a target and its copies "wherever they are" in theplayer
(casting player's) zones.
BuffSpell
instead.