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 (AllZone.getManaPool() != null) {
String s = AllZone.getManaPool().getManaList();
if (AllZone.getHumanPlayer().getManaPool() != null) {
String s = AllZone.getHumanPlayer().getManaPool().getManaList();
if (!s.equals("|||||||||||")) {
String mList[] = s.split("\\|", 12);

View File

@@ -5,7 +5,6 @@ import net.slightlymagic.braids.util.UtilFunctions;
import forge.Constant.Zone;
import forge.card.cardFactory.CardFactoryInterface;
import forge.card.cardFactory.PreloadingCardFactory;
import forge.card.mana.ManaPool;
import forge.card.trigger.TriggerHandler;
import forge.deck.DeckManager;
import forge.game.GameSummary;
@@ -376,26 +375,6 @@ public final class AllZone implements NewConstants {
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>
*

View File

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

View File

@@ -455,8 +455,7 @@ public class ComputerUtil {
cost = AllZone.getGameAction().getSpellCostChange(sa, cost);
ManaPool manapool = AllZone.getComputerManaPool();
if (player.isHuman()) manapool = AllZone.getManaPool();
ManaPool manapool = player.getManaPool();
Card card = sa.getSourceCard();
// 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
ManaPool mp = AllZone.getManaPool();
ManaPool mp = AllZone.getHumanPlayer().getManaPool();
mp.setImageFilename("mana_pool");
AllZone.getHumanPlayer().getZone(Zone.Battlefield).add(mp);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -196,7 +196,7 @@ public class Cost_Payment {
}
// 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) {
final Card source = this.getSourceCard();
ManaPool manaPool;
if (player.isHuman())
manaPool = AllZone.getManaPool();
else manaPool = AllZone.getComputerManaPool();
ManaPool manaPool = player.getManaPool();
// change this, once ManaPool moves to the Player
// this.getActivatingPlayer().ManaPool.addManaToFloating(origProduced, getSourceCard());
manaPool.addManaToFloating(produced, source);

View File

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

View File

@@ -141,7 +141,7 @@ public class Input_PayManaCost extends Input {
} else
AllZone.getInputControl().resetInput();
} else {
AllZone.getManaPool().clearPay(spell, false);
AllZone.getHumanPlayer().getManaPool().clearPay(spell, false);
resetManaCost();
// if tap ability, tap card
@@ -172,7 +172,7 @@ public class Input_PayManaCost extends Input {
@Override
public void selectButtonCancel() {
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
stop();

View File

@@ -112,7 +112,7 @@ public class Input_PayManaCostUtil {
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)
return manaCost;

View File

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