net.sf.magicproject.event
Class ModifiedRegister

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

public class ModifiedRegister
extends TriggeredEvent

Since:
0.54 suport either player, either card registers modification, 0.80 the looked for operation is added, 0.83 support the general register modification (both player and card), 0.85 useless operation are ignored and not genrated.
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
ModifiedRegister(int idZone, Test sourceTest, Test testModified, MCard card, Operation op, Register register, Expression index)
          Creates a new instance of MEventModifiedRegister specifying all attributes of this class.
 
Method Summary
 MEventListener clone(MCard card)
          Return a copy of this with the specified owner
static void dispatchEvent(Targetable modified, MCard pSource, int register, int index, Operation op, int rightValue)
          Dispatch this event to all active event listeners able to understand this event.
 Event getIdEvent()
          Return the idEvent of this event
static boolean tryAction(Targetable modified, MCard pSource, int register, int index, Operation op, int rightValue)
          /** Dispatch this event to replacement abilites only.
 
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, reCheck, reset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT

public static final Event EVENT
The event type.

Constructor Detail

ModifiedRegister

public ModifiedRegister(int idZone,
                        Test sourceTest,
                        Test testModified,
                        MCard card,
                        Operation op,
                        Register register,
                        Expression index)
Creates a new instance of MEventModifiedRegister specifying all attributes of this class. All parameters are copied, not cloned. So this new object shares the card and the specified codes

Parameters:
idZone - the place constraint to activate this event
sourceTest - the test applied on card modifying the card.
testModified - the test applied on the modified component.
card - is the card owning this card
op - the looked for operation. Any or specific operation instance.
register - the modified register
index - the modified register.
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

dispatchEvent

public static final void dispatchEvent(Targetable modified,
                                       MCard pSource,
                                       int register,
                                       int index,
                                       Operation op,
                                       int rightValue)
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:
modified - the component containing the modified register. May be null if the container was not a card.
pSource - the card modifying the requested register.
register - the modified register
index - the modified register's index
op - the operation
rightValue - the right value of this modification
Since:
0.85 useless operation are ignored and not genrated.

tryAction

public static final boolean tryAction(Targetable modified,
                                      MCard pSource,
                                      int register,
                                      int index,
                                      Operation op,
                                      int rightValue)
/** Dispatch this event to replacement abilites only. If one or several abilities have been activated this way, this function will return false. The return value must be checked. In case of false value, the caller should not call any stack resolution since activated abilities are being played.

Parameters:
modified - the component containing the modified register. May be null if the container was not a card.
pSource - the card modifying the requested register.
register - the modified register
index - the modified register's index
op - the operation
rightValue - the right value of this modification
Returns:
true if and only if no replacement abilities have been activated

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


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