Class OpenerDesc
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,HasEntrySet<BattlecryDescArg,java.lang.Object>
,AbstractEnchantmentDesc<Opener>
public final class OpenerDesc extends java.lang.Object implements java.io.Serializable, HasEntrySet<BattlecryDescArg,java.lang.Object>, java.lang.Cloneable, AbstractEnchantmentDesc<Opener>
Like a spell, battlecries take targetSelection
, assumed to be TargetSelection.NONE
if not specified
in the JSON.
For example, this battlecry summons a 2/1 minion:
{ "spell": { "class": "SummonSpell", "boardPositionRelative": "RIGHT", "card": "token_ooze", "targetPlayer": "SELF" } }This battlecry deals 2 damage to the chosen minion:
{ "targetSelection": "MINIONS", "spell": { "class": "DamageSpell", "value": 2 } }This battlecry implements, "If you're holding a spell, deal 1 damage."
{ "targetSelection": "ANY", "spell": { "class": "DamageSpell", "value": 1 }, "condition": { "class": "HoldsCardCondition", "cardFilter": { "class": "CardFilter", "cardType": "SPELL" } } }This battlecry is one of two for "Choose One - Deal 2 damage, or Draw a Card". Notice the flavorful name.
{ "spell": { "class": "DrawCardSpell" }, "name": "Study in the Library", "description": "Draw a Card" }
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.demilich.metastone.game.cards.desc.HasEntrySet
HasEntrySet.BfsEnum, HasEntrySet.BfsNode<T extends java.lang.Enum,V>
-
Field Summary
Fields Modifier and Type Field Description ConditionDesc
condition
java.lang.String
description
java.lang.String
name
SpellDesc
spell
TargetSelection
targetSelection
ConditionDesc
targetSelectionCondition
TargetSelection
targetSelectionOverride
-
Constructor Summary
Constructors Constructor Description OpenerDesc()
-
Method Summary
Modifier and Type Method Description OpenerDesc
clone()
java.util.Set<java.util.Map.Entry<BattlecryDescArg,java.lang.Object>>
entrySet()
ConditionDesc
getCondition()
The condition to evaluate if the player will be prompted to make a battlecry action.java.lang.String
getDescription()
A description used to render a card representing the battlecry.java.lang.String
getName()
A name used to render a card representing the battlecry.SpellDesc
getSpell()
The spell to cast when this battlecry'scondition
is true (or always cast if no condition is specified and a valid target is available).TargetSelection
getTargetSelection()
The targets the battlecry can choose from.ConditionDesc
getTargetSelectionCondition()
TargetSelection
getTargetSelectionOverride()
void
setCondition(ConditionDesc condition)
void
setDescription(java.lang.String description)
void
setName(java.lang.String name)
void
setSpell(SpellDesc spell)
void
setTargetSelection(TargetSelection targetSelection)
void
setTargetSelectionCondition(ConditionDesc targetSelectionCondition)
void
setTargetSelectionOverride(TargetSelection targetSelectionOverride)
OpenerAction
toOpenerAction()
java.util.Optional<Opener>
tryCreate(GameContext context, Player player, Entity effectSource, Card enchantmentSource, Entity host, boolean force)
-
Field Details
-
spell
-
targetSelection
-
condition
-
name
public java.lang.String name -
description
public java.lang.String description -
targetSelectionOverride
-
targetSelectionCondition
-
-
Constructor Details
-
OpenerDesc
public OpenerDesc()
-
-
Method Details
-
getTargetSelection
The targets the battlecry can choose from.Battlecries only go into target selection if their
condition
is met.If target selection is specified and no valid targets are available, the battlecry is not cast.
-
toOpenerAction
-
getSpell
The spell to cast when this battlecry'scondition
is true (or always cast if no condition is specified and a valid target is available). -
setSpell
-
setTargetSelection
-
getCondition
The condition to evaluate if the player will be prompted to make a battlecry action.The condition is also used to determine if the
Card
in the player's hand should receive a "yellow glow" indicating its condition is met.In order to implement this glow, it is preferred to specify a condition here rather than using a
ConditionalSpell
in thespell
field. -
setCondition
-
getName
public java.lang.String getName()A name used to render a card representing the battlecry. When not specified, the description is used instead. Used for choose-one battlecries.If the
spell
is aTransformMinionSpell
, theSpellArg.CARD
of that spell (the minion the choose-one minion will be transformed into) will be used to render the choice instead, regardless of your specification of name. -
setName
public void setName(java.lang.String name) -
getDescription
public java.lang.String getDescription()A description used to render a card representing the battlecry. Used for choose-one battlecries.If the
spell
is aTransformMinionSpell
, theSpellArg.CARD
of that spell (the minion the choose-one minion will be transformed into) will be used to render the choice instead, regardless of your specification of description. -
setDescription
public void setDescription(java.lang.String description) -
entrySet
- Specified by:
entrySet
in interfaceHasEntrySet<BattlecryDescArg,java.lang.Object>
-
clone
- Overrides:
clone
in classjava.lang.Object
-
getTargetSelectionCondition
-
getTargetSelectionOverride
-
setTargetSelectionCondition
-
setTargetSelectionOverride
-
tryCreate
@Suspendable public java.util.Optional<Opener> tryCreate(GameContext context, Player player, Entity effectSource, Card enchantmentSource, Entity host, boolean force)- Specified by:
tryCreate
in interfaceAbstractEnchantmentDesc<Opener>
-