Fixed "inaccurate life total at before mulligan" bug.

This commit is contained in:
Doublestrike
2012-01-17 05:02:05 +00:00
parent 80485aa9c7
commit f313114bbb
5 changed files with 34 additions and 36 deletions

View File

@@ -58,7 +58,6 @@ import forge.gui.input.InputPayManaCostUtil;
import forge.item.CardPrinted; import forge.item.CardPrinted;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants.Lang.GameAction.GameActionText; import forge.properties.NewConstants.Lang.GameAction.GameActionText;
import forge.quest.gui.main.QuestEvent;
import forge.view.GuiTopLevel; import forge.view.GuiTopLevel;
import forge.view.match.ViewWinLose; import forge.view.match.ViewWinLose;
@@ -1292,32 +1291,23 @@ public class GameAction {
} }
/** /**
* <p> * Constructor for new game allowing card lists to be put
* newGame. * into play immediately, and life totals to be adjusted,
* </p> * for computer and human.
* for Quest fantasy mode
* *
* @param humanDeck * @param humanDeck &emsp; {@link forge.deck.Deck} object.
* a {@link forge.deck.Deck} object. * @param computerDeck &emsp; {@link forge.deck.Deck} object.
* @param computerDeck * @param human &emsp; {@link forge.CardList} object.
* a {@link forge.deck.Deck} object. * @param computer &emsp; {@link forge.CardList} object.
* @param human * @param humanLife &emsp; int.
* a {@link forge.CardList} object. * @param computerLife &emsp; int.
* @param computer
* a {@link forge.CardList} object.
* @param humanLife
* a int.
* @param computerLife
* a int.
* @param qe
* the qe
*/ */
public final void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human, public final void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human,
final CardList computer, final int humanLife, final int computerLife, final QuestEvent qe) { final CardList computer, final int humanLife, final int computerLife) {
this.newGame(humanDeck, computerDeck); AllZone.newGameCleanup();
AllZone.getComputerPlayer().setStartingLife(computerLife); AllZone.getComputerPlayer().setStartingLife(computerLife);
AllZone.getHumanPlayer().setStartingLife(humanLife); AllZone.getHumanPlayer().setStartingLife(humanLife);
AllZone.getHumanPlayer().updateObservers();
for (final Card c : human) { for (final Card c : human) {
@@ -1331,29 +1321,37 @@ public class GameAction {
c.setSickness(true); c.setSickness(true);
} }
Constant.Quest.FANTASY_QUEST[0] = true; Constant.Quest.FANTASY_QUEST[0] = true;
this.actuateGame(humanDeck, computerDeck);
} }
private boolean startCut = false; private boolean startCut = false;
/** /**
* <p> * The default constructor for a new game.
* newGame.
* </p>
* *
* @param humanDeck * @param humanDeck &emsp; {@link forge.deck.Deck} object.
* a {@link forge.deck.Deck} object. * @param computerDeck &emsp; {@link forge.deck.Deck} object.
* @param computerDeck
* a {@link forge.deck.Deck} object.
*/ */
public final void newGame(final Deck humanDeck, final Deck computerDeck) { public final void newGame(final Deck humanDeck, final Deck computerDeck) {
// AllZone.getComputer() = new ComputerAI_Input(new // AllZone.getComputer() = new ComputerAI_Input(new
// ComputerAI_General()); // ComputerAI_General());
Constant.Quest.FANTASY_QUEST[0] = false; Constant.Quest.FANTASY_QUEST[0] = false;
AllZone.newGameCleanup();
AllZone.getComputerPlayer().setStartingLife(20); AllZone.getComputerPlayer().setStartingLife(20);
AllZone.getHumanPlayer().setStartingLife(20); AllZone.getHumanPlayer().setStartingLife(20);
this.actuateGame(humanDeck, computerDeck);
}
AllZone.newGameCleanup(); /**
* This must be separated from the newGame method since life totals and
* player details could be adjusted before the game is started.
*
* That process (also cleanup and observer updates) should be done in
* newGame, then when all is ready, call this function.
*/
private void actuateGame(final Deck humanDeck, final Deck computerDeck) {
this.canShowWinLose = true; this.canShowWinLose = true;
forge.card.trigger.Trigger.resetIDs(); forge.card.trigger.Trigger.resetIDs();
AllZone.getTriggerHandler().clearTriggerSettings(); AllZone.getTriggerHandler().clearTriggerSettings();

View File

@@ -1174,7 +1174,7 @@ public final class GuiDisplayUtil {
public static void updateGUI() { public static void updateGUI() {
AllZone.getComputerPlayer().getZone(Zone.Battlefield).updateObservers(); AllZone.getComputerPlayer().getZone(Zone.Battlefield).updateObservers();
AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers(); AllZone.getHumanPlayer().getZone(Zone.Battlefield).updateObservers();
AllZone.getHumanPlayer().getZone(Zone.Hand).updateObservers(); //AllZone.getHumanPlayer().getZone(Zone.Hand).updateObservers();
AllZone.getComputerPlayer().updateObservers(); AllZone.getComputerPlayer().updateObservers();
AllZone.getHumanPlayer().updateObservers(); AllZone.getHumanPlayer().updateObservers();
} }

View File

@@ -231,7 +231,7 @@ public class ControlQuest {
Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0], Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0],
QuestUtil.getHumanStartingCards(view.getQuestData()), QuestUtil.getHumanStartingCards(view.getQuestData()),
QuestUtil.getComputerStartingCards(view.getQuestData()), QuestUtil.getComputerStartingCards(view.getQuestData()),
view.getQuestData().getLife(), 20, null); view.getQuestData().getLife(), 20);
} }
/** /**
@@ -253,7 +253,7 @@ public class ControlQuest {
Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0], Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0],
QuestUtil.getHumanStartingCards(view.getQuestData(), event), QuestUtil.getHumanStartingCards(view.getQuestData(), event),
QuestUtil.getComputerStartingCards(view.getQuestData(), event), QuestUtil.getComputerStartingCards(view.getQuestData(), event),
view.getQuestData().getLife() + extraLife, ((QuestChallenge) event).getAILife(), event); view.getQuestData().getLife() + extraLife, ((QuestChallenge) event).getAILife());
} }
} }

View File

@@ -807,7 +807,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
AllZone.setQuestEvent(selectedDuel); AllZone.setQuestEvent(selectedDuel);
AllZone.getGameAction().newGame(humanDeck, computer, QuestUtil.getHumanStartingCards(this.questData), AllZone.getGameAction().newGame(humanDeck, computer, QuestUtil.getHumanStartingCards(this.questData),
QuestUtil.getComputerStartingCards(this.questData), this.questData.getLife(), 20, null); QuestUtil.getComputerStartingCards(this.questData), this.questData.getLife(), 20);
} }
/** /**
@@ -835,7 +835,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
AllZone.getGameAction().newGame(humanDeck, computer, AllZone.getGameAction().newGame(humanDeck, computer,
QuestUtil.getHumanStartingCards(this.questData, selectedChallenge), QuestUtil.getHumanStartingCards(this.questData, selectedChallenge),
QuestUtil.getComputerStartingCards(this.questData, selectedChallenge), QuestUtil.getComputerStartingCards(this.questData, selectedChallenge),
this.questData.getLife() + extraLife, selectedChallenge.getAILife(), selectedChallenge); this.questData.getLife() + extraLife, selectedChallenge.getAILife());
} }

View File

@@ -133,7 +133,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
} }
AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0], AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0],
humanList, computerList, humanLife, computerLife, this.model.qEvent); humanList, computerList, humanLife, computerLife);
} else { } else {
super.startNextRound(); super.startNextRound();
} }