net.sf.magicproject.action.handler
Interface InitAction

All Superinterfaces:
Replayable
All Known Implementing Classes:
Hop, Input, InputChoice, MessagingAction, ModifyTargetableRegister, PayMana, RealTarget, Repeat

public interface InitAction
extends Replayable

An init action is an action played during the initialization phase of an ability, and also replayed during the replay phase.

Since:
0.90
Author:
Fabrice Daugan

Method Summary
 boolean init(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
          No generated event.
 boolean replay(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
          Generate event associated to this action.
 

Method Detail

init

boolean init(ActionContextWrapper actionContext,
             ContextEventListener context,
             Ability ability)
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.

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.

replay

boolean replay(ActionContextWrapper actionContext,
               ContextEventListener context,
               Ability ability)
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 Replayable
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.


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