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 TypeMethodDescriptionbooleancanBeExecuted(GameContext context, Player player) Computes whether the condition is fulfilled for a battlecry action to be executable.final booleancanBeExecutedOn(GameContext context, Player player, Entity entity) Computes whether the given targetentitycan be targeted by this battlecry.clone()static OpenerActioncreateBattlecry(SpellDesc spell, TargetSelection targetSelection) Creates a battlecry action that performs the specified spell and requests a target.booleanvoidexecute(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.FILTERof the spell.Returns either the target chosen by the user or the predefined target (possible a group reference /EntityReference.isTargetGroup()) written on theSpellDescof the spell.getSource(GameContext context) getSpell()getTargets(GameContext context, int player) For visualization purposes, what are the targets of this notification?inthashCode()voidsetCondition(Condition condition) voidsetTargetSelectionCondition(Condition targetSelectionCondition) voidsetTargetSelectionOverride(TargetSelection targetSelectionOverride) booleanshouldOverrideTargetSelection(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.FILTERto the spell.- Parameters:
spell- The spell to cast for this battlecry action.targetSelection- The target selection to make.- Returns:
- An instance
-
clone
- Overrides:
clonein 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:
trueif this battlecry can be executed generally (if it will even prompt the user for targeting).
-
canBeExecutedOn
Computes whether the given targetentitycan be targeted by this battlecry.- Overrides:
canBeExecutedOnin classGameAction- Parameters:
context- The game contextplayer- The casting playerentity- The target entity- Returns:
trueif the entity is a valid target for the battlecry.
-
execute
Casts thegetSpell()on this action with the specified target.- Specified by:
executein 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 theSpellDescof the spell.- Returns:
- An entity reference
-
getCondition
-
getEntityFilter
Returns theSpellArg.FILTERof the spell.- Returns:
- The filter.
-
getSpell
-
setCondition
-
getSource
- Specified by:
getSourcein interfaceNotification- Overrides:
getSourcein classGameAction
-
getTargets
Description copied from interface:NotificationFor visualization purposes, what are the targets of this notification?- Specified by:
getTargetsin interfaceNotification- Overrides:
getTargetsin classGameAction- Parameters:
context- game contextplayer- the player- Returns:
- A reference to the entity that is the visualizable target of this notification.
-
equals
- Overrides:
equalsin classGameAction
-
hashCode
public int hashCode()- Overrides:
hashCodein classGameAction
-
getDescription
Creates a formatted description for the battlecry given its target.- Specified by:
getDescriptionin interfaceNotification- Overrides:
getDescriptionin classGameAction- Parameters:
context-playerId-- Returns:
-
shouldOverrideTargetSelection
-
getTargetSelectionCondition
-
getTargetSelectionOverride
-
setTargetSelectionCondition
-
setTargetSelectionOverride
-