net.sf.magicproject.clickable.ability
Class ReplacementAbility

java.lang.Object
  extended by net.sf.magicproject.clickable.ability.Ability
      extended by net.sf.magicproject.clickable.ability.UserAbility
          extended by net.sf.magicproject.clickable.ability.TriggeredAbility
              extended by net.sf.magicproject.clickable.ability.ReplacementAbility
All Implemented Interfaces:
Unregisterable, ResolveStackHandler

public class ReplacementAbility
extends TriggeredAbility

TODO is it important to keep cost ?

Since:
0.80
Author:
Fabrice Daugan

Field Summary
 
Fields inherited from class net.sf.magicproject.clickable.ability.Ability
optimizer, priority
 
Constructor Summary
ReplacementAbility(java.io.InputStream inputFile, MCard card)
          Creates a new instance of ReplacementAbility
Structure of InputStream : Data[size] name name + '\0' [...]
 
Method Summary
 Ability clone(MCard container)
          return a copy of this ability
TODO remove param container since it is not used in this constructor As default, return null
 boolean hasHighPriority()
          Indicates wether this ability is choosen in priority to the others without this tag.
 boolean isAutoResolve()
          Indicates if this ability is immediatly after it has been added to the stack.
 boolean isHidden()
          Indicates if this ability is immediatly after it has been added to the stack (like isAutoResolve), and if no information is displayed or prompted to the users.
 boolean isMatching()
          compare the current event to the event activating this ability.
 void registerToManager()
          Add this ability to the looked for events.
 void removeFromManager()
          Remove from the event manager this listener.
 void resolveStack()
          called when the stack is resolving
 boolean triggerIt(ContextEventListener context)
          called when this ability is going to be triggered This method would add this ability to the triggered zone, or perform another play action
 
Methods inherited from class net.sf.magicproject.clickable.ability.TriggeredAbility
getAbilityTitle, getDelayedCard, getLog, isDelayedAbility, setDelayedCard, toHtmlString
 
Methods inherited from class net.sf.magicproject.clickable.ability.UserAbility
actionList, checkObjectActions, checkTargetActions, clickOn, effectList, eventComing, getCard, manaNeeded, mouseClicked, recheckTargets, toString
 
Methods inherited from class net.sf.magicproject.clickable.ability.Ability
addLinkedAbility, equals, getCardCopy, getController, getName, getPictureName, getTargetable, getTriggeredClone, getTriggeredCloneChoice, hashCode, isPlayAsSpell, optimizeRegisterToManager, setEvent
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplacementAbility

public ReplacementAbility(java.io.InputStream inputFile,
                          MCard card)
                   throws java.io.IOException
Creates a new instance of ReplacementAbility

Parameters:
inputFile -
card -
Throws:
java.io.IOException - if error occurred during the reading process from the specified input stream
Method Detail

triggerIt

public boolean triggerIt(ContextEventListener context)
Description copied from class: Ability
called when this ability is going to be triggered This method would add this ability to the triggered zone, or perform another play action

Overrides:
triggerIt in class UserAbility
Parameters:
context - the context needed by event activated
Returns:
true if this ability has been added to the triggered buffer zone, return false otherwise

resolveStack

public void resolveStack()
Description copied from interface: ResolveStackHandler
called when the stack is resolving

Specified by:
resolveStack in interface ResolveStackHandler
Overrides:
resolveStack in class Ability
See Also:
StackManager.resolveStack()

clone

public Ability clone(MCard container)
Description copied from class: Ability
return a copy of this ability
TODO remove param container since it is not used in this constructor As default, return null

Overrides:
clone in class TriggeredAbility
Parameters:
container - is not used here
Returns:
copy of this ability

isMatching

public boolean isMatching()
Description copied from class: Ability
compare the current event to the event activating this ability. If matching, verify that there enougth mana in the player's mana pool

Overrides:
isMatching in class TriggeredAbility
Returns:
true if this ability can be played responding the current event

removeFromManager

public void removeFromManager()
Description copied from interface: Unregisterable
Remove from the event manager this listener.

Specified by:
removeFromManager in interface Unregisterable
Overrides:
removeFromManager in class TriggeredAbility

isAutoResolve

public final boolean isAutoResolve()
Description copied from interface: ResolveStackHandler
Indicates if this ability is immediatly after it has been added to the stack. Note it's not says immediatly it has been triggered or playable, but says it has been activated - so added directly to the stack -, or has been triggered - so added to the triggered buffer zone - and then has been selected to be moved to the stack.

Specified by:
isAutoResolve in interface ResolveStackHandler
Overrides:
isAutoResolve in class Ability
Returns:
true if this ability is immediatly after it has been added to the stack.

isHidden

public final boolean isHidden()
Description copied from interface: ResolveStackHandler
Indicates if this ability is immediatly after it has been added to the stack (like isAutoResolve), and if no information is displayed or prompted to the users. Users would not see this ability played.

Specified by:
isHidden in interface ResolveStackHandler
Overrides:
isHidden in class Ability
Returns:
true if this ability is immediatly after it has been added to the stack (like isAutoResolve), and if no information is displayed or prompted to the users. Users would not see this ability played.
See Also:
ResolveStackHandler.isAutoResolve()

hasHighPriority

public final boolean hasHighPriority()
Description copied from class: Ability
Indicates wether this ability is choosen in priority to the others without this tag.

Overrides:
hasHighPriority in class Ability
Returns:
true if this ability is choosen in priority to the others without this tag.

registerToManager

public void registerToManager()
Description copied from class: Ability
Add this ability to the looked for events. Linked abilities are also registered.

Overrides:
registerToManager in class Ability


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