Class WhereverTheyAreSpell
- All Implemented Interfaces:
Serializable
,HasDesc<SpellDesc>
player
(casting player's) zones.
The underlying implementation uses enchantments to apply the effects for all the non-removed game zones (Spellsource.ZonesMessage.Zones.BATTLEFIELD
, Spellsource.ZonesMessage.Zones.DECK
, Spellsource.ZonesMessage.Zones.HAND
, Spellsource.ZonesMessage.Zones.HERO
, Spellsource.ZonesMessage.Zones.HERO_POWER
and Spellsource.ZonesMessage.Zones.WEAPON
). IF SpellArg.ZONES
is specified, use those instead.
If the Spellsource.ZonesMessage.Zones.GRAVEYARD
is included, which ordinarily wipes enchantments and buffs, an enchantment is put into
play that will cast the specified spell on minions entering the owner's battlefield. This will include minions
summoned by all other effects, like discovers or battlecries or from the hand.
If the SpellArg.TARGET
is EntityReference.OUTPUT
in any of the
sub-spells, the output is resolved now rather than at the time the spell is cast.
A card is considered a copy "wherever they are" if they are the same card ID.
To implement a buff, like "Give a minion and all its copies +1/+1 (wherever they are):"
{ "class": "WhereverTheyAreSpell", "spell": { "class": "BuffSpell", "value": 1 }, "zones": ["BATTLEFIELD", "GRAVEYARD"] }Observe that the zones are specified to just be
Spellsource.ZonesMessage.Zones.BATTLEFIELD
and Spellsource.ZonesMessage.Zones.GRAVEYARD
. This indicates
that the spell should be cast on all the existing copies of the target
on the caster's battlefield; then, an
enchantment will ensure that minions summoned from the hand, deck, graveyard, discovers, etc. will also get this
bonus cast on them.
The client communications code special-cases the enchantment provided here to look for buffs to render in the client's hand.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.demilich.metastone.game.spells.Spell
cast, castForPlayer, checkArguments, getDesc, isNativeStateful, setDesc, toString
-
Constructor Details
-
WhereverTheyAreSpell
public WhereverTheyAreSpell()
-
-
Method Details
-
onCast
protected void onCast(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) Description copied from class:Spell
Implementations ofonCast
are the meat-and-bones of a spell's effects. This should actually call a variety of methods inGameLogic
, generate cards usingSpellUtils.getCards(GameContext, Player, Entity, Entity, SpellDesc)
, interpretSpellArg
keys in thedesc
, etc.Observe that subclasses of
Spell
mostly just need to implement this function. Also, observe that instances ofSpell
are stateless: all the state is provided as arguments to this function.- Overrides:
onCast
in classMetaSpell
- Parameters:
context
- The game contextplayer
- The casting playerdesc
- The collection ofSpellArg
keys and values that are interpreted by the implementation of this function to actually cause effects in a gamesource
- The entity from which this effect is happening (typically a card or a minion if it's a battlecry).target
- The particular target of this invocation of the spell. When a spell hits multiple targets, like an AoE damage effect, this method is called once for each target in the list of targets.- See Also:
-