Class OpenerAction
java.lang.Object
net.demilich.metastone.game.actions.GameAction
net.demilich.metastone.game.actions.OpenerAction
- All Implemented Interfaces:
Serializable
,Cloneable
,Notification
Battlecry actions occur when
Actor
entities are played from cards and
have battlecries. A battlecry is a possibly targeted effect.- See Also:
-
Field Summary
FieldsFields inherited from class net.demilich.metastone.game.actions.GameAction
chooseOneOptionIndex
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeExecuted
(GameContext context, Player player) Computes whether the condition is fulfilled for a battlecry action to be executable.final boolean
canBeExecutedOn
(GameContext context, Player player, Entity entity) Computes whether the given targetentity
can be targeted by this battlecry.clone()
static OpenerAction
createBattlecry
(SpellDesc spell, TargetSelection targetSelection) Creates a battlecry action that performs the specified spell and requests a target.boolean
void
execute
(GameContext context, int playerId) Casts thegetSpell()
on this action with the specified target.getDescription
(GameContext context, int playerId) Creates a formatted description for the battlecry given its target.Returns theSpellArg.FILTER
of the spell.Returns either the target chosen by the user or the predefined target (possible a group reference /EntityReference.isTargetGroup()
) written on theSpellDesc
of the spell.getSource
(GameContext context) getSpell()
getTargets
(GameContext context, int player) For visualization purposes, what are the targets of this notification?int
hashCode()
void
setCondition
(Condition condition) void
setTargetSelectionCondition
(Condition targetSelectionCondition) void
setTargetSelectionOverride
(TargetSelection targetSelectionOverride) boolean
shouldOverrideTargetSelection
(GameContext context, Player player, Actor actor) Methods inherited from class net.demilich.metastone.game.actions.GameAction
getActionType, getChooseOneOptionIndex, getId, getSource, getSourceReference, getTargetReference, getTargetRequirement, isClientInterested, isOverrideChild, isPowerHistory, setActionType, setChooseOneOptionIndex, setId, setOverrideChild, setSourceReference, setTarget, setTargetReference, setTargetRequirement, toString, withTargetReference
-
Field Details
-
NONE
-
-
Constructor Details
-
OpenerAction
-
-
Method Details
-
createBattlecry
Creates a battlecry action that performs the specified spell and requests a target.To filter the target, make sure to add a
SpellArg.FILTER
to the spell.- Parameters:
spell
- The spell to cast for this battlecry action.targetSelection
- The target selection to make.- Returns:
- An instance
-
clone
- Overrides:
clone
in classGameAction
-
canBeExecuted
Computes whether the condition is fulfilled for a battlecry action to be executable. Conditions are not evaluated against targets.- Parameters:
context
- The game contextplayer
- The casting player- Returns:
true
if this battlecry can be executed generally (if it will even prompt the user for targeting).
-
canBeExecutedOn
Computes whether the given targetentity
can be targeted by this battlecry.- Overrides:
canBeExecutedOn
in classGameAction
- Parameters:
context
- The game contextplayer
- The casting playerentity
- The target entity- Returns:
true
if the entity is a valid target for the battlecry.
-
execute
Casts thegetSpell()
on this action with the specified target.- Specified by:
execute
in classGameAction
- Parameters:
context
- The game contextplayerId
- The casting player.- See Also:
-
getPredefinedSpellTargetOrUserTarget
Returns either the target chosen by the user or the predefined target (possible a group reference /EntityReference.isTargetGroup()
) written on theSpellDesc
of the spell.- Returns:
- An entity reference
-
getCondition
-
getEntityFilter
Returns theSpellArg.FILTER
of the spell.- Returns:
- The filter.
-
getSpell
-
setCondition
-
getSource
- Specified by:
getSource
in interfaceNotification
- Overrides:
getSource
in classGameAction
-
getTargets
Description copied from interface:Notification
For visualization purposes, what are the targets of this notification?- Specified by:
getTargets
in interfaceNotification
- Overrides:
getTargets
in classGameAction
- Parameters:
context
- game contextplayer
- the player- Returns:
- A reference to the entity that is the visualizable target of this notification.
-
equals
- Overrides:
equals
in classGameAction
-
hashCode
public int hashCode()- Overrides:
hashCode
in classGameAction
-
getDescription
Creates a formatted description for the battlecry given its target.- Specified by:
getDescription
in interfaceNotification
- Overrides:
getDescription
in classGameAction
- Parameters:
context
-playerId
-- Returns:
-
shouldOverrideTargetSelection
-
getTargetSelectionCondition
-
getTargetSelectionOverride
-
setTargetSelectionCondition
-
setTargetSelectionOverride
-