net.sf.magicproject.action
Class Target

java.lang.Object
  extended by net.sf.magicproject.action.MAction
      extended by net.sf.magicproject.action.UserAction
          extended by net.sf.magicproject.action.Target
All Implemented Interfaces:
RollBackAction, StandardAction
Direct Known Subclasses:
AbstractTarget, ChoosenTarget

public abstract class Target
extends UserAction
implements StandardAction, RollBackAction

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 required 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.

Author:
Fabrice Daugan

Method Summary
 Actiontype getIdAction()
          Return the index of this action.
abstract  boolean play(ContextEventListener context, Ability ability)
          Generate event associated to this action.
abstract  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.
abstract  java.lang.String toString(Ability ability)
          String representation of this action.
 
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

getIdAction

public final Actiontype getIdAction()
Description copied from class: MAction
Return the index of this action. As default, this is a zero id

Specified by:
getIdAction in class UserAction
Returns:
the index of this action.
See Also:
Actiontype

play

public abstract boolean play(ContextEventListener context,
                             Ability ability)
Description copied from interface: StandardAction
Generate event associated to this action. Only one or several events are generated and may be collected by event listeners. Then play this action

Specified by:
play in interface StandardAction
Parameters:
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.
Returns:
true if the stack can be resolved just after this call.

replay

public abstract boolean replay(ActionContextWrapper actionContext,
                               ContextEventListener context,
                               Ability ability)
Generate event associated to this action. Only one or several events are generated and may be collected by event listeners. Then play this action

Parameters:
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.
Returns:
true if the stack can be resolved just after this call.

rollback

public void rollback(ActionContextWrapper actionContext,
                     ContextEventListener context,
                     Ability ability)
Description copied from interface: RollBackAction
No generated event. Rollback an action.

Specified by:
rollback in interface RollBackAction
Parameters:
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.

toString

public abstract java.lang.String toString(Ability ability)
Description copied from class: MAction
String representation of this action.

Specified by:
toString in class UserAction
Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
Returns:
action name.
See Also:
Object.toString()


Copyright © 2003-2007 Magic-Project. All Rights Reserved.