net.sf.magicproject.event
Class MEventListener

java.lang.Object
  extended by net.sf.magicproject.event.MEventListener
All Implemented Interfaces:
RegisterableEvent
Direct Known Subclasses:
CanICast, TriggeredEvent

public abstract class MEventListener
extends java.lang.Object
implements RegisterableEvent

Since:
0.53 support additional check registers
Author:
Fabrice Daugan
See Also:
Event

Field Summary
static java.util.List<Ability>[] CAN_I_CAST_ABILITIES
          Represent all activated abilities/spell playable.
 MCard card
          card owning this event
static java.util.Map<Event,java.util.Map<Priority,java.util.List<ReplacementAbility>>> REPLACEMENT_ABILITIES
          Represent all active replacement abilities of games for each event and each priority.
 Test test
          additional code to check.
static java.util.Map<Event,java.util.List<Ability>> TRIGGRED_ABILITIES
          Represent all active triggered abilities of games for each event
 
Method Summary
 MEventListener appendOr(MEventListener other)
          Create and returns an union of this event and the specified one.
abstract  MEventListener clone(MCard card)
          Return a copy of this with the specified owner
abstract  Event getIdEvent()
          Return the idEvent of this event
 int getIdPlace()
          return idZone of this card, whitout any code tap, untapped..)
abstract  boolean isActivated()
          Indicates if this event corresponds to an activated ability
abstract  boolean isTriggered()
          Indicates if this event corresponds to a triggered ability
 boolean isWellPlaced()
          Tell if the card is well placed for this event to be playable
 boolean isWellPlaced(int idZone)
          Tell if the card is well placed for this event to be playable
 boolean reCheck(ContextEventListener previousContext, Ability ability)
          Tell if the event still activated before to be added to the stack
 boolean reCheck(TriggeredCard triggered)
          Tell if the event still activated before to be added to the stack
abstract  void registerToManager(Ability ability)
          register this event to the event manager
abstract  void removeFromManager(Ability ability)
          remove from the manager this event if doesn't match with the new context
static void reset()
          Reset all instant, empty-stack and triggered abilities.
 java.lang.String toHtmlString(Ability ability, ContextEventListener context)
          Return the HTML code representing this ability.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

test

public Test test
additional code to check.


card

public MCard card
card owning this event


TRIGGRED_ABILITIES

public static final java.util.Map<Event,java.util.List<Ability>> TRIGGRED_ABILITIES
Represent all active triggered abilities of games for each event


REPLACEMENT_ABILITIES

public static final java.util.Map<Event,java.util.Map<Priority,java.util.List<ReplacementAbility>>> REPLACEMENT_ABILITIES
Represent all active replacement abilities of games for each event and each priority.


CAN_I_CAST_ABILITIES

public static final java.util.List<Ability>[] CAN_I_CAST_ABILITIES
Represent all activated abilities/spell playable. One index per player.

Method Detail

toHtmlString

public java.lang.String toHtmlString(Ability ability,
                                     ContextEventListener context)
Return the HTML code representing this ability.

Parameters:
ability - is the attached ability.
context - the context needed by event activated
Returns:
the HTML code representing this ability.
Since:
0.85 Event is displayed

getIdEvent

public abstract Event getIdEvent()
Return the idEvent of this event

Returns:
the idEvent of this event

registerToManager

public abstract void registerToManager(Ability ability)
Description copied from interface: RegisterableEvent
register this event to the event manager

Specified by:
registerToManager in interface RegisterableEvent
Parameters:
ability - owning this event

removeFromManager

public abstract void removeFromManager(Ability ability)
Description copied from interface: RegisterableEvent
remove from the manager this event if doesn't match with the new context

Specified by:
removeFromManager in interface RegisterableEvent
Parameters:
ability - owning this event

clone

public abstract MEventListener clone(MCard card)
Return a copy of this with the specified owner

Parameters:
card - is the card of the ability of this event
Returns:
copy of this event

getIdPlace

public int getIdPlace()
return idZone of this card, whitout any code tap, untapped..)

Returns:
idZone of this card, whitout any code tap, untapped..)

isWellPlaced

public boolean isWellPlaced()
Tell if the card is well placed for this event to be playable

Returns:
true if the card is well placed for this event to be playable

isWellPlaced

public boolean isWellPlaced(int idZone)
Tell if the card is well placed for this event to be playable

Parameters:
idZone - the supposed zone where card is.
Returns:
true if the card is well placed for this event to be playable

reCheck

public boolean reCheck(ContextEventListener previousContext,
                       Ability ability)
Tell if the event still activated before to be added to the stack

Parameters:
previousContext -
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 current event match with this event

reCheck

public boolean reCheck(TriggeredCard triggered)
Tell if the event still activated before to be added to the stack

Parameters:
triggered - the triggered card.
Returns:
true if the current event match with this event

reset

public static void reset()
Reset all instant, empty-stack and triggered abilities. After the call to this method, there is no event listener able to be activated


appendOr

public MEventListener appendOr(MEventListener other)
Create and returns an union of this event and the specified one. Both event must have the same type. Test(s) and events attributes may be groupped depending instance of this event. If no possible append is possible null is returned.

Parameters:
other - the event to append with 'or' operator.
Returns:
a new event reprensenting 'this' or 'other'

isActivated

public abstract boolean isActivated()
Indicates if this event corresponds to an activated ability

Returns:
true if this event corresponds to an activated ability

isTriggered

public abstract boolean isTriggered()
Indicates if this event corresponds to a triggered ability

Returns:
true if this event corresponds to a triggered ability


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