Class OpenerDesc

java.lang.Object
net.demilich.metastone.game.spells.desc.OpenerDesc
All Implemented Interfaces:
Serializable, Cloneable, HasEntrySet<BattlecryDescArg,Object>, AbstractEnchantmentDesc<Opener>

public final class OpenerDesc extends Object implements Serializable, HasEntrySet<BattlecryDescArg,Object>, Cloneable, AbstractEnchantmentDesc<Opener>
The object describing a battlecry.

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"
     }
 
See Also:
  • Field Details

  • Constructor Details

    • OpenerDesc

      public OpenerDesc()
  • Method Details

    • getTargetSelection

      public TargetSelection 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

      public OpenerAction toOpenerAction()
    • getSpell

      public SpellDesc getSpell()
      The spell to cast when this battlecry's condition is true (or always cast if no condition is specified and a valid target is available).
    • setSpell

      public void setSpell(SpellDesc spell)
    • setTargetSelection

      public void setTargetSelection(TargetSelection targetSelection)
    • getCondition

      public ConditionDesc 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 the spell field.

    • setCondition

      public void setCondition(ConditionDesc condition)
    • getName

      public 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 a TransformMinionSpell, the SpellArg.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(String name)
    • getDescription

      public String getDescription()
      A description used to render a card representing the battlecry. Used for choose-one battlecries.

      If the spell is a TransformMinionSpell, the SpellArg.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(String description)
    • entrySet

      public Set<Map.Entry<BattlecryDescArg,Object>> entrySet()
      Specified by:
      entrySet in interface HasEntrySet<BattlecryDescArg,Object>
    • clone

      public OpenerDesc clone()
      Overrides:
      clone in class Object
    • getTargetSelectionCondition

      public ConditionDesc getTargetSelectionCondition()
    • getTargetSelectionOverride

      public TargetSelection getTargetSelectionOverride()
    • setTargetSelectionCondition

      public void setTargetSelectionCondition(ConditionDesc targetSelectionCondition)
    • setTargetSelectionOverride

      public void setTargetSelectionOverride(TargetSelection targetSelectionOverride)
    • tryCreate

      public Optional<Opener> tryCreate(GameContext context, Player player, Entity effectSource, Card enchantmentSource, Entity host, boolean force)
      Specified by:
      tryCreate in interface AbstractEnchantmentDesc<Opener>