net.sf.magicproject.event
Class MovedCard

java.lang.Object
  extended by net.sf.magicproject.event.MEventListener
      extended by net.sf.magicproject.event.TriggeredEvent
          extended by net.sf.magicproject.event.MovedCard
All Implemented Interfaces:
RegisterableEvent

public class MovedCard
extends TriggeredEvent

Since:
0.54, 0.80 support replacement
Author:
Fabrice Daugan

Field Summary
static Event EVENT
          The event type.
 
Fields inherited from class net.sf.magicproject.event.TriggeredEvent
replacement
 
Fields inherited from class net.sf.magicproject.event.MEventListener
CAN_I_CAST_ABILITIES, card, REPLACEMENT_ABILITIES, test, TRIGGRED_ABILITIES
 
Constructor Summary
MovedCard(java.io.InputStream inputFile, MCard card)
          Create an instance of MEventListener by reading a file Offset's file must pointing on the first byte of this event
Structure of InputStream : Data[size] idZone [1] test to apply on source [...]
MovedCard(int idPlace, Test testSource, Test testDestination, MCard card)
          Creates a new instance of CanICast specifying all attributes of this class.
 
Method Summary
 MEventListener clone(MCard card)
          Return a copy of this with the specified owner
static void dispatchEvent(MCard movingCard, int idPlaceDest, Player newController, boolean silentMode)
          Dispatch this event to all active event listeners able to understand this event.
 boolean equals(java.lang.Object other)
           
 Event getIdEvent()
          Return the idEvent of this event
 boolean isMatching(Ability ability, MCard movingCard)
          Tell if the current event matches with this event.
 boolean reCheck(ContextEventListener previousContext, Ability ability)
          Tell if the event still activated before to be added to the stack
static boolean tryAction(MCard movingCard, int idPlaceDest, Player newController, boolean silentMode)
          Dispatch this event to all active event listeners able to understand this event.
 
Methods inherited from class net.sf.magicproject.event.TriggeredEvent
isActivated, isTriggered, registerToManager, removeFromManager, toHtmlString
 
Methods inherited from class net.sf.magicproject.event.MEventListener
appendOr, getIdPlace, isWellPlaced, isWellPlaced, reCheck, reset
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT

public static final Event EVENT
The event type.

Constructor Detail

MovedCard

public MovedCard(java.io.InputStream inputFile,
                 MCard card)
          throws java.io.IOException
Create an instance of MEventListener by reading a file Offset's file must pointing on the first byte of this event

Parameters:
inputFile - is the file containing this event
card - is the card owning this event
Throws:
java.io.IOException - if error occurred during the reading process from the specified input stream

MovedCard

public MovedCard(int idPlace,
                 Test testSource,
                 Test testDestination,
                 MCard card)
Creates a new instance of CanICast specifying all attributes of this class. All parameters are copied, not cloned. So this new object shares the card and the specified codes

Parameters:
idPlace - the place constraint to activate this event
testSource - the test of this event, this one is applied on source
testDestination - test to apply on destination
card - is the card owning this card
Method Detail

clone

public MEventListener clone(MCard card)
Description copied from class: MEventListener
Return a copy of this with the specified owner

Specified by:
clone in class TriggeredEvent
Parameters:
card - is the card of the ability of this event
Returns:
copy of this event

isMatching

public boolean isMatching(Ability ability,
                          MCard movingCard)
Tell if the current event matches with this event. If there is an additional code to check, it'would be checked if the main event matches with the main event

Parameters:
movingCard - the moving card
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(ContextEventListener previousContext,
                       Ability ability)
Description copied from class: MEventListener
Tell if the event still activated before to be added to the stack

Overrides:
reCheck in class MEventListener
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

tryAction

public static boolean tryAction(MCard movingCard,
                                int idPlaceDest,
                                Player newController,
                                boolean silentMode)
Dispatch this event to all active event listeners able to understand this event. The listening events able to understand this event are this and other multiple event listeners. For each event listeners having responded they have been activated, the corresponding ability is added to the triggered buffer zone of player owning this ability

Parameters:
movingCard - the moving card
idPlaceDest - destination zone of this move
newController - the new controller.
silentMode - Is the silent mode is enabled for this move.
Returns:
true if this action cannot be played, or has been replaced by another one(s)

dispatchEvent

public static void dispatchEvent(MCard movingCard,
                                 int idPlaceDest,
                                 Player newController,
                                 boolean silentMode)
Dispatch this event to all active event listeners able to understand this event. The listening events able to understand this event are this and other multiple event listeners. For each event listeners having responded they have been activated, the corresponding ability is added to the triggered buffer zone of player owning this ability

Parameters:
movingCard - the moving card
idPlaceDest - destination zone of this move
newController - the new controller.
silentMode - Is the silent mode is enabled for this move.

getIdEvent

public final Event getIdEvent()
Description copied from class: MEventListener
Return the idEvent of this event

Specified by:
getIdEvent in class TriggeredEvent
Returns:
the idEvent of this event

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object


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