Class BuffSpell
java.lang.Object
net.demilich.metastone.game.spells.Spell
net.demilich.metastone.game.spells.RevertableSpell
net.demilich.metastone.game.spells.BuffSpell
- All Implemented Interfaces:
Serializable,HasDesc<SpellDesc>
- Direct Known Subclasses:
BuffHeroSpell,BuffLeftmostMinionInHandSpell,GainArmorSpell,GainStatsOfHighestCostMinionSpell,StealHealthSpell,VileIntentSpell
Gives the
target a stats boost of either *+ SpellArg.VALUE / + SpellArg.VALUE) or (+ SpellArg.ATTACK_BONUS / + SpellArg.HP_BONUS ). If the target is a Hero, like EntityReference.FRIENDLY_HERO, SpellArg.ARMOR_BONUS will give the hero armor.
If a ModifyBuffSpellAura is in play and matches the source,
this effect will add the aura's specified attack and HP bonuses to the buff given by this spell only if the
buff spell has the specified key.
- If this spell has
SpellArg.VALUE, both the aura'sAuraArg.ATTACK_BONUS,AuraArg.HP_BONUSandAuraArg.VALUEvalues will be used. - If this spell has
SpellArg.ATTACK_BONUS, the aura'sAuraArg.ATTACK_BONUSwill be used. - If this spell has
SpellArg.HP_BONUS, the aura'sAuraArg.HP_BONUSwill be used AuraArg.VALUEis always added.
ModifyBuffSpellAura is in play, this effect sets the GameValue.SPELL_VALUE retrieved by
GameValueProvider (1) to the HP bonus specified on this
effect when querying the aura for the amount of additional HP bonus to apply, and then (2) to the attack bonus
specified on this effect when querying the aura for the amount of additional attack bonus to apply.
For example, this trigger implements "Whenever you cast a spell, gain Armor equal to its Cost:"
"trigger": {
"eventTrigger": {
"class": "SpellCastedTrigger",
"sourcePlayer": "SELF"
},
"spell": {
"class": "BuffSpell",
"target": "FRIENDLY_HERO",
"armorBonus": {
"class": "ManaCostProvider",
"target": "EVENT_TARGET"
}
}
}
Observe that the "armorBonus" can be a ValueProvider.
Or, in this example "Battlecry: Shuffle a friendly minion into your deck and give it +3/+3.":
"battlecry": {
"targetSelection": "FRIENDLY_MINIONS",
"spell": {
"class": "ShuffleMinionToDeckSpell",
"spell": {
"class": "BuffSpell",
"target": "OUTPUT",
"attackBonus": 3,
"hpBonus": 3
},
"howMany": 1
}
},
Here, the target is EntityReference.OUTPUT, which refers to the card that was shuffled into the player's
deck, and the bonuses are expressed as integer values.
Weapons will interpret the HP bonus as a benefit to durability. For example, "Give your weapon +1/+1":
"spell": {
"class": "BuffSpell",
"target": "FRIENDLY_WEAPON",
"attackBonus": 1,
"hpBonus": 1
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SpellDesccreate(EntityReference target, int value) static SpellDesccreate(EntityReference target, int attackBonus, int hpBonus) static SpellDesccreate(EntityReference target, ValueProvider attackBonus, ValueProvider hpBonus) protected SpellDescgetReverseSpell(GameContext context, Player player, Entity source, SpellDesc desc, EntityReference target) 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
-
BuffSpell
public BuffSpell()
-
-
Method Details
-
create
-
create
-
create
public static SpellDesc create(EntityReference target, ValueProvider attackBonus, ValueProvider hpBonus) -
getReverseSpell
protected SpellDesc getReverseSpell(GameContext context, Player player, Entity source, SpellDesc desc, EntityReference target) - Specified by:
getReverseSpellin classRevertableSpell
-
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.- Overrides:
onCastin classRevertableSpell- 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:
-