net.sf.magicproject.action
Class InputChoice

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

public class InputChoice
extends MessagingAction

Propose to choose within several valid actions list. If 'hop' attribute is specified and is 'true', cancel option would be available during the choice.

Since:
0.85, 0.86 non valid choices are not proposed
Author:
Fabrice Daugan

Method Summary
 boolean checkTarget(Ability ability, int actionIndex)
          Verify if this target action may cause abortion of the current ability.
 Actiontype getIdAction()
          Return the index of this action.
 int getSkipHop()
          Return the hop to do to skip 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.
 java.lang.String toHtmlString(Ability ability, ContextEventListener context)
          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.MessagingAction
finishedMessage, init, replayAction
 
Methods inherited from class net.sf.magicproject.action.UserAction
getActionName, manaNeeded, 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 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
Specified by:
play in class MessagingAction
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 final 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
Overrides:
replay in class MessagingAction
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.

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()

toHtmlString

public java.lang.String toHtmlString(Ability ability,
                                     ContextEventListener context)
Description copied from class: MAction
Return the HTML code representing this action. If no picture is associated to this action, only text will be returned.

Overrides:
toHtmlString 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.
context - is the context attached to this action.
Returns:
the HTML code representing this action. If no picture is associated to this action, only text will be returned.
See Also:
MAction.toString(Ability), MAction.toHtmlString(Ability, int, ContextEventListener)

checkTarget

public final boolean checkTarget(Ability ability,
                                 int actionIndex)
Verify if this target action may cause abortion of the current ability.

Parameters:
ability - is the ability owning this action. The card component of this ability should correspond to the card owning this test too.
actionIndex - the choosen action index
Returns:
true if this target action may cause abortion of the current ability.

getSkipHop

public int getSkipHop()
Return the hop to do to skip this action.

Returns:
the hop to do to skip this action.


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