net.sf.magicproject.event.phase
Class BeginningPhase

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

public class BeginningPhase
extends TriggeredEvent

Since:
0.54
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
BeginningPhase(java.io.InputStream inputFile, MCard card)
          Create an instance of MEventBeginningPhase by reading a file Offset's file must pointing on the first byte of this event
Structure of InputStream : Data[size] idZone [1] test [...]
BeginningPhase(int idZone, Test test, MCard card, Expression idPhase, PhaseFilter phaseFilter)
          Creates a new instance of MEventBeginningPhase specifying all attributes of this class.
 
Method Summary
 MEventListener appendOr(MEventListener other)
          Create and returns an union of this event and the specified one.
 MEventListener clone(MCard card)
          Return a copy of this with the specified owner
static void dispatchEvent()
          Dispatch this event to all active event listeners able to understand this event.
 Event getIdEvent()
          Return the idEvent of this event
 java.lang.String toHtmlString(Ability ability, ContextEventListener context)
          Return the HTML code representing this ability.
 
Methods inherited from class net.sf.magicproject.event.TriggeredEvent
isActivated, isTriggered, registerToManager, removeFromManager
 
Methods inherited from class net.sf.magicproject.event.MEventListener
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

BeginningPhase

public BeginningPhase(java.io.InputStream inputFile,
                      MCard card)
               throws java.io.IOException
Create an instance of MEventBeginningPhase 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

BeginningPhase

public BeginningPhase(int idZone,
                      Test test,
                      MCard card,
                      Expression idPhase,
                      PhaseFilter phaseFilter)
Creates a new instance of MEventBeginningPhase 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
test - the additional test
card - is the card owning this card
idPhase - the looked for phase identifiant
phaseFilter - the filter.
Method Detail

getIdEvent

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

Returns:
the idEvent of this event

dispatchEvent

public static void dispatchEvent()
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.


clone

public 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

toHtmlString

public java.lang.String toHtmlString(Ability ability,
                                     ContextEventListener context)
Description copied from class: MEventListener
Return the HTML code representing this ability.

Overrides:
toHtmlString in class TriggeredEvent
Parameters:
ability - is the attached ability.
context - the context needed by event activated
Returns:
the HTML code representing this ability.

appendOr

public MEventListener appendOr(MEventListener other)
Description copied from class: MEventListener
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.

Overrides:
appendOr in class MEventListener
Parameters:
other - the event to append with 'or' operator.
Returns:
a new event reprensenting 'this' or 'other'


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