net.sf.magicproject.action
Class MoveCard

java.lang.Object
  extended by net.sf.magicproject.action.MAction
      extended by net.sf.magicproject.action.UserAction
          extended by net.sf.magicproject.action.MoveCard
All Implemented Interfaces:
AccessibleContext, BackgroundMessaging, FollowAction, RollBackAction, LoopAction

public class MoveCard
extends UserAction
implements LoopAction, FollowAction, BackgroundMessaging, AccessibleContext

To move the current target list from their place to another. New position within the new zone, and the new controller have to be specified.

Since:
0.54, 0.80 activable abilities of card are registered before the 'moved card' is generated, 0.80 support replacement, 0.82 card is moved into the destination zone before the event is generated. During the event dispatching there is an incoherence., 0.82 timestamp is checked, 0.82 if there are several cards to move, controller chooses order, 0.86 action ignore non-card element present in the target list
Version:
0.91
Author:
Fabrice Daugan , Stefano "Kismet" Lenzi

Method Summary
 boolean continueLoop(ContextEventListener context, int loopingIndex, Ability ability)
          Continue this action, giving the next index of this loop.
 int getAccessibleInt(java.lang.String attribute)
          Return the shared number from the given attribute.
 Targetable getAccessibleTargetable(java.lang.String attribute)
          Return the shared targetable object from the given attribute.
 Actiontype getIdAction()
          return the id of this action.
 int getStartIndex()
          Return the first index of this loop.
static boolean moveCard(MCard movingCard, Player controller, int destination, ContextEventListener context, int idPosition, Ability ability, boolean silentMode)
           
static boolean moveCard(MCard card, TestOn controller, int destination, ContextEventListener context, int idPosition, Ability ability, boolean silentMode)
          Move a card in a zone with a specified new controller.
 void receiveMoveOrder(int[] order)
          This method is called when the oponent has finished to choose the order of moves.
 void replayAction(ContextEventListener context, Ability ability, Wizard wizard)
          Replay the current action as it was when it has been suspended.
 void rollback(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
          No generated event.
 void simulate(ActionContextWrapper actionContext, ContextEventListener context, Ability ability)
          No generated event.
 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

replayAction

public final void replayAction(ContextEventListener context,
                               Ability ability,
                               Wizard wizard)
Description copied from interface: BackgroundMessaging
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

getIdAction

public final Actiontype getIdAction()
return the id of this action. This action has been read from the mdb file.

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

moveCard

public static boolean moveCard(MCard card,
                               TestOn controller,
                               int destination,
                               ContextEventListener context,
                               int idPosition,
                               Ability ability,
                               boolean silentMode)
Move a card in a zone with a specified new controller.

Parameters:
card - the card to move.
controller - the new controller.
destination - the new zone.
context - the context of current ability.
idPosition - the new state of this card.
ability - the current ability.
silentMode - Is the silent mode is enabled while playing.
Returns:
true if the card has been moved.

moveCard

public static boolean moveCard(MCard movingCard,
                               Player controller,
                               int destination,
                               ContextEventListener context,
                               int idPosition,
                               Ability ability,
                               boolean silentMode)
Parameters:
movingCard - the card to move.
controller - the new controller.
destination - the new zone.
context - the context of current ability.
idPosition - the new state of this card.
ability - the current ability.
silentMode - Is the silent mode is enabled for this move.
Returns:
true if the card has been moved.

continueLoop

public boolean continueLoop(ContextEventListener context,
                            int loopingIndex,
                            Ability ability)
Description copied from interface: LoopAction
Continue this action, giving the next index of this loop.

Specified by:
continueLoop in interface LoopAction
Parameters:
context - is the context attached to this action.
loopingIndex - the current index
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 action.

receiveMoveOrder

public void receiveMoveOrder(int[] order)
This method is called when the oponent has finished to choose the order of moves.

Parameters:
order - integer array corresponding to the order of cards owned by opponent.

getStartIndex

public int getStartIndex()
Description copied from interface: LoopAction
Return the first index of this loop.

Specified by:
getStartIndex in interface LoopAction
Returns:
the first index of this loop.

rollback

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

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

simulate

public void simulate(ActionContextWrapper actionContext,
                     ContextEventListener context,
                     Ability ability)
Description copied from interface: FollowAction
No generated event. Simulate an action. This action is considered as completed afterthis call, and th stack resolution should continue.

Specified by:
simulate in interface FollowAction
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 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()

getAccessibleInt

public int getAccessibleInt(java.lang.String attribute)
Description copied from interface: AccessibleContext
Return the shared number from the given attribute.

Specified by:
getAccessibleInt in interface AccessibleContext
Parameters:
attribute - the requested targetable key.
Returns:
the shared number from the given attribute.

getAccessibleTargetable

public Targetable getAccessibleTargetable(java.lang.String attribute)
Description copied from interface: AccessibleContext
Return the shared targetable object from the given attribute.

Specified by:
getAccessibleTargetable in interface AccessibleContext
Parameters:
attribute - the requested targetable key.
Returns:
the shared targetable from the given attribute.


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