All Implemented Interfaces:
Serializable, Cloneable, Comparable<Entity>, HasCard
Direct Known Subclasses:
Hero, Minion, Weapon

public abstract class Actor extends Entity
An actor hosts common functionality between minions, weapons and heroes. Actors have hitpoints; they can be destroyed; they have deathrattles; they have other enchantments.

When actors enter or exit their respective zones (Spellsource.ZonesMessage.Zones.HERO, Spellsource.ZonesMessage.Zones.BATTLEFIELD, Spellsource.ZonesMessage.Zones.WEAPON), BoardChangedEvent will be raised.

See Also:
  • Constructor Details

    • Actor

      public Actor()
  • Method Details

    • refreshAttacksPerRound

      public void refreshAttacksPerRound()
      Refreshes the number of attacks an Actor has, typically to 1 or the number of Attribute.WINDFURY attacks if the actor has Windfury.
    • canAttackThisTurn

      public boolean canAttackThisTurn(GameContext context)
    • hasNonZeroAttack

      protected boolean hasNonZeroAttack(GameContext context)
    • clone

      public Actor clone()
      Description copied from class: Entity
      Clone an entity, including its ID and location.

      Use this method for emulating an "immutable" view on an entity. This kind of cloning is not suitable for most gameplay situations, because using the clone will cause two entities with identical IDs and locations to exist. Instead, a subclass will provide a getCopy() method that is more helpful for gameplay.

      Overrides:
      clone in class Entity
      Returns:
      An exact clone.
    • getArmor

      public int getArmor()
    • getAttack

      public int getAttack()
    • getBaseAttack

      public int getBaseAttack()
    • getBaseHp

      public int getBaseHp()
    • getHp

      public int getHp()
      The current number of hitpoints this actor has.
      Returns:
      The hitpoints.
    • getMaxHp

      public int getMaxHp()
      Returns the maximum amount of hitpoints this actor can have, considering all of its bonuses from effects and Auras.
      Returns:
      The maximum hitpoints.
    • isDestroyed

      public boolean isDestroyed()
      Indicates whether or not the actor is mortally wounded.

      A mortally wounded actor hasn't necessarily been taken off the board and put into the Spellsource.ZonesMessage.Zones.GRAVEYARD yet. This is useful for preventing effects from impacting already dead minions before a GameLogic.endOfSequence() has been called.

      Overrides:
      isDestroyed in class Entity
      Returns:
      true if the minion's health is less than 1 or if the minion has the Attribute.DESTROYED attribute.
      See Also:
    • isWounded

      public boolean isWounded()
    • modifyAuraHpBonus

      public void modifyAuraHpBonus(int value)
    • modifyHpBonus

      public void modifyHpBonus(int value)
      Description copied from class: Entity
      Modifies the HP bonus for the given entity.
      Overrides:
      modifyHpBonus in class Entity
      Parameters:
      value - The amount to increment or decrement the HP bonus by.
    • setAttack

      public void setAttack(int value)
    • setBaseAttack

      public void setBaseAttack(int value)
    • setBaseHp

      public void setBaseHp(int value)
    • setHp

      public void setHp(int value)
    • setMaxHp

      public void setMaxHp(int value)
    • getHeroClass

      public String getHeroClass()
    • setOwner

      public void setOwner(int ownerIndex)
      Overrides:
      setOwner in class Entity
    • setId

      public void setId(int id)
      Overrides:
      setId in class Entity
    • setRace

      public void setRace(String race)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCardInventoryId

      public String getCardInventoryId()
      Description copied from class: Entity
      Gets the card's inventory ID (unique instance of the card).
      Overrides:
      getCardInventoryId in class Entity
      Returns:
      The card inventory ID.
    • getCopy

      public Actor getCopy()
      Specified by:
      getCopy in class Entity
    • getDefaultActiveTriggerZones

      public abstract com.hiddenswitch.spellsource.rpc.Spellsource.ZonesMessage.Zones[] getDefaultActiveTriggerZones()
      Gets the zones where the CardDesc.getTrigger() and CardDesc.getTriggers() are active by default.
      Returns: