Class ChangeHeroSpell
java.lang.Object
net.demilich.metastone.game.spells.Spell
net.demilich.metastone.game.spells.ChangeHeroSpell
- All Implemented Interfaces:
Serializable,HasDesc<SpellDesc>
Changes the hero of
SpellArg.TARGET_PLAYER to the specified hero card ID in SpellArg.CARD. If SpellArg.CARDS or SpellArg.CARD_FILTER or SpellArg.CARD_SOURCE are specified, a random hero card
will be chosen from the lists of cards.
This spell activates the CardDesc.battlecry by default. To disable it,
set SpellArg.EXCLUSIVE to true.
For example, to turn the casting player's hero into Ragnaros:
{
"class": "ChangeHeroSpell",
"card": "hero_ragnaros",
"targetPlayer": "SELF"
}
Casts the SpellArg.SPELL sub-spell with the EntityReference.OUTPUT
set to the new hero.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SpellDescChanges the casting player's hero to the specified card ID.static SpellDesccreate(TargetPlayer player, String heroCardId) Changes the specified player's hero the specified card ID.static SpellDesccreate(TargetPlayer player, String heroCardId, boolean resolveBattlecry) Changes the specified player's hero with the specified card ID, resolving the battlecry if specified.protected voidImplementations ofonCastare the meat-and-bones of a spell's effects.Methods inherited from class net.demilich.metastone.game.spells.Spell
cast, castForPlayer, checkArguments, getDesc, isNativeStateful, setDesc, toString
-
Constructor Details
-
ChangeHeroSpell
public ChangeHeroSpell()
-
-
Method Details
-
create
Changes the casting player's hero to the specified card ID.- Parameters:
heroCardId- A hero card (Spellsource.CardTypeMessage.CardType.HERO.- Returns:
- The spell
-
create
Changes the specified player's hero the specified card ID.- Parameters:
player- The player whose hero should be changed.heroCardId- A hero card (Spellsource.CardTypeMessage.CardType.HERO.- Returns:
- The spell
-
create
Changes the specified player's hero with the specified card ID, resolving the battlecry if specified.- Parameters:
player- the playerheroCardId- the hero cardresolveBattlecry-trueif the hero card should have its battlecry resolved- Returns:
- the spell
-
onCast
protected void onCast(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) Description copied from class:SpellImplementations ofonCastare 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), interpretSpellArgkeys in thedesc, etc.Observe that subclasses of
Spellmostly just need to implement this function. Also, observe that instances ofSpellare stateless: all the state is provided as arguments to this function.- Specified by:
onCastin classSpell- Parameters:
context- The game contextplayer- The casting playerdesc- The collection ofSpellArgkeys 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:
-