getManaPool removed from AllZone (manapool already was a player's property) - just removed global refs

This commit is contained in:
Maxmtg
2011-09-19 05:14:08 +00:00
parent eaad67694e
commit 43cc5e45be
16 changed files with 19 additions and 52 deletions

View File

@@ -293,8 +293,8 @@ public class CardPanel extends JPanel implements CardContainer {
if (getCard().getName().equals("Mana Pool") && !isAnimationPanel) { if (getCard().getName().equals("Mana Pool") && !isAnimationPanel) {
if (AllZone.getManaPool() != null) { if (AllZone.getHumanPlayer().getManaPool() != null) {
String s = AllZone.getManaPool().getManaList(); String s = AllZone.getHumanPlayer().getManaPool().getManaList();
if (!s.equals("|||||||||||")) { if (!s.equals("|||||||||||")) {
String mList[] = s.split("\\|", 12); String mList[] = s.split("\\|", 12);

View File

@@ -5,7 +5,6 @@ import net.slightlymagic.braids.util.UtilFunctions;
import forge.Constant.Zone; import forge.Constant.Zone;
import forge.card.cardFactory.CardFactoryInterface; import forge.card.cardFactory.CardFactoryInterface;
import forge.card.cardFactory.PreloadingCardFactory; import forge.card.cardFactory.PreloadingCardFactory;
import forge.card.mana.ManaPool;
import forge.card.trigger.TriggerHandler; import forge.card.trigger.TriggerHandler;
import forge.deck.DeckManager; import forge.deck.DeckManager;
import forge.game.GameSummary; import forge.game.GameSummary;
@@ -376,26 +375,6 @@ public final class AllZone implements NewConstants {
return Singletons.getModel().getGameState().getStackZone(); return Singletons.getModel().getGameState().getStackZone();
} }
/**
* <p>getManaPool.</p>
*
* @return a {@link forge.card.mana.ManaPool} object.
* @since 1.0.15
*/
public static ManaPool getManaPool() {
return AllZone.getHumanPlayer().getManaPool();
}
/**
* <p>getComputerManaPool.</p>
*
* @return a {@link forge.card.mana.ManaPool} object.
* @since 1.0.15
*/
public static ManaPool getComputerManaPool() {
return AllZone.getComputerPlayer().getManaPool();
}
/** /**
* <p>getDisplay.</p> * <p>getDisplay.</p>
* *

View File

@@ -77,7 +77,7 @@ public class ComputerAI_General implements Computer {
//Card list of all cards to consider //Card list of all cards to consider
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand); CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
if (AllZone.getComputerManaPool().isEmpty()) { if (AllZone.getComputerPlayer().getManaPool().isEmpty()) {
hand = hand.filter(new CardListFilter() { hand = hand.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {

View File

@@ -455,8 +455,7 @@ public class ComputerUtil {
cost = AllZone.getGameAction().getSpellCostChange(sa, cost); cost = AllZone.getGameAction().getSpellCostChange(sa, cost);
ManaPool manapool = AllZone.getComputerManaPool(); ManaPool manapool = player.getManaPool();
if (player.isHuman()) manapool = AllZone.getManaPool();
Card card = sa.getSourceCard(); Card card = sa.getSourceCard();
// Tack xMana Payments into mana here if X is a set value // Tack xMana Payments into mana here if X is a set value

View File

@@ -1256,7 +1256,7 @@ public class GameAction {
} }
// TODO ManaPool should be moved to Player and be represented in the player panel // TODO ManaPool should be moved to Player and be represented in the player panel
ManaPool mp = AllZone.getManaPool(); ManaPool mp = AllZone.getHumanPlayer().getManaPool();
mp.setImageFilename("mana_pool"); mp.setImageFilename("mana_pool");
AllZone.getHumanPlayer().getZone(Zone.Battlefield).add(mp); AllZone.getHumanPlayer().getZone(Zone.Battlefield).add(mp);

View File

@@ -2725,11 +2725,7 @@ public final class GameActionUtil {
} }
//empty mana pool //empty mana pool
if (p.isHuman()) { p.getManaPool().clearPool();
AllZone.getManaPool().clearPool();
} else {
AllZone.getComputerManaPool().clearPool();
}
} }
} //end class GameActionUtil } //end class GameActionUtil

View File

@@ -522,7 +522,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
oppLifeLabel.addMouseMotionListener(new MouseMotionAdapter() { oppLifeLabel.addMouseMotionListener(new MouseMotionAdapter() {
@Override @Override
public void mouseMoved(final MouseEvent me) { public void mouseMoved(final MouseEvent me) {
setCard(AllZone.getComputerManaPool()); setCard(AllZone.getComputerPlayer().getManaPool());
} //mouseMoved } //mouseMoved
}); });

View File

@@ -410,8 +410,8 @@ public class Phase extends MyObservable implements java.io.Serializable {
} }
this.bPhaseEffects = true; this.bPhaseEffects = true;
if (!AllZoneUtil.isCardInPlay("Upwelling")) { if (!AllZoneUtil.isCardInPlay("Upwelling")) {
AllZone.getManaPool().clearPool(); AllZone.getHumanPlayer().getManaPool().clearPool();
AllZone.getComputerManaPool().clearPool(); AllZone.getComputerPlayer().getManaPool().clearPool();
} }
if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) { if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) {

View File

@@ -897,11 +897,7 @@ public class AbilityFactory_Mana {
for (Player p : tgtPlayers) { for (Player p : tgtPlayers) {
if (tgt == null || p.canTarget(sa)) { if (tgt == null || p.canTarget(sa)) {
if (p.isHuman()) { p.getManaPool().clearPool();
AllZone.getManaPool().clearPool();
} else if (p.isComputer()) {
AllZone.getComputerManaPool().clearPool();
}
} }
} }
} }

View File

@@ -2867,7 +2867,7 @@ public class CardFactoryUtil {
// Manapool // Manapool
if (l[0].contains("ManaPool")) { if (l[0].contains("ManaPool")) {
String color = l[0].split(":")[1]; String color = l[0].split(":")[1];
return AllZone.getManaPool().getAmountOfColor(color); return AllZone.getHumanPlayer().getManaPool().getAmountOfColor(color);
} }
// count valid cards on the battlefield // count valid cards on the battlefield

View File

@@ -196,7 +196,7 @@ public class Cost_Payment {
} }
// Move this to CostMana // Move this to CostMana
AllZone.getManaPool().unpaid(ability, false); AllZone.getHumanPlayer().getManaPool().unpaid(ability, false);
} }
/** /**

View File

@@ -117,10 +117,7 @@ abstract public class Ability_Mana extends Ability_Activated implements java.io.
*/ */
public void produceMana(String produced, Player player) { public void produceMana(String produced, Player player) {
final Card source = this.getSourceCard(); final Card source = this.getSourceCard();
ManaPool manaPool; ManaPool manaPool = player.getManaPool();
if (player.isHuman())
manaPool = AllZone.getManaPool();
else manaPool = AllZone.getComputerManaPool();
// change this, once ManaPool moves to the Player // change this, once ManaPool moves to the Player
// this.getActivatingPlayer().ManaPool.addManaToFloating(origProduced, getSourceCard()); // this.getActivatingPlayer().ManaPool.addManaToFloating(origProduced, getSourceCard());
manaPool.addManaToFloating(produced, source); manaPool.addManaToFloating(produced, source);

View File

@@ -183,7 +183,7 @@ public class SpellAbility_Requirements {
ability.setStackDescription(sb.toString()); ability.setStackDescription(sb.toString());
} }
AllZone.getManaPool().clearPay(ability, false); AllZone.getHumanPlayer().getManaPool().clearPay(ability, false);
AllZone.getStack().addAndUnfreeze(ability); AllZone.getStack().addAndUnfreeze(ability);
} }
} }

View File

@@ -141,7 +141,7 @@ public class Input_PayManaCost extends Input {
} else } else
AllZone.getInputControl().resetInput(); AllZone.getInputControl().resetInput();
} else { } else {
AllZone.getManaPool().clearPay(spell, false); AllZone.getHumanPlayer().getManaPool().clearPay(spell, false);
resetManaCost(); resetManaCost();
// if tap ability, tap card // if tap ability, tap card
@@ -172,7 +172,7 @@ public class Input_PayManaCost extends Input {
@Override @Override
public void selectButtonCancel() { public void selectButtonCancel() {
resetManaCost(); resetManaCost();
AllZone.getManaPool().unpaid(spell, true); AllZone.getHumanPlayer().getManaPool().unpaid(spell, true);
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();//DO NOT REMOVE THIS, otherwise the cards don't always tap AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();//DO NOT REMOVE THIS, otherwise the cards don't always tap
stop(); stop();

View File

@@ -112,7 +112,7 @@ public class Input_PayManaCostUtil {
AllZone.getGameAction().playSpellAbility(chosen); AllZone.getGameAction().playSpellAbility(chosen);
manaCost = AllZone.getManaPool().subtractMana(sa, manaCost, chosen); manaCost = AllZone.getHumanPlayer().getManaPool().subtractMana(sa, manaCost, chosen);
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();//DO NOT REMOVE THIS, otherwise the cards don't always tap (copied) AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();//DO NOT REMOVE THIS, otherwise the cards don't always tap (copied)
return manaCost; return manaCost;

View File

@@ -108,7 +108,7 @@ public class Input_PayManaCost_Ability extends Input {
if (manaCost.isPaid()) { if (manaCost.isPaid()) {
resetManaCost(); resetManaCost();
AllZone.getManaPool().clearPay(fakeAbility, false); AllZone.getHumanPlayer().getManaPool().clearPay(fakeAbility, false);
paidCommand.execute(); paidCommand.execute();
@@ -120,7 +120,7 @@ public class Input_PayManaCost_Ability extends Input {
@Override @Override
public void selectButtonCancel() { public void selectButtonCancel() {
resetManaCost(); resetManaCost();
AllZone.getManaPool().unpaid(fakeAbility, true); AllZone.getHumanPlayer().getManaPool().unpaid(fakeAbility, true);
unpaidCommand.execute(); unpaidCommand.execute();
AllZone.getInputControl().resetInput(); AllZone.getInputControl().resetInput();
} }