net.sf.magicproject.action.context
Class ManaCost

java.lang.Object
  extended by net.sf.magicproject.action.context.ManaCost
All Implemented Interfaces:
ActionContext

public class ManaCost
extends java.lang.Object
implements ActionContext

The mana cost context : initial mana cost, mana paid, required mana

Since:
0.90
Author:
Fabrice Daugan

Field Summary
 int[] manaCost
          The initial mana cost.
 int[] manaPaid
          The mana paid.
 int[] requiredMana
          The required mana.
 java.util.List<PairIntObject<Test>>[] restrictions
          The restriction used to paid the mana.
 
Constructor Summary
ManaCost()
          Create a new instance of this class.
 
Method Summary
 void addManaCost(int[] manaCost)
          Add a mana cost.
 void addRestriction(int color, Test test, int amount)
          Add a restriction
 boolean isNullRequired()
          Is the non required mana.
 void payMana(int paidColor, int withColor, int amount, ManaPool manas)
          Pay a required mana.
 void restoreMana(ManaPool manas)
          Restore mana paid to the given mana pool
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manaCost

public final int[] manaCost
The initial mana cost.


requiredMana

public final int[] requiredMana
The required mana.


manaPaid

public final int[] manaPaid
The mana paid.


restrictions

public java.util.List<PairIntObject<Test>>[] restrictions
The restriction used to paid the mana.

Constructor Detail

ManaCost

public ManaCost()
Create a new instance of this class.

Method Detail

isNullRequired

public boolean isNullRequired()
Is the non required mana.

Returns:
true if no mana is required.

addRestriction

public void addRestriction(int color,
                           Test test,
                           int amount)
Add a restriction

Parameters:
color - the restricted color
test - restriction test to save
amount - amount of mana remove

payMana

public void payMana(int paidColor,
                    int withColor,
                    int amount,
                    ManaPool manas)
Pay a required mana. Given amount of mana is remove from the given mana pool.

Parameters:
paidColor - the required mana
withColor - the used mana
amount - the amount of mana to remove
manas - the mana pool

restoreMana

public void restoreMana(ManaPool manas)
Restore mana paid to the given mana pool

Parameters:
manas - is the mana pool receiving the restored manas

addManaCost

public void addManaCost(int[] manaCost)
Add a mana cost.

Parameters:
manaCost - the mana cost to add.


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