|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.magicproject.stack.StackManager
public final class StackManager
Represents all methods to cast a spell/ability. Manage the succession of actions of a ability.
Field Summary | |
---|---|
static long |
abilityID
Ability ID |
static ActionManager |
actionManager
The current action manager. |
static boolean |
canBeAborted
Indicates if the current spell can be aborted or not |
static java.lang.String |
CANCEL_TXT
The cancel text |
static java.util.Stack<net.sf.magicproject.stack.StackManager.StackElement> |
CONTEXTES
contains all contexts |
static Ability |
currentAbility
the current ability in the stack |
static java.lang.String |
DECLINE_TXT
The decline text |
static int |
idActivePlayer
Identifiant of active player |
static int |
idCurrentPlayer
Current player |
static int |
idHandedPlayer
Identifiant of player having hand (not allways active player) |
static IntegerList |
intList
The current integer list. |
static MMiniPipe |
noReplayToken
The object used to exclusively manage player events. |
static int |
oldIdHandedPlayer
Identifiant of last player having hand (not allways active player). |
static Player[] |
PLAYERS
players of the play |
static int |
previousPlace
Is the previous place of current spell. |
static int[] |
registers
private registers for each spell/ability |
static java.util.List<IntegerList> |
SAVED_INT_LISTS
All saved integer list. |
static java.util.List<java.util.List<Targetable>> |
SAVED_TARGET_LISTS
Represents the target list saved during this turn. |
static Player |
spellController
the player controlling the current spell |
static TargetManager |
targetOptions
the target option associated to the current spell |
static AbstractCard |
tokenCard
card representing card in stack |
static TriggeredCard |
triggered
Current spell is a triggered ability if not null |
static java.lang.String |
TT_CANCEL
The cancel tooltip text |
static java.lang.String |
TT_DECLINE
Decline tooltip text |
static int |
zoneAbortion
represents the place where aborted spells would be placed |
Method Summary | |
---|---|
void |
abortion(AbstractCard card,
Ability source)
Remove the specified card from the stack. |
static Player |
activePlayer()
return the active player |
static void |
cancel()
Cancel the current spell or ability. |
static boolean |
currentIsYou()
Indicates if the current player is you. |
static Player |
currentPlayer()
return the current player |
static void |
disableAbort()
disable abort action |
static void |
enableAbort()
enable abort action |
void |
finishSpell()
This method finish the current spell. |
ContextEventListener |
getAbilityContext()
Return the current context. |
static Ability |
getAbilityOf(MCard card)
The ability corresponding to the specified card |
Ability |
getAbortingAbility()
Return the ability causing the abortion of this ability. |
ActionManager |
getActionManager()
Return the action manager of this context. |
static ActionManager |
getActionManager(AbstractCard card)
Return the action context corresponding to the specified card. |
java.util.List<AdditionalCost> |
getAdditionalCost()
Returns the current additional costs. |
MAction[] |
getAdditionalCost(Ability ability)
Returns the additional cost can be applied to the given ability. |
static StackContext |
getContextOf(AbstractCard card)
Return the context associated to the given card. |
static java.lang.String |
getHtmlManaCost(MCard card)
Return HTML representation of total mana cost of the specified card. |
static java.lang.String |
getHtmlManaPaid(MCard card)
Return HTML representation of total mana paid for the specified card. |
static StackManager |
getInstance()
Return the unique instance of this class. |
static int |
getManaPaid(MCard card,
int color)
Return mana paid for the specified card and specified color. |
static MCard |
getRealSource(MCard owner)
Return the real card of the current ability. |
static Targetable |
getSaved(Ability ability)
Return the targetable saved into the specified ability |
MCard |
getSourceCard()
Return the card source of the current capcity/spell in the stack |
static Player |
getSpellController()
Return the player controlling the current spell |
TargetedList |
getTargetedList()
Return the target option of the current spell. this target option is owned by the current spell. |
static java.util.List<Targetable> |
getTargetListAccess()
Return the target list. |
static int |
getTotalManaCost(AbstractCard card)
Return total mana cost of the specified card. |
static int |
getTotalManaPaid(MCard card)
Return total mana paid for the specified card. |
void |
init(java.io.InputStream inputFile,
int firstPlayer)
Read from the specified stream the initial registers of players. |
static boolean |
isEmpty()
tell if it stills yet any abilities in the stack |
static boolean |
isPlaying(ReplacementAbility ability)
Indicates if the specified replacement ability has already been used to replace the main action. |
static boolean |
isTargetMode()
Indicates the current action is waiting for a target. |
static boolean |
isYou(Player player)
Indicates if the specified player is you |
static void |
newSpell(Ability ability,
boolean advancedMode)
Add a spell/activated ability to the stack |
static boolean |
newSpell(TriggeredCard triggered)
Add a triggered ability to the stack. |
static Player |
nonActivePlayer()
return the non-active player |
static void |
postLoseGame(int idPlayer)
Add the "lose status" to specified player |
static void |
postRefreshAbilities(MCard card)
Post a request to refresh the abilities of a card. |
static void |
postRefreshColor(MCard card)
Post a request to refresh the colors of a card. |
static void |
postRefreshController(MCard card)
Post a request to refresh the conntroller of a card. |
static void |
postRefreshIdCard(MCard card)
Post a request to refresh the card types of a card. |
static void |
postRefreshProperties(MCard card,
int property)
Post a request to refresh a property of a card. |
static void |
postRefreshRegisters(MCard card,
int index)
Post a request to refresh a register of a card. |
static boolean |
processRefreshRequests()
For each cards having posted a refresh request, process to the refreshing |
static void |
reset()
Reset completely the stack |
static void |
resolveStack()
Resolve the stack An ability is splited into 4 parts : paying part (cost) raise event "casting", stack waiting triggered abilities and active player gets priority effect part (effects) restore context, stack waiting triggered abilities and active player gets priority |
void |
setTargetedList(TargetedList savedTargeted)
Set a new targeted list. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Player spellController
public static TargetManager targetOptions
public static IntegerList intList
public static int[] registers
public static AbstractCard tokenCard
public static TriggeredCard triggered
public static Ability currentAbility
public static int previousPlace
public static boolean canBeAborted
public static long abilityID
public static volatile ActionManager actionManager
public static volatile int oldIdHandedPlayer
idHandedPlayer
is set to -1
public static volatile int idActivePlayer
public static volatile int idCurrentPlayer
public static volatile int idHandedPlayer
public static final Player[] PLAYERS
public static MMiniPipe noReplayToken
public static int zoneAbortion
public static final java.util.Stack<net.sf.magicproject.stack.StackManager.StackElement> CONTEXTES
public static final java.util.List<java.util.List<Targetable>> SAVED_TARGET_LISTS
public static final java.util.List<IntegerList> SAVED_INT_LISTS
public static final java.lang.String TT_DECLINE
public static final java.lang.String TT_CANCEL
public static final java.lang.String CANCEL_TXT
public static final java.lang.String DECLINE_TXT
Method Detail |
---|
public static void reset()
public void init(java.io.InputStream inputFile, int firstPlayer) throws java.io.IOException
inputFile
- is the file containing the stack definition.firstPlayer
- the player's id starting the game.
java.io.IOException
- if error occurred during the reading process from the specified
input streampublic static void newSpell(Ability ability, boolean advancedMode)
ability
- is the ability playedadvancedMode
- if true, this ability would be added with advanced mode option.public static boolean newSpell(TriggeredCard triggered)
triggered
- is the triggered ability to add to t he stack
public java.util.List<AdditionalCost> getAdditionalCost()
public MAction[] getAdditionalCost(Ability ability)
ability
- the ability to test.
public static void resolveStack()
public static void cancel()
public void finishSpell()
public static void enableAbort()
public static void disableAbort()
public static boolean isEmpty()
public MCard getSourceCard()
StackContext
getSourceCard
in interface StackContext
public void abortion(AbstractCard card, Ability source)
StackContext
abortion
in interface StackContext
card
- the card to make abort.source
- the ability source.public static java.util.List<Targetable> getTargetListAccess()
public static Player currentPlayer()
public static Player activePlayer()
public static Player nonActivePlayer()
public static boolean currentIsYou()
public static boolean isYou(Player player)
player
- the player to test
public static boolean isPlaying(ReplacementAbility ability)
ability
- the replacement ability to search
public static Ability getAbilityOf(MCard card)
card
- the card linked to the searched ability
public static ActionManager getActionManager(AbstractCard card)
card
- the card linked to the searched ability
public ActionManager getActionManager()
StackContext
getActionManager
in interface StackContext
public static StackContext getContextOf(AbstractCard card)
null
if the given card the current spell instance. If the given card is not
found in the context, an exception is thrown.
card
- the card linked to the searched ability
public static MCard getRealSource(MCard owner)
owner
- the card owning the action requesting the real card.
public static Player getSpellController()
public static boolean processRefreshRequests()
public static void postLoseGame(int idPlayer)
idPlayer
- the loosing player.public static void postRefreshIdCard(MCard card)
card
- the card to refresh.public static void postRefreshAbilities(MCard card)
card
- the card to refresh.public static void postRefreshColor(MCard card)
card
- the card to refresh.public static void postRefreshProperties(MCard card, int property)
card
- the card to refresh.property
- the property to refresh.public static void postRefreshRegisters(MCard card, int index)
card
- the card to refresh.index
- the register index to refresh.public static void postRefreshController(MCard card)
card
- the card to refresh.public static Targetable getSaved(Ability ability)
ability
- the ability containing the saved component
public static boolean isTargetMode()
public ContextEventListener getAbilityContext()
getAbilityContext
in interface StackContext
public TargetedList getTargetedList()
StackContext
getTargetedList
in interface StackContext
public void setTargetedList(TargetedList savedTargeted)
savedTargeted
- the new targeted list.public static StackManager getInstance()
public static java.lang.String getHtmlManaPaid(MCard card)
card
- the card associated to a spell in the stack
public static java.lang.String getHtmlManaCost(MCard card)
card
- the card associated to a spell in the stack
public static int getTotalManaCost(AbstractCard card)
card
- the card associated to a spell in the stack
public static int getTotalManaPaid(MCard card)
card
- the card associated to a spell in the stack
public static int getManaPaid(MCard card, int color)
card
- the card associated to a spell in the stackcolor
- the color of mana paid.
public Ability getAbortingAbility()
StackContext
getAbortingAbility
in interface StackContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |