Class EntityReference
- All Implemented Interfaces:
Serializable
FRIENDLY_HERO
) or 0 or more (FRIENDLY_MINIONS
). These
references are called group references, and their isTargetGroup()
will return true
.
Group references are appropriate to put into SpellArg.TARGET
. If
SpellArg.RANDOM_TARGET
is specified along with a group reference, a
random entity from the group will be chosen.
When Entity.getReference()
is called, a specific (non-group) reference is always returned. Thus, calling
Entity.getReference()
will never return FRIENDLY_HERO
.
When the target has been transformed, group reference resolution will always return the transformed targets using
Entity.transformResolved(GameContext)
. Resolving a target using GameContext.resolveSingleTarget(EntityReference)
will also always return the transformed target, regardless if it is a group reference or not.
All references omit Attribute.PERMANENT
actors except SELF
, ALL_ENTITIES
, TRIGGER_HOST
, OUTPUT
, EVENT_SOURCE
, EVENT_TARGET
and TRANSFORM_REFERENCE
.
Friendly versus enemy references are evaluated with respect to the calling/casting player. This includes triggers
that are put on the opponent by effects cast by the player. In other words, regardless of "where" the source
is, the player
from whose point of view the reference is being resolved is always the caster.
This can be confusing in a situation like Loatheb, who puts a CardCostModifier
on the caster's Player
entity whose CardCostModifierArg.TARGET
is FRIENDLY_HAND
but whose CardCostModifierArg.TARGET_PLAYER
is TargetPlayer.OPPONENT
. In card cost modifiers, target player is used to
determine if a modifier affects a card by comparing the trigger's owner to the card's owner; opponent indicates that
the card's owner must not equal the trigger's owner. However, FRIENDLY_HAND
is evaluated from each player's
point of view separately, because card cost modifiers (GameLogic.getModifiedManaCost(Player, Card)
) are evaluated by both players, always (this allows opponents to see card cost changes).
Or, for example, Temporus causes a spell to be cast during the turn of the opponent of the owner of Temporus. The
source
of the spell that modifies the Attribute.EXTRA_TURN
of both players is cast during the
opponent's turn and in an event whose TargetPlayer
is the opponent. But,
EnchantmentDesc.spell
is always cast by the enchantment's
owner, which was the caster who originally put the enchantment into play. Therefore, the source
will be the
same as the player who put Temporus onto the battlefield, and that's from whose point of view the FRIENDLY_PLAYER
and ENEMY_PLAYER
will be evaluated.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EntityReference
References a possibly zero-length list of minions adjacent to thesource
of this targeting resolution.static final EntityReference
References the minions adjacent to the currentTARGET
, i.e., the currently selected target in the pending action.static final EntityReference
References both heroes and all the minions on the board.static final EntityReference
References all entities in the game, including transformed ones and permanents.static final EntityReference
References all the minions on the board.static final EntityReference
References all the heroes and minions excluding thesource
of this targeting resolution.static final EntityReference
References all the minions excluding thesource
of this targeting resolution.static final EntityReference
This references the attacker during aPhysicalAttackAction
orGameLogic.fight(Player, Actor, Actor, PhysicalAttackAction)
invocation (i.e., aFightSpell
).static final EntityReference
References the minions adjancent to the attacker during aGameLogic.fight(Player, Actor, Actor, PhysicalAttackAction)
sequence.static final EntityReference
References all the cards in both decks.static final EntityReference
References all the cards in both hands.static final EntityReference
References the minion that is currently being summoned.static final EntityReference
References all entities that are "in play" for the enemy player i.e.static final EntityReference
References all the enemy characters (the opponent's hero and minions).static final EntityReference
References all the card's in the enemy player's deck.static final EntityReference
References the cards and actors in the enemy graveyard.static final EntityReference
References all the cards in the enemy player's hand./static final EntityReference
References a list with a single element, the enemy's hero.static final EntityReference
References the card that is currently the enemey player's hero power.static final EntityReference
References the last card played by the opponent.static final EntityReference
References the last card played by the opponent before this current sequence.static final EntityReference
References the minions that are in the middle of the enemy's battlefield.static final EntityReference
References all the enemy's minions.static final EntityReference
References all the enemy's minions, except ordered by their location on the board instead of their order of play.static final EntityReference
References the enemyPlayer
entity.static final EntityReference
References the cards and actors located in the enemy set aside zone.static final EntityReference
static final EntityReference
References the next card the opponent will draw, or an empty list if no cards remain in the player's deck.static final EntityReference
References the weapon of the enemy hero, or a zero-length list if one isn't equipped.static final EntityReference
References theGameEvent.getSource()
entity when a trigger/enchantment is being evaluated.static final EntityReference
This reference retrieves the (possiblynull
) entity pointed to byGameEvent.getTarget()
.static final EntityReference
References all entities that are "in play" for the friendly player i.e.static final EntityReference
References all the friendly characters (the player's hero and minions).static final EntityReference
References all the cards in the player's deck.static final EntityReference
References all the cards in the player's deck, ordered from the top of the deck towards the bottom.static final EntityReference
References the cards and actors in the friendly graveyard.static final EntityReference
References all the cards in the player's hand.static final EntityReference
References the friendly hero.static final EntityReference
References the card that is currently the friendly player's hero power.static final EntityReference
References the last card played by the friendly player.static final EntityReference
References the last card played by the friendly player before this current sequence.static final EntityReference
References the last minion belonging to the friendly player that died.static final EntityReference
References the last minion card played before this current sequence.static final EntityReference
References the last spell played by this player this turn only.static final EntityReference
References all the player's minions.static final EntityReference
References all the friendly minions, except ordered by their location on the board instead of their order of play.static final EntityReference
References the friendlyPlayer
entity.static final EntityReference
static final EntityReference
References the cards and actors located in the friendly set aside zone.static final EntityReference
static final EntityReference
References the next card the friendly player will draw, or an empty list if no cards remain in the player's deck.static final EntityReference
References theWeapon
of the friendly hero, or a zero-length list if one isn't equipped.static final EntityReference
Retrieves a reference to the minion destroyed by aDestroySpell
.static final EntityReference
References the last card played by either player.static final EntityReference
References the last card played by either player before the end of this current sequence.static final EntityReference
References the minion to the left of thesource
of this targeting resolution, or a zero-length list if there isn't onestatic final EntityReference
References the card in the enemy player's hand with the lowest index in the enemy player's hand.static final EntityReference
References the enemy minion whose index in the minions zone is 0.static final EntityReference
References the card in the friendly player's hand with the lowest index in the friendly player's hand.static final EntityReference
References the friendly minion whose index in the minions zone is 0, which can possibly be thesource
minion.static final EntityReference
References the minions with an index less than thesource
minion.static final EntityReference
References the minions with an index greater than thesource
minion.static final EntityReference
Indicates a spell should take no target.static final EntityReference
Returns the opposing characters from thesource
.static final EntityReference
References zero, one or two minions opposite of thissource
minion.static final EntityReference
References all the enemy minions excluding the source.static final EntityReference
References a combination ofOTHER_FRIENDLY_MINIONS
and theFRIENDLY_HERO
.static final EntityReference
References all the player's minions except thesource
of this targeting resolution.static final EntityReference
Use this reference to apply effects to new entities created by spells.static final EntityReference
References the enemy minions and hero which would ordinarily be targetable by a physical attack from the friendly player's point of view.static final EntityReference
static final EntityReference
static final EntityReference
References the minion to the right of thesource
of this targeting resolution, or a zero-length list if there isn't onestatic final EntityReference
References the enemy minion with the largest index in the minions zone, or an empty list if the minion zone is empty.static final EntityReference
References the card in the friendly player's hand with the highest index.static final EntityReference
References the friendly minion with the largest index in the minions zone, or an empty list if the minion zone is empty.static final EntityReference
Returns thesource
of the target resolution.static final EntityReference
This reference allows you to distinguish the target of an effect (the spell target) versus the target selected by a player (theTARGET
).static final EntityReference
When the player performs aGameAction
that has a target choice, like a physical attack, a targeted battlecry, casting a targeted spell or summoning a minion (interpreted as the minion the player is summoning next to), this reference will return the target that the player originally chose regardless of target overriding effects or effects in the sequence that may later destroy or transform the target.static final EntityReference
Deprecated.static final EntityReference
References theEntity
that hosts theEnchantment
whose fire condition or spell is currently being evaluated. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
getId()
int
hashCode()
boolean
static @NotNull EntityReference
void
setId
(int key) toString()
-
Field Details
-
NONE
Indicates a spell should take no target. It will receivenull
as itstarget
argument. -
ENEMY_CHARACTERS
References all the enemy characters (the opponent's hero and minions). -
ENEMY_MINIONS
References all the enemy's minions. -
ENEMY_HERO
References a list with a single element, the enemy's hero. This list may extremely rarely be empty if the target evaluation is being performed after the hero is destroyed. -
FRIENDLY_CHARACTERS
References all the friendly characters (the player's hero and minions). -
FRIENDLY_MINIONS
References all the player's minions. -
OTHER_FRIENDLY_MINIONS
References all the player's minions except thesource
of this targeting resolution. For example, battlecries often specify other friendly minions to give a bonus to any friendly minion besides itself. -
ADJACENT_MINIONS
References a possibly zero-length list of minions adjacent to thesource
of this targeting resolution. -
FRIENDLY_HERO
References the friendly hero. -
ALL_MINIONS
References all the minions on the board. -
ALL_CHARACTERS
References both heroes and all the minions on the board. -
ALL_OTHER_CHARACTERS
References all the heroes and minions excluding thesource
of this targeting resolution. -
ALL_OTHER_MINIONS
References all the minions excluding thesource
of this targeting resolution. -
FRIENDLY_WEAPON
References theWeapon
of the friendly hero, or a zero-length list if one isn't equipped. -
ENEMY_WEAPON
References the weapon of the enemy hero, or a zero-length list if one isn't equipped. -
FRIENDLY_HAND
References all the cards in the player's hand. -
ENEMY_HAND
References all the cards in the enemy player's hand./ -
OPPOSITE_MINIONS
References zero, one or two minions opposite of thissource
minion. -
LEFTMOST_FRIENDLY_MINION
References the friendly minion whose index in the minions zone is 0, which can possibly be thesource
minion. Or, a zero length list if no friendly minions are on the board. -
LEFTMOST_ENEMY_MINION
References the enemy minion whose index in the minions zone is 0. Or, a zero length list if no enemy minions are on the board. -
FRIENDLY_PLAYER
References the friendlyPlayer
entity. This entity is a useful host for enchantments and attributes likeAttribute.EXTRA_TURN
. -
ENEMY_PLAYER
References the enemyPlayer
entity. This entity is a useful host for enchantments and attributes likeAttribute.EXTRA_TURN
. -
MINIONS_TO_LEFT
References the minions with an index less than thesource
minion.The client will appear to be targeting to the minions on-screen to the right of the
source
. -
MINIONS_TO_RIGHT
References the minions with an index greater than thesource
minion.The client will appear to be targeting to the minions on-screen to the left of the
source
. -
TARGET
When the player performs aGameAction
that has a target choice, like a physical attack, a targeted battlecry, casting a targeted spell or summoning a minion (interpreted as the minion the player is summoning next to), this reference will return the target that the player originally chose regardless of target overriding effects or effects in the sequence that may later destroy or transform the target. -
SPELL_TARGET
This reference allows you to distinguish the target of an effect (the spell target) versus the target selected by a player (theTARGET
).When an effect like a spell card, a battlecry or an enchantment casts a
Spell
with a group reference, the spell is cast separately for each entity in the list of entities after that group reference is resolved. Use this reference to retrieve the specific entity (rather than the group reference) that the spell is currently being evaluated against.For example, suppose you had a spell, "Choose a minion. For each other minion, you have a 50% of dealing damage equal to the minion's attack or the chosen minion's hitpoints". You need some way of referencing the minion being damaged versus the minion that was chosen by the player. Spell target is the minion currently being damaged, while
TARGET
(or inherited from the topmost spell) is the minion that was chosen:"targetSelection": "MINIONS", "spell": { "class": "EitherOrSpell", "target": "ALL_OTHER_MINIONS", "condition": {"class": "RandomCondition"}, "spell1": { "class": "DamageSpell", "value": { "class": "AttributeValueProvider", "target": "SPELL_TARGET", "attribute": "ATTACK" } }, "spell2": { "class": "DamageSpell", "value": { "class": "AttributeValueProvider", "target": "TARGET", "attribute": "HP" } } }
-
EVENT_TARGET
This reference retrieves the (possiblynull
) entity pointed to byGameEvent.getTarget()
. An event target is never itself a group reference; it always retrieves a specific entity.To see which game events generate targets, which can be counter-intuitive, look at the constructors of the various
GameEvent
classes and see how they're called.Some important event targets include:
PhysicalAttackEvent
: The attacker.SpellCastedEvent
: The source cardSummonEvent
: The minion being summoned.AfterSpellCastedEvent
: For a targeted spell, the chosen target or, if it was overridden by an effect, the override.
-
SELF
Returns thesource
of the target resolution.Inside an enchantment's
EventTriggerArg.FIRE_CONDITION
andEventTriggerArg.QUEUE_CONDITION
, which are the conditions that evaluate whether or not the trigger for the enchantment should fire, the source entity is theGameEvent.getSource()
; it is not the entity hosting the trigger. To get the entity hosting the trigger, useTRIGGER_HOST
instead. -
KILLED_MINION
Retrieves a reference to the minion destroyed by aDestroySpell
. -
ATTACKER
This references the attacker during aPhysicalAttackAction
orGameLogic.fight(Player, Actor, Actor, PhysicalAttackAction)
invocation (i.e., aFightSpell
). -
OUTPUT
Use this reference to apply effects to new entities created by spells.For example, to apply a buff to a newly summoned minion:
"spell": { "class": "SummonSpell", "card": "minion_bloodfen_raptor", "spell": { "class": "BuffSpell", "target": "OUTPUT", "attackBonus": 2 } }
LikeSPELL_TARGET
, this reference helps you distinguish between the player's chosenTARGET
, which will be propagated downwards to child spells, and the entity created by something like aSummonSpell
. -
FRIENDLY_DECK
References all the cards in the player's deck. -
ENEMY_DECK
References all the card's in the enemy player's deck. -
BOTH_DECKS
References all the cards in both decks. -
BOTH_HANDS
References all the cards in both hands. -
TRANSFORM_REFERENCE
Deprecated.When a minion gets transformed while it is being summoned, the result of the transformation of the minion is found with this reference.Deprecated by
Entity.transformResolved(GameContext)
. -
RIGHTMOST_FRIENDLY_MINION
References the friendly minion with the largest index in the minions zone, or an empty list if the minion zone is empty.The rightmost minion in the client will appear to be the leftmost one.
-
RIGHTMOST_ENEMY_MINION
References the enemy minion with the largest index in the minions zone, or an empty list if the minion zone is empty.The rightmost minion in the client will appear to be the leftmost one.
-
ATTACKER_ADJACENT_MINIONS
References the minions adjancent to the attacker during aGameLogic.fight(Player, Actor, Actor, PhysicalAttackAction)
sequence. -
FRIENDLY_SET_ASIDE
References the cards and actors located in the friendly set aside zone. Rarely used. -
ENEMY_SET_ASIDE
References the cards and actors located in the enemy set aside zone. Rarely used. -
FRIENDLY_GRAVEYARD
References the cards and actors in the friendly graveyard.TODO: It is not easy to distinguish between cards and actors in the graveyard.
To retrieve cards, use the
GraveyardCardsSource
. To retrieve actors (weapons, minions and heroes that have been destroyed), useGraveyardActorsSource
. -
ENEMY_GRAVEYARD
References the cards and actors in the enemy graveyard.TODO: It is not easy to distinguish between cards and actors in the graveyard.
To retrieve cards, use the
GraveyardCardsSource
. To retrieve actors (weapons, minions and heroes that have been destroyed), useGraveyardActorsSource
. -
ALL_ENTITIES
References all entities in the game, including transformed ones and permanents. Typically used to find attributes about specific cards played or used in the past; or to find specific permanents in play. -
EVENT_SOURCE
References theGameEvent.getSource()
entity when a trigger/enchantment is being evaluated. -
FRIENDLY_TOP_CARD
References the next card the friendly player will draw, or an empty list if no cards remain in the player's deck. -
ENEMY_TOP_CARD
References the next card the opponent will draw, or an empty list if no cards remain in the player's deck. -
FRIENDLY_HERO_POWER
References the card that is currently the friendly player's hero power. -
ENEMY_HERO_POWER
References the card that is currently the enemey player's hero power. -
OTHER_ENEMY_MINIONS
References all the enemy minions excluding the source.Implements Frost Bomb.
-
LEFTMOST_FRIENDLY_CARD_HAND
References the card in the friendly player's hand with the lowest index in the friendly player's hand.Implements Antique Collector and Ironforge Baker.
-
LAST_CARD_PLAYED
References the last card played by either player. It will typically be in the player's hand (before it is casted) or in the graveyard (at most other times).Implements Shadow of the Past.
-
FRIENDLY_LAST_CARD_PLAYED
References the last card played by the friendly player. -
ENEMY_LAST_CARD_PLAYED
References the last card played by the opponent. -
TRIGGER_HOST
References theEntity
that hosts theEnchantment
whose fire condition or spell is currently being evaluated.During a condition evaluation on an
EventTrigger
,SELF
refers toGameEvent.getSource()
, not the host of the trigger whose condition is being evaluated. Use this reference to get the host of the trigger currently being evaluated. -
ENEMY_MINIONS_LEFT_TO_RIGHT
References all the enemy's minions, except ordered by their location on the board instead of their order of play. -
PHYSICAL_ATTACK_TARGETS
References the enemy minions and hero which would ordinarily be targetable by a physical attack from the friendly player's point of view. -
LEFT_ADJACENT_MINION
References the minion to the left of thesource
of this targeting resolution, or a zero-length list if there isn't one -
RIGHT_ADJACENT_MINION
References the minion to the right of thesource
of this targeting resolution, or a zero-length list if there isn't one -
LAST_CARD_PLAYED_BEFORE_CURRENT_SEQUENCE
References the last card played by either player before the end of this current sequence.Implements Study.
-
FRIENDLY_LAST_CARD_PLAYED_BEFORE_CURRENT_SEQUENCE
References the last card played by the friendly player before this current sequence. -
ENEMY_LAST_CARD_PLAYED_BEFORE_CURRENT_SEQUENCE
References the last card played by the opponent before this current sequence. -
FRIENDLY_MINIONS_LEFT_TO_RIGHT
References all the friendly minions, except ordered by their location on the board instead of their order of play. -
ADJACENT_TO_TARGET
References the minions adjacent to the currentTARGET
, i.e., the currently selected target in the pending action. -
FRIENDLY_LAST_DIED_MINION
References the last minion belonging to the friendly player that died. -
FRIENDLY_DECK_FROM_TOP
References all the cards in the player's deck, ordered from the top of the deck towards the bottom. -
CURRENT_SUMMONING_MINION
References the minion that is currently being summoned.This entry is valid from just before
BeforeSummonEvent
is fired and just afterAfterSummonEvent
is fired. Since battlecries are resolved betweenBeforeSummonEvent
andSummonEvent
, this reference may change to the minion being summoned by a battlecry rather than the battlecrying minion itself, depending on when this reference resolved. -
FRIENDLY_CARDS
References all entities that are "in play" for the friendly player i.e. cards in hand, deck, set aside + minions + hero. -
ENEMY_CARDS
References all entities that are "in play" for the enemy player i.e. cards in hand, deck, set aside + minions + hero. -
ENEMY_MIDDLE_MINIONS
References the minions that are in the middle of the enemy's battlefield. This will return two minions when the number of minions on the opponent's battlefield is even. -
FRIENDLY_LAST_MINION_PLAYED
References the last minion card played before this current sequence. -
OTHER_FRIENDLY_CHARACTERS
References a combination ofOTHER_FRIENDLY_MINIONS
and theFRIENDLY_HERO
. -
RIGHTMOST_FRIENDLY_CARD_HAND
References the card in the friendly player's hand with the highest index.Implements Mutamite Terror.
-
LEFTMOST_ENEMY_CARD_HAND
References the card in the enemy player's hand with the lowest index in the enemy player's hand.Implements Mindswapper.
-
FRIENDLY_LAST_SPELL_PLAYED_THIS_TURN
References the last spell played by this player this turn only.Implements Recurring Torrent.
-
OPPOSITE_CHARACTERS
Returns the opposing characters from thesource
. If there is no minion opposite of thesource
, returns the opposing champion instead. -
FRIENDLY_SIGNATURE
-
ENEMY_SIGNATURE
-
FRIENDLY_SECRETS
-
PLAYER_1
-
PLAYER_2
-
-
Constructor Details
-
EntityReference
public EntityReference(int key)
-
-
Method Details
-
pointTo
-
equals
-
getId
public int getId() -
setId
public void setId(int key) -
hashCode
public int hashCode() -
isTargetGroup
public boolean isTargetGroup()Whentrue
, indicates that this entity reference references not to a specificEntity
but to a pointer to an entity, likeSELF
.- Returns:
true
if theid
is negative, which all the specialEntityReference
static elements are.
-
toString
-