net.sf.magicproject.action
Class MessagingAction

java.lang.Object
  extended by net.sf.magicproject.action.MAction
      extended by net.sf.magicproject.action.UserAction
          extended by net.sf.magicproject.action.MessagingAction
All Implemented Interfaces:
BackgroundMessaging, InitAction, Replayable, StandardAction
Direct Known Subclasses:
Input, InputChoice

public abstract class MessagingAction
extends UserAction
implements BackgroundMessaging, StandardAction, InitAction

Since:
0.86
Author:
Fabrice Daugan

Method Summary
static void finishedMessage(int optionAnswer, int indexAnswer, ContextEventListener context, Ability ability, ActionContextWrapper actionContext)
          The returned value is piped to the 'modifyregister' action.
 boolean init(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
          No generated event.
abstract  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 replayAction(ContextEventListener context, Ability ability, Wizard wizard)
          Replay the current action as it was when it has been suspended.
 
Methods inherited from class net.sf.magicproject.action.UserAction
getActionName, getIdAction, manaNeeded, toHtmlString, toHtmlString, toString
 
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

replayAction

public final void replayAction(ContextEventListener context,
                               Ability ability,
                               Wizard wizard)
Replay the current action as it was when it has been suspended.

Specified by:
replayAction in interface BackgroundMessaging
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.
wizard - the hidden wizard frame

finishedMessage

public static final void finishedMessage(int optionAnswer,
                                         int indexAnswer,
                                         ContextEventListener context,
                                         Ability ability,
                                         ActionContextWrapper actionContext)
The returned value is piped to the 'modifyregister' action.

Parameters:
optionAnswer - the option value. yes/no/cancel,...
indexAnswer - the optionnal value.
context - the context of playing ability.
ability - the playing ability.
actionContext - the context of this action.

init

public final boolean init(ActionContextWrapper actionContext,
                          ContextEventListener context,
                          Ability ability)
Description copied from interface: InitAction
No generated event. Let the active player playing this action.
Generally, this method is used to initialize the context of this action such as required mana, or fixing some values.
Be aware this method can be called several times if there it is in a loop (hop usage), so manage this case to prevent a reset of context each time this method is called during the initialization phase.

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

replay

public boolean replay(ActionContextWrapper actionContext,
                      ContextEventListener context,
                      Ability ability)
Description copied from interface: InitAction
Generate event associated to this action. One or several events are generated and may be collected by event listeners. Then play this action.
In this method, you should use the context you have stored in the initialization phase with the init method.
This method is only called once, so all stuffs (action and event) must be done in one shot.

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

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.


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