Changed QuestMatchState to MatchState (since it has no quest-specific information).

This commit is contained in:
Doublestrike
2012-01-16 10:46:01 +00:00
parent 1f7120d354
commit 1fde0eab7f
5 changed files with 19 additions and 23 deletions

2
.gitattributes vendored
View File

@@ -10702,6 +10702,7 @@ src/main/java/forge/IPlayerZone.java svneol=native#text/plain
src/main/java/forge/ImageCache.java svneol=native#text/plain
src/main/java/forge/ImagePreviewPanel.java svneol=native#text/plain
src/main/java/forge/MagicStack.java svneol=native#text/plain
src/main/java/forge/MatchState.java svneol=native#text/plain
src/main/java/forge/Move.java svneol=native#text/plain
src/main/java/forge/MyButton.java svneol=native#text/plain
src/main/java/forge/MyObservable.java svneol=native#text/plain
@@ -11009,7 +11010,6 @@ src/main/java/forge/properties/SavePreferencesListener.java svneol=native#text/p
src/main/java/forge/properties/package-info.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestData.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestDataIO.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestMatchState.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestPreferences.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestUtil.java svneol=native#text/plain
src/main/java/forge/quest/data/QuestUtilCards.java -text

View File

@@ -34,7 +34,6 @@ import forge.model.FGameState;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.data.QuestData;
import forge.quest.data.QuestMatchState;
import forge.quest.gui.main.QuestEvent;
import forge.quest.gui.main.QuestEventManager;
import forge.view.toolbox.FOverlay;
@@ -84,11 +83,8 @@ public final class AllZone {
/** Constant <code>inputControl</code>. */
private static final InputControl INPUT_CONTROL = new InputControl(Singletons.getModel());
/**
* Match State for challenges are stored in a <code>QuestMatchState</code>
* class instance.
*/
private static QuestMatchState matchState = new QuestMatchState();
/** */
private static MatchState matchState = new MatchState();
// initialized at Runtime since it has to be the last object constructed
@@ -657,7 +653,7 @@ public final class AllZone {
*
* @return the matchState
*/
public static QuestMatchState getMatchState() {
public static MatchState getMatchState() {
return AllZone.matchState;
}

View File

@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.quest.data;
package forge;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,14 +26,14 @@ import forge.game.GameSummary;
/**
* <p>
* QuestMatchState class.
* MatchState class.
* </p>
*
* @author Forge
* @version $Id$
*/
public class QuestMatchState {
public class MatchState {
/** The Constant GAMES_PER_MATCH. */
public static final int GAMES_PER_MATCH = 3;
@@ -108,7 +108,7 @@ public class QuestMatchState {
maxWins = Math.max(maxWins, win);
}
return (maxWins >= QuestMatchState.MIN_GAMES_TO_WIN_MATCH) || (totalGames >= QuestMatchState.GAMES_PER_MATCH);
return (maxWins >= MatchState.MIN_GAMES_TO_WIN_MATCH) || (totalGames >= MatchState.GAMES_PER_MATCH);
}
/**
@@ -135,7 +135,7 @@ public class QuestMatchState {
* @return true, if is match won by
*/
public final boolean isMatchWonBy(final String name) {
return this.countGamesWonBy(name) >= QuestMatchState.MIN_GAMES_TO_WIN_MATCH;
return this.countGamesWonBy(name) >= MatchState.MIN_GAMES_TO_WIN_MATCH;
}
/**

View File

@@ -31,6 +31,7 @@ import forge.AllZone;
import forge.Card;
import forge.CardList;
import forge.Constant;
import forge.MatchState;
import forge.Constant.Zone;
import forge.MyRandom;
import forge.Player;
@@ -48,7 +49,6 @@ import forge.gui.ListChooser;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.quest.data.QuestData;
import forge.quest.data.QuestMatchState;
import forge.quest.data.QuestPreferences;
import forge.quest.data.QuestUtil;
import forge.quest.gui.main.QuestChallenge;
@@ -81,7 +81,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
private final String constraintsCards = "w 95%!, h 330px!, gap 0 0 0 20px";
private class CommonObjects {
private QuestMatchState qMatchState;
private MatchState matchState;
private QuestData qData;
private QuestEvent qEvent;
}
@@ -97,10 +97,10 @@ public class QuestWinLoseHandler extends ControlWinLose {
super(v0);
this.view = v0;
this.model = new CommonObjects();
this.model.qMatchState = AllZone.getMatchState();
this.model.matchState = AllZone.getMatchState();
this.model.qData = AllZone.getQuestData();
this.model.qEvent = AllZone.getQuestEvent();
this.wonMatch = this.model.qMatchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
this.skin = AllZone.getSkin();
this.isAnte = Singletons.getModel().getPreferences().isPlayForAnte();
}
@@ -154,7 +154,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData.getCards().resetNewList();
//do per-game actions
if (this.model.qMatchState.hasWonLastGame(AllZone.getHumanPlayer().getName())) {
if (this.model.matchState.hasWonLastGame(AllZone.getHumanPlayer().getName())) {
//add the computer's ante card to your card pool
if (isAnte) {
CardList antes = AllZone.getComputerPlayer().getCardsIn(Zone.Ante);
@@ -178,7 +178,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
}
}
if (!this.model.qMatchState.isMatchOver()) {
if (!this.model.matchState.isMatchOver()) {
this.getView().getBtnQuit().setText("Quit (15 Credits)");
return isAnte;
} else {
@@ -301,7 +301,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData.clearAvailableChallenges();
}
this.model.qMatchState.reset();
this.model.matchState.reset();
AllZone.setQuestEvent(null);
this.model.qData.saveData();
@@ -351,7 +351,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
// Gameplay bonuses (for each game win)
boolean hasNeverLost = true;
final Player computer = AllZone.getComputerPlayer();
for (final GameSummary game : this.model.qMatchState.getGamesPlayed()) {
for (final GameSummary game : this.model.matchState.getGamesPlayed()) {
if (game.isWinner(computer.getName())) {
hasNeverLost = false;
continue; // no rewards for losing a game

View File

@@ -11,13 +11,13 @@ import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout;
import forge.AllZone;
import forge.Constant;
import forge.MatchState;
import forge.Phase;
import forge.Player;
import forge.control.match.ControlWinLose;
import forge.game.GameType;
import forge.properties.ForgeProps;
import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText;
import forge.quest.data.QuestMatchState;
import forge.quest.gui.QuestWinLoseHandler;
import forge.view.toolbox.FButton;
import forge.view.toolbox.FOverlay;
@@ -33,7 +33,7 @@ public class ViewWinLose {
/** */
public ViewWinLose() {
final FOverlay overlay = AllZone.getOverlay();
final QuestMatchState matchState = AllZone.getMatchState();
final MatchState matchState = AllZone.getMatchState();
final JPanel pnlLeft = new JPanel();
final JPanel pnlRight = new JPanel();