net.sf.magicproject.stack
Class EventManager

java.lang.Object
  extended by net.sf.magicproject.stack.EventManager

public final class EventManager
extends java.lang.Object

This class manage the turn structure : phase order, loop and phase's UI manager(highlightment, breakpoints, pass)

Since:
0.21 a graphical representation of phase, 0.30 an option "auto play single "YOU MUST" ability is suported, 0.30 an option "skip all" is suported, 0.31 an option "skip all even opponent's spell" is suported, 0.31 graphical representation of phases for both players, 0.31 attack phase is suported, 0.52 support option PLAYED_ONCE_BY_PHASE and AUTOMATICALLY_PLAYED, 0.53 turns are counted, 0.80 BEFORE_PHASE and END_OF_PHASE_... event can be replaced.
Author:
Fabrice Daugan

Field Summary
static int currentIdPhase
          is the current idPhase (not the index of phase)
static javax.swing.JLabel moreInfoLbl
          The moreInfo label
static int nextCurrentPlayer
          The next 'currentplayer' for the next phase.
static int nextPhaseIndex
          The next 'currentIdPhase'.
static boolean parsingEndPhaseEvent
          This markup indicates we are currently parsing the END_PHASE_... event.
static int phaseIndex
          represents the current index of phase
static javax.swing.JLabel turnsLbl
          The turn label
static PhaseType[] turnStructure
          List of successive phase of any turn
 
Method Summary
static MPhase currentPhase()
          return the phase type associate to the current phase
static PhaseType currentPhaseType()
          return the phase type associate to the current phase
static void gotoNextPhase()
          Goto the next phase.For each player (current first), if mana pool isn't empty -> mana burn. phase will be ID__BEFORE_PHASE_UNTAP
static void init()
          Create an instance of MEventManager by reading a file
static void init(java.io.FileInputStream dbStream, java.lang.String settingFile)
          remove all events in the stack of this phase, read new system abilities, turn structure and set the current phase.
static boolean parsinfBeforeEnd()
          Return true if we are currently parsing the "before phase" event.
static void start()
          Go to the first phase of first turn
static void updatePhasesGUI()
          Update the phases GUI : colors indicating the current phases, and the handed player
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parsingEndPhaseEvent

public static boolean parsingEndPhaseEvent
This markup indicates we are currently parsing the END_PHASE_... event. This token is used by the stack manager to release a maximum of stack frames. During the stack resolution, instead of calling the "gotoNextPhase" method, if this markup is true, the process simply return.


currentIdPhase

public static int currentIdPhase
is the current idPhase (not the index of phase)


turnsLbl

public static javax.swing.JLabel turnsLbl
The turn label


moreInfoLbl

public static javax.swing.JLabel moreInfoLbl
The moreInfo label


turnStructure

public static PhaseType[] turnStructure
List of successive phase of any turn


nextCurrentPlayer

public static int nextCurrentPlayer
The next 'currentplayer' for the next phase. If -1, the next 'currentplayer' would not change.


nextPhaseIndex

public static int nextPhaseIndex
The next 'currentIdPhase'. If -1, the next phase will follow the turn structure.


phaseIndex

public static int phaseIndex
represents the current index of phase

Method Detail

init

public static void init()
Create an instance of MEventManager by reading a file

Since:
0.31 graphical representation of phases for both players

init

public static void init(java.io.FileInputStream dbStream,
                        java.lang.String settingFile)
                 throws java.io.IOException
remove all events in the stack of this phase, read new system abilities, turn structure and set the current phase.

Parameters:
dbStream - the mdb file containing rules
settingFile - setting file attached to this mdb
Throws:
java.io.IOException

start

public static void start()
Go to the first phase of first turn


gotoNextPhase

public static void gotoNextPhase()
Goto the next phase.For each player (current first), if mana pool isn't empty -> mana burn. phase will be ID__BEFORE_PHASE_UNTAP


updatePhasesGUI

public static void updatePhasesGUI()
Update the phases GUI : colors indicating the current phases, and the handed player


currentPhaseType

public static PhaseType currentPhaseType()
return the phase type associate to the current phase

Returns:
the phase type associate to the current phase

currentPhase

public static MPhase currentPhase()
return the phase type associate to the current phase

Returns:
the phase type associate to the current phase

parsinfBeforeEnd

public static boolean parsinfBeforeEnd()
Return true if we are currently parsing the "before phase" event.

Returns:
true if we are currently parsing the "before phase" event.


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