|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.magicproject.action.MAction net.sf.magicproject.action.UserAction net.sf.magicproject.action.Target net.sf.magicproject.action.target.ChoosenTarget
public abstract class ChoosenTarget
Add to the target list card(s) or player(s) following the specified mode and
the specified type. If mode is 'choose' or 'opponentchoose', then a
'targeted' event is raised when the choice is made. In case of 'all',
'random', 'myself' or any target known with acces register, no event is
generated. The friendly test, and the type are necessary only for the modes
'random', 'all', 'choose' and 'opponentchoose' to list the valids targets.
The target list is used by the most actions.
For example, if the next action 'damage', all cards/player from the target
list would be damaged. When a new ability is added to the stack, a new list
is created and attached to it. Actions may modify, acceess it until the
ability is completely resolved.
Method Summary | |
---|---|
boolean |
checkTarget(Ability ability,
int hopCounter)
Verify if this target action may cause abortion of the current ability. |
boolean |
choose(ActionContextWrapper actionContext,
ContextEventListener context,
Ability ability)
No generated event. |
boolean |
clickOn(MCard target)
Called to specify the card chosen for the current action by the handed player |
boolean |
clickOn(Player target)
Called to specify the player chosen for the current action by the handed player |
void |
disactivate(ActionContextWrapper actionContext,
ContextEventListener context,
Ability ability)
No generated event. |
void |
finished()
Called when this action is finished (aborted or completed). |
boolean |
init(ActionContextWrapper actionContext,
ContextEventListener context,
Ability ability)
No generated event. |
abstract boolean |
isTargeting()
Is this action is really targeting. |
boolean |
isValidTarget(MCard target)
Is the specified card is a valid target? |
boolean |
isValidTarget(Player target)
Is the specified player is a valid target? |
boolean |
manualSkip()
Called by the handed player when he/she wants to skip/abort this action. |
boolean |
play(ContextEventListener context,
Ability ability)
Generate event associated to this action. |
boolean |
replay(ActionContextWrapper actionContext,
ContextEventListener context,
Ability ability)
Generate event associated to this action. |
void |
rollback(ActionContextWrapper actionContext,
ContextEventListener context,
Ability ability)
No generated event. |
boolean |
succeedClickOn(MCard card)
This function should be called by the 'clickOn' caller in case of the specified card has been handled during the checking validity of this click in the clickOn(MCard) function. |
boolean |
succeedClickOn(Player player)
This function should be called by the 'clickOn' caller in case of the specified player has been handled during the checking validity of this click in the clickOn(Player) function. |
java.lang.String |
toHtmlString(Ability ability,
ContextEventListener context,
ActionContextWrapper actionContext)
Return the HTML code representing this action. |
java.lang.String |
toString(Ability ability)
String representation of this action. |
Methods inherited from class net.sf.magicproject.action.Target |
---|
getIdAction |
Methods inherited from class net.sf.magicproject.action.UserAction |
---|
getActionName, manaNeeded, toHtmlString, toHtmlString |
Methods inherited from class net.sf.magicproject.action.MAction |
---|
equal, parseTest, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public final void rollback(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
RollBackAction
rollback
in interface RollBackAction
rollback
in class Target
actionContext
- the context containing data saved by this action during the
'choose" proceess.context
- is the context attached to this action.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.public boolean init(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
actionContext
- the context containing data saved by this action during the
'choose" proceess.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.context
- is the context attached to this action.
public void disactivate(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
ChoosenAction
disactivate
in interface ChoosenAction
actionContext
- the context containing data saved by this action during the
'choose" proceess.context
- is the context attached to this action.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.public final boolean replay(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
Target
replay
in interface ChoosenAction
replay
in interface Replayable
replay
in class Target
actionContext
- the context containing data saved by this action during the
'choose" proceess.context
- is the context attached to this action.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.
public boolean choose(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
ChoosenAction
choose
in interface ChoosenAction
actionContext
- the context containing data saved by this action during the
'choose" proceess.context
- is the context attached to this action.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.
public final boolean play(ContextEventListener context, Ability ability)
StandardAction
play
in interface StandardAction
play
in class Target
context
- is the context attached to this action.ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.
public final boolean clickOn(MCard target)
WaitingCard
clickOn
in interface WaitingCard
target
- the clicked card by the handed player for the current action
public final boolean clickOn(Player target)
WaitingPlayer
clickOn
in interface WaitingPlayer
target
- the clicked player by the handed player for the current action
public final boolean succeedClickOn(Player player)
WaitingPlayer
clickOn(Player)
function.
succeedClickOn
in interface WaitingPlayer
player
- the player that was clicked and successfuly handled by the
clickOn(Player)
function.
public final boolean succeedClickOn(MCard card)
WaitingCard
clickOn(MCard)
function.
succeedClickOn
in interface WaitingCard
card
- the card that was clicked and successfuly handled by the
clickOn(MCard)
function.
public final void finished()
Waiting
finished
in interface Waiting
finished
in interface WaitingCard
finished
in interface WaitingPlayer
public final boolean isValidTarget(MCard target)
target
- the tested card.
public final boolean isValidTarget(Player target)
target
- the tested player.
public final boolean manualSkip()
Waiting
manualSkip
in interface Waiting
manualSkip
in interface WaitingCard
manualSkip
in interface WaitingPlayer
public java.lang.String toString(Ability ability)
MAction
toString
in class Target
ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.
Object.toString()
public java.lang.String toHtmlString(Ability ability, ContextEventListener context, ActionContextWrapper actionContext)
ChoosenAction
toHtmlString
in interface ChoosenAction
ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.context
- is the context attached to this action.actionContext
- the context of this action.
public abstract boolean isTargeting()
public final boolean checkTarget(Ability ability, int hopCounter)
ability
- is the ability owning this test. The card component of this
ability should correspond to the card owning this test too.hopCounter
- the minimum valid target to have. If is negative or zero return
true.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |