net.sf.magicproject.action
Class MAction

java.lang.Object
  extended by net.sf.magicproject.action.MAction
Direct Known Subclasses:
AddModifierFromStaticModifier, RefreshModifier, RemoveMe, UnregisterThis, UserAction, WaitActivatedChoice, WaitChoosenActionChoice, WaitTriggeredBufferChoice

public abstract class MAction
extends java.lang.Object

This class is representing an atom action. Each action can generate more than an event.

Since:
0.3, 0.85 named action, and complex constraints are supported.
Author:
Fabrice Daugan

Method Summary
 boolean equal(MAction constraintAction)
          Return true if this action matches with the given action.
 java.lang.String getActionName()
          Return the name of this action
abstract  Actiontype getIdAction()
          Return the index of this action.
 int[] manaNeeded(Ability ability, ContextEventListener context)
          Return the amount of mana needed (constant part only) to play this ability As default, we return an empty number for all manas.
 Test parseTest(Test test)
          Return the given test where values depending on values of this action have been replaced.
 java.lang.String toHtmlString(Ability ability, ContextEventListener context)
          Return the HTML code representing this action.
 java.lang.String toHtmlString(Ability ability, int times, ContextEventListener context)
          Return the HTML code representing this action.
 java.lang.String toString()
           
abstract  java.lang.String toString(Ability ability)
          String representation of this action.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getIdAction

public abstract Actiontype getIdAction()
Return the index of this action. As default, this is a zero id

Returns:
the index of this action.
See Also:
Actiontype

manaNeeded

public int[] manaNeeded(Ability ability,
                        ContextEventListener context)
Return the amount of mana needed (constant part only) to play this ability As default, we return an empty number for all manas.

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
context - the context of playing ability.
Returns:
array of mana needed to play this ability

toHtmlString

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

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.
Since:
0.85
See Also:
toString(Ability), toHtmlString(Ability, int, ContextEventListener)

toHtmlString

public java.lang.String toHtmlString(Ability ability,
                                     int times,
                                     ContextEventListener context)
Return the HTML code representing this action. If this action is named, it's name will be returned. If not, if existing, the picture associated to this action is returned. Otherwise, built-in action's text will be returned.

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
times - the times to repeat this action.
context - is the context attached to this action.
Returns:
the HTML code representing this action. If this action is named, it's name will be returned. If not, if existing, the picture associated to this action is returned. Otherwise, built-in action's text will be returned.
Since:
0.85
See Also:
toString(Ability), toHtmlString(Ability, ContextEventListener)

toString

public abstract java.lang.String toString(Ability ability)
String representation of this action.

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

parseTest

public Test parseTest(Test test)
Return the given test where values depending on values of this action have been replaced.

Parameters:
test - the test containing eventually some values depending on parameters of this action.
Returns:
a parsed test.
Since:
0.85

equal

public boolean equal(MAction constraintAction)
Return true if this action matches with the given action.

Parameters:
constraintAction - the constraint action.
Returns:
true if this action matches with the given action.
Since:
0.85

getActionName

public java.lang.String getActionName()
Return the name of this action

Returns:
the name of this action


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