mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
In quest mode, "Quests" universally renamed to "Challenges".
Quest mode now features events, such as duels and challenges.
This commit is contained in:
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -9872,12 +9872,12 @@ src/main/java/forge/quest/gui/bazaar/QuestBazaarItem.java svneol=native#text/pla
|
||||
src/main/java/forge/quest/gui/bazaar/QuestBazaarPanel.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/bazaar/QuestBazaarStall.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/bazaar/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestChallenge.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestChallengePanel.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestDuel.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestDuelPanel.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestEvent.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestEventManager.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestQuest.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/main/QuestQuestPanel.java -text
|
||||
src/main/java/forge/quest/gui/main/QuestSelectablePanel.java -text
|
||||
src/main/java/forge/quest/gui/main/package-info.java svneol=native#text/plain
|
||||
src/main/java/forge/quest/gui/package-info.java svneol=native#text/plain
|
||||
|
||||
@@ -4,12 +4,6 @@ rare--file=rare.txt
|
||||
|
||||
price--file=all-prices.txt
|
||||
boosterprice--file=booster-prices.txt
|
||||
quests--file=quests.txt
|
||||
|
||||
easy--file=easy.txt
|
||||
medium--file=medium.txt
|
||||
hard--file=hard.txt
|
||||
veryhard--file=veryhard.txt
|
||||
|
||||
data-xml--file=questData.dat
|
||||
data--file=questData
|
||||
|
||||
@@ -17,7 +17,7 @@ import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
import forge.quest.data.QuestMatchState;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.gui.main.QuestQuest;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
|
||||
/**
|
||||
* Please use public getters and setters instead of direct field access.
|
||||
@@ -42,8 +42,8 @@ public final class AllZone implements NewConstants {
|
||||
/** Global <code>questData</code>. */
|
||||
private static forge.quest.data.QuestData questData = null;
|
||||
|
||||
/** Global <code>QuestAssignment</code>. */
|
||||
private static QuestQuest questquest = null;
|
||||
/** Global <code>QuestChallenge</code>. */
|
||||
private static QuestChallenge questChallenge = null;
|
||||
|
||||
/** Constant <code>NAME_CHANGER</code>. */
|
||||
private static final NameChanger NAME_CHANGER = new NameChanger();
|
||||
@@ -62,7 +62,7 @@ public final class AllZone implements NewConstants {
|
||||
private static GameSummary gameInfo = new GameSummary();
|
||||
|
||||
/**
|
||||
* Match State for quests are stored in a <code>QuestMatchState</code> class instance.
|
||||
* Match State for challenges are stored in a <code>QuestMatchState</code> class instance.
|
||||
*
|
||||
* @deprecated Variable 'matchState' must be private and have accessor methods.
|
||||
*/
|
||||
@@ -132,23 +132,22 @@ public final class AllZone implements NewConstants {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getQuestAssignment.</p>
|
||||
* <p>getQuestChallenge.</p>
|
||||
*
|
||||
* @return a {@link forge.Quest_Assignment} object.
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static QuestQuest getQuestQuest() {
|
||||
return questquest;
|
||||
public static QuestChallenge getQuestChallenge() {
|
||||
return questChallenge;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>setQuestAssignment.</p>
|
||||
* <p>setQuestChallenge.</p>
|
||||
*
|
||||
* @param assignment a {@link forge.Quest_Assignment} object.
|
||||
* @since 1.0.15
|
||||
* @param q
|
||||
*/
|
||||
public static void setQuestQuest(final QuestQuest q) {
|
||||
questquest = q;
|
||||
public static void setQuestChallenge(final QuestChallenge q) {
|
||||
questChallenge = q;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ import forge.gui.input.Input_PayManaCost_Ability;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;
|
||||
import forge.quest.gui.main.QuestQuest;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -654,7 +654,7 @@ public class GameAction {
|
||||
AllZone.getDisplay().savePrefs();
|
||||
frame.setEnabled(false);
|
||||
//frame.dispose();
|
||||
Gui_WinLose gwl = new Gui_WinLose(AllZone.getMatchState(), AllZone.getQuestData(), AllZone.getQuestQuest());
|
||||
Gui_WinLose gwl = new Gui_WinLose(AllZone.getMatchState(), AllZone.getQuestData(), AllZone.getQuestChallenge());
|
||||
//gwl.setAlwaysOnTop(true);
|
||||
gwl.toFront();
|
||||
canShowWinLose = false;
|
||||
@@ -1090,15 +1090,15 @@ public class GameAction {
|
||||
* @param computer a {@link forge.CardList} object.
|
||||
*/
|
||||
public final void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human,
|
||||
final CardList computer, final int humanLife, final int computerLife, final QuestQuest qq)
|
||||
final CardList computer, final int humanLife, final int computerLife, final QuestChallenge qc)
|
||||
{
|
||||
this.newGame(humanDeck, computerDeck);
|
||||
|
||||
AllZone.getComputerPlayer().setLife(computerLife, null);
|
||||
AllZone.getHumanPlayer().setLife(humanLife, null);
|
||||
|
||||
if (qq != null) {
|
||||
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestQuest()));
|
||||
if (qc != null) {
|
||||
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestChallenge()));
|
||||
}
|
||||
|
||||
for (Card c : human) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import forge.quest.data.QuestData;
|
||||
import forge.quest.data.QuestMatchState;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.quest.gui.QuestFrame;
|
||||
import forge.quest.gui.main.QuestQuest;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.view.swing.OldGuiNewGame;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
private class WinLoseModel {
|
||||
public QuestMatchState match;
|
||||
public QuestData quest;
|
||||
public QuestQuest qq;
|
||||
public QuestChallenge qc;
|
||||
}
|
||||
|
||||
private WinLoseModel model;
|
||||
@@ -76,13 +76,13 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
*
|
||||
* @param matchState a QuestMatchState
|
||||
* @param quest a QuestData object
|
||||
* @param qa a Quest_Assignment object
|
||||
* @param chall a QuestChallenge object
|
||||
*/
|
||||
public Gui_WinLose(final QuestMatchState matchState, final QuestData quest, final QuestQuest qq) {
|
||||
public Gui_WinLose(final QuestMatchState matchState, final QuestData quest, final QuestChallenge chall) {
|
||||
model = new WinLoseModel();
|
||||
model.match = matchState;
|
||||
model.quest = quest;
|
||||
model.qq = qq;
|
||||
model.qc = chall;
|
||||
|
||||
try {
|
||||
jbInit();
|
||||
@@ -187,25 +187,25 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
void prepareForNextRound() {
|
||||
if (Constant.Quest.fantasyQuest[0]) {
|
||||
int extraLife = 0;
|
||||
if (model.qq != null) {
|
||||
if (model.qc != null) {
|
||||
if (model.quest.getInventory().hasItem("Zeppelin")) {
|
||||
extraLife = 3;
|
||||
}
|
||||
}
|
||||
//AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
||||
//humanList, computerList, humanLife, computerLife);
|
||||
CardList humanList = forge.quest.data.QuestUtil.getHumanStartingCards(model.quest, model.qq);
|
||||
CardList humanList = forge.quest.data.QuestUtil.getHumanStartingCards(model.quest, model.qc);
|
||||
CardList computerList = new CardList();
|
||||
|
||||
|
||||
int humanLife = model.quest.getLife() + extraLife;
|
||||
int computerLife = 20;
|
||||
if (model.qq != null) {
|
||||
computerLife = model.qq.getAILife();
|
||||
if (model.qc != null) {
|
||||
computerLife = model.qc.getAILife();
|
||||
}
|
||||
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
||||
humanList, computerList, humanLife, computerLife, model.qq);
|
||||
humanList, computerList, humanLife, computerLife, model.qc);
|
||||
} else {
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
|
||||
}
|
||||
@@ -355,15 +355,15 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
model.quest.getCards().clearShopList();
|
||||
|
||||
|
||||
if (model.quest.getAvailableQuests() != null) {
|
||||
model.quest.clearAvailableQuests();
|
||||
if (model.quest.getAvailableChallenges() != null) {
|
||||
model.quest.clearAvailableChallenges();
|
||||
}
|
||||
|
||||
model.quest.getCards().resetNewList();
|
||||
giveQuestRewards(wonMatch);
|
||||
|
||||
model.match.reset();
|
||||
AllZone.setQuestQuest(null);
|
||||
AllZone.setQuestChallenge(null);
|
||||
|
||||
model.quest.saveData();
|
||||
|
||||
@@ -441,32 +441,32 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
}
|
||||
|
||||
// Rewards from QuestAssignment
|
||||
if (wonMatch && model.qq != null) {
|
||||
model.quest.addQuestsPlayed();
|
||||
if (wonMatch && model.qc != null) {
|
||||
model.quest.addChallengesPlayed();
|
||||
|
||||
List<CardPrinted> questRewardCards = model.qq.getCardRewardList();
|
||||
long questRewardCredits = model.qq.getCreditsReward();
|
||||
List<CardPrinted> challengeRewardCards = model.qc.getCardRewardList();
|
||||
long questRewardCredits = model.qc.getCreditsReward();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Quest Completed - \r\n");
|
||||
sb.append("Challenge Completed - \r\n");
|
||||
|
||||
if (questRewardCards != null) {
|
||||
if (challengeRewardCards != null) {
|
||||
sb.append("You won the following cards:\r\n\r\n");
|
||||
for (CardPrinted cardName : questRewardCards) {
|
||||
for (CardPrinted cardName : challengeRewardCards) {
|
||||
sb.append(cardName.getName());
|
||||
sb.append("\r\n");
|
||||
}
|
||||
model.quest.getCards().addAllCards(questRewardCards);
|
||||
model.quest.getCards().addAllCards(challengeRewardCards);
|
||||
sb.append("\r\n");
|
||||
}
|
||||
sb.append("Quest Bounty: ");
|
||||
sb.append("Challenge Bounty: ");
|
||||
sb.append(questRewardCredits);
|
||||
|
||||
model.quest.addCredits(questRewardCredits);
|
||||
|
||||
String fileName = "BoxIcon.png";
|
||||
ImageIcon icon = getIcon(fileName);
|
||||
String title = "Quest Rewards for " + model.qq.getTitle();
|
||||
String title = "Challenge Rewards for " + model.qc.getTitle();
|
||||
JOptionPane.showMessageDialog(null, sb.toString(), title, JOptionPane.INFORMATION_MESSAGE, icon);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -148,21 +148,8 @@ public interface NewConstants {
|
||||
/** Property path for a rare card. */
|
||||
String RARE = "quest/rare";
|
||||
|
||||
/** Property path for price. */
|
||||
String PRICE = "quest/price";
|
||||
/** Property path for price. */
|
||||
String BOOSTER_PRICE= "quest/boosterprice";
|
||||
/** Property path for quests. */
|
||||
String QUESTS = "quest/quests";
|
||||
|
||||
/** Property path for easy quest difficulty. */
|
||||
String EASY = "quest/easy";
|
||||
/** Property path for medium quest difficulty. */
|
||||
String MEDIUM = "quest/medium";
|
||||
/** Property path for hard quest difficulty. */
|
||||
String HARD = "quest/hard";
|
||||
/** Property path for very hard quest difficulty. */
|
||||
String VERYHARD = "quest/veryhard";
|
||||
|
||||
String DATA = "quest/data";
|
||||
String PREFS = "quest/prefs";
|
||||
|
||||
@@ -23,10 +23,6 @@ import net.slightlymagic.maxmtg.Predicate;
|
||||
//you have to call one of these two methods below
|
||||
//see Gui_QuestOptions for more details
|
||||
|
||||
//static readAIQuestDeckFiles(QuestDataOld data, ArrayList aiDeckNames)
|
||||
//OR non-static readAIQuestDeckFiles()
|
||||
//which reads the files "questDecks-easy", "questDecks-medium","questDecks-hard",
|
||||
|
||||
/**
|
||||
* <p>QuestData class.</p>
|
||||
*
|
||||
@@ -72,10 +68,10 @@ public final class QuestData {
|
||||
ItemPool<InventoryItem> shopList = new ItemPool<InventoryItem>(InventoryItem.class); // the current shop list
|
||||
ItemPool<InventoryItem> newCardList = new ItemPool<InventoryItem>(InventoryItem.class); // cards acquired since last game-win/loss
|
||||
|
||||
// Quests history
|
||||
int questsPlayed;
|
||||
List<Integer> availableQuests = new ArrayList<Integer>();
|
||||
List<Integer> completedQuests = new ArrayList<Integer>();
|
||||
// Challenge history
|
||||
int challengesPlayed;
|
||||
List<Integer> availableChallenges = new ArrayList<Integer>();
|
||||
List<Integer> completedChallenges = new ArrayList<Integer>();
|
||||
|
||||
// own randomizer seed
|
||||
private long randomSeed = 0;
|
||||
@@ -140,14 +136,14 @@ public final class QuestData {
|
||||
public QuestUtilCards getCards() { return myCards; }
|
||||
public QuestUtilRewards getRewards() { return myRewards; }
|
||||
|
||||
// Quests performance
|
||||
public int getQuestsPlayed() { return questsPlayed; }
|
||||
public void addQuestsPlayed() { questsPlayed++; }
|
||||
// Challenge performance
|
||||
public int getChallengesPlayed() { return challengesPlayed; }
|
||||
public void addChallengesPlayed() { challengesPlayed++; }
|
||||
|
||||
public List<Integer> getAvailableQuests() { return availableQuests != null ? new ArrayList<Integer>(availableQuests) : null; }
|
||||
public void setAvailableQuests(final List<Integer> list) { availableQuests = list; }
|
||||
public void clearAvailableQuests() { availableQuests.clear(); }
|
||||
public List<Integer> getCompletedQuests() { return completedQuests != null ? new ArrayList<Integer>(completedQuests) : null; }
|
||||
public List<Integer> getAvailableChallenges() { return availableChallenges != null ? new ArrayList<Integer>(availableChallenges) : null; }
|
||||
public void setAvailableChallenges(final List<Integer> list) { availableChallenges = list; }
|
||||
public void clearAvailableChallenges() { availableChallenges.clear(); }
|
||||
public List<Integer> getCompletedChallenges() { return completedChallenges != null ? new ArrayList<Integer>(completedChallenges) : null; }
|
||||
|
||||
// Wins & Losses
|
||||
public int getLost() { return lost; }
|
||||
@@ -229,7 +225,7 @@ public final class QuestData {
|
||||
randomSeed = MyRandom.random.nextLong();
|
||||
}
|
||||
|
||||
// SERIALIZATION - relared things
|
||||
// SERIALIZATION - related things
|
||||
|
||||
// This must be called by XML-serializer via reflection
|
||||
public Object readResolve() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import forge.Constant;
|
||||
import forge.card.CardRarity;
|
||||
import forge.card.BoosterUtils;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.quest.gui.main.QuestQuest;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,14 +33,14 @@ public class QuestUtil {
|
||||
* Returns extra AI cards in play at start of quest.
|
||||
*
|
||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||
* @param qa a {@link forge.Quest_Assignment} object.
|
||||
* @param qc a QuestChallenge object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getComputerStartingCards(final QuestData qd, QuestQuest qq) {
|
||||
public static CardList getComputerStartingCards(final QuestData qd, QuestChallenge qc) {
|
||||
CardList list = new CardList();
|
||||
|
||||
if (qq != null) {
|
||||
list.addAll(qq.getAIExtraCards());
|
||||
if (qc != null) {
|
||||
list.addAll(qc.getAIExtraCards());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -72,14 +72,14 @@ public class QuestUtil {
|
||||
* and cards in play at start of quest.
|
||||
*
|
||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||
* @param qa a {@link forge.Quest_Assignment} object.
|
||||
* @param qc a QuestChallenge object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getHumanStartingCards(final QuestData qd, QuestQuest qq) {
|
||||
public static CardList getHumanStartingCards(final QuestData qd, QuestChallenge qc) {
|
||||
CardList list = getHumanStartingCards(qd);
|
||||
|
||||
if (qq != null) {
|
||||
list.addAll(qq.getHumanExtraCards());
|
||||
if (qc != null) {
|
||||
list.addAll(qc.getHumanExtraCards());
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -160,7 +160,6 @@ public class QuestUtil {
|
||||
col = Constant.Color.White;
|
||||
}
|
||||
|
||||
System.out.println(rar+" "+col+" "+qty);
|
||||
return BoosterUtils.generateCards(qty, rar, col);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import forge.quest.data.QuestData;
|
||||
import forge.quest.data.item.QuestItemZeppelin;
|
||||
import forge.quest.gui.main.QuestDuel;
|
||||
import forge.quest.gui.main.QuestDuelPanel;
|
||||
import forge.quest.gui.main.QuestQuest;
|
||||
import forge.quest.gui.main.QuestQuestPanel;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.quest.gui.main.QuestChallengePanel;
|
||||
import forge.quest.gui.main.QuestSelectablePanel;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -49,7 +49,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
JComboBox petComboBox = new JComboBox();
|
||||
JComboBox deckComboBox = new JComboBox();
|
||||
|
||||
JButton questButton = new JButton("Quests");
|
||||
JButton eventButton = new JButton("Challenges");
|
||||
JButton playButton = new JButton("Play");
|
||||
|
||||
private QuestSelectablePanel selectedOpponent;
|
||||
@@ -57,7 +57,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
JPanel nextMatchPanel = new JPanel();
|
||||
CardLayout nextMatchLayout;
|
||||
|
||||
boolean isShowingQuests = false;
|
||||
boolean isShowingChallenges = false;
|
||||
private JCheckBox devModeCheckBox = new JCheckBox("Developer Mode");
|
||||
//private JCheckBox newGUICheckbox = new JCheckBox("Use new UI", true);
|
||||
private JCheckBox smoothLandCheckBox = new JCheckBox("Adjust AI Land");
|
||||
@@ -66,10 +66,10 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
private JCheckBox plantBox = new JCheckBox("Summon Plant");
|
||||
/** Constant <code>NO_DECKS_AVAILABLE="No decks available"</code> */
|
||||
private static final String NO_DECKS_AVAILABLE = "No decks available";
|
||||
/** Constant <code>BATTLES="Battles"</code> */
|
||||
private static final String BATTLES = "Battles";
|
||||
/** Constant <code>QUESTS="Quests"</code> */
|
||||
private static final String QUESTS = "Quests";
|
||||
/** Constant <code>DUELS="Duels"</code> */
|
||||
private static final String DUELS = "Duels";
|
||||
/** Constant <code>CHALLENGES="Challenges"</code> */
|
||||
private static final String CHALLENGES = "Challenges";
|
||||
|
||||
//TODO: Make this ordering permanent
|
||||
/** Constant <code>lastUsedDeck="//TODO: Make this ordering permanent"</code> */
|
||||
@@ -198,14 +198,14 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
|
||||
questButton.addActionListener(new ActionListener() {
|
||||
eventButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
QuestMainPanel.this.showQuests();
|
||||
QuestMainPanel.this.showChallenges();
|
||||
}
|
||||
});
|
||||
eastComponents.add(questButton);
|
||||
questButton.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
|
||||
questButton.setPreferredSize(new Dimension(0, 60));
|
||||
eastComponents.add(eventButton);
|
||||
eventButton.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
|
||||
eventButton.setPreferredSize(new Dimension(0, 60));
|
||||
|
||||
|
||||
playButton.addActionListener(new ActionListener() {
|
||||
@@ -249,7 +249,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
|
||||
panel.add(Box.createVerticalGlue());
|
||||
|
||||
panel.add(questButton);
|
||||
panel.add(eventButton);
|
||||
this.nextQuestLabel.setFont(new Font(Font.DIALOG, Font.PLAIN, 11));
|
||||
panel.add(nextQuestLabel);
|
||||
GuiUtils.addGap(panel);
|
||||
@@ -398,7 +398,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
JPanel DuelPanel = new JPanel();
|
||||
QuestDuelPanel duelEvent;
|
||||
DuelPanel.setLayout(new BoxLayout(DuelPanel, BoxLayout.Y_AXIS));
|
||||
DuelPanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Battles"));
|
||||
DuelPanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Duels"));
|
||||
|
||||
List<QuestDuel> duels = TEST.qem.generateDuels();
|
||||
|
||||
@@ -416,30 +416,30 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>createQuestPanel.</p>
|
||||
* Makes a parent panel, then selectable panel instances for all available battles.
|
||||
* <p>createChallengePanel.</p>
|
||||
* Makes a parent panel, then selectable panel instances for all available challenges.
|
||||
*
|
||||
* @return a {@link javax.swing.JPanel} object.
|
||||
*/
|
||||
private JPanel createQuestPanel() {
|
||||
JPanel QuestPanel = new JPanel();
|
||||
private JPanel createChallengePanel() {
|
||||
JPanel ChallengePanel = new JPanel();
|
||||
|
||||
QuestSelectablePanel selpan;
|
||||
QuestPanel.setLayout(new BoxLayout(QuestPanel, BoxLayout.Y_AXIS));
|
||||
QuestPanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Quests"));
|
||||
ChallengePanel.setLayout(new BoxLayout(ChallengePanel, BoxLayout.Y_AXIS));
|
||||
ChallengePanel.setBorder(new TitledBorder(new EtchedBorder(), "Available Challenges"));
|
||||
|
||||
List<QuestQuest> quests = TEST.qem.generateQuests();
|
||||
List<QuestChallenge> challenges = TEST.qem.generateChallenges();
|
||||
|
||||
for (QuestQuest qq : quests) {
|
||||
selpan = new QuestQuestPanel(qq);
|
||||
QuestPanel.add(selpan);
|
||||
for (QuestChallenge qc : challenges) {
|
||||
selpan = new QuestChallengePanel(qc);
|
||||
ChallengePanel.add(selpan);
|
||||
selpan.addMouseListener(new SelectionAdapter(selpan));
|
||||
|
||||
GuiUtils.addGap(QuestPanel, 3);
|
||||
GuiUtils.addGap(ChallengePanel, 3);
|
||||
}
|
||||
|
||||
|
||||
return QuestPanel;
|
||||
return ChallengePanel;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -485,7 +485,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
deckComboBox.setMinimumSize(new Dimension(150, 0));
|
||||
|
||||
questButton.setEnabled(nextQuestInWins() == 0);
|
||||
eventButton.setEnabled(nextChallengeInWins() == 0);
|
||||
|
||||
playButton.setEnabled(canGameBeLaunched());
|
||||
|
||||
@@ -536,10 +536,10 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
|
||||
}
|
||||
|
||||
if (nextQuestInWins() > 0) {
|
||||
nextQuestLabel.setText("Next Quest in " + nextQuestInWins() + " Wins.");
|
||||
if (nextChallengeInWins() > 0) {
|
||||
nextQuestLabel.setText("Next challenge in " + nextChallengeInWins() + " Wins.");
|
||||
} else {
|
||||
nextQuestLabel.setText("Next Quest available now.");
|
||||
nextQuestLabel.setText("Next challenge available now.");
|
||||
}
|
||||
|
||||
nextMatchLayout = new CardLayout();
|
||||
@@ -554,21 +554,21 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
nextMatchPanel.removeAll();
|
||||
nextMatchLayout = new CardLayout();
|
||||
nextMatchPanel.setLayout(nextMatchLayout);
|
||||
nextMatchPanel.add(createDuelPanel(), BATTLES);
|
||||
nextMatchPanel.add(createQuestPanel(), QUESTS);
|
||||
if (isShowingQuests) {
|
||||
this.nextMatchLayout.show(nextMatchPanel, QUESTS);
|
||||
nextMatchPanel.add(createDuelPanel(), DUELS);
|
||||
nextMatchPanel.add(createChallengePanel(), CHALLENGES);
|
||||
if (isShowingChallenges) {
|
||||
this.nextMatchLayout.show(nextMatchPanel, CHALLENGES);
|
||||
} else {
|
||||
this.nextMatchLayout.show(nextMatchPanel, BATTLES);
|
||||
this.nextMatchLayout.show(nextMatchPanel, DUELS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>nextQuestInWins.</p>
|
||||
* <p>nextChallengeInWins.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
private int nextQuestInWins() {
|
||||
private int nextChallengeInWins() {
|
||||
|
||||
// Number of wins was 25, lowereing the number to 20 to help short term questers.
|
||||
if (questData.getWin() < 20) {
|
||||
@@ -576,7 +576,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
// The int mul has been lowered by one, should face special opps more frequently.
|
||||
int questsPlayed = questData.getQuestsPlayed();
|
||||
int challengesPlayed = questData.getChallengesPlayed();
|
||||
int mul = 5;
|
||||
|
||||
if (questData.getInventory().hasItem("Zeppelin")) {
|
||||
@@ -585,7 +585,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
mul = 4;
|
||||
}
|
||||
|
||||
int delta = (questsPlayed * mul) - questData.getWin();
|
||||
int delta = (challengesPlayed * mul) - questData.getWin();
|
||||
|
||||
return (delta > 0) ? delta : 0;
|
||||
}
|
||||
@@ -679,8 +679,8 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
Constant.Runtime.Smooth[0] = smoothLandCheckBox.isSelected();
|
||||
|
||||
AllZone.getMatchState().reset();
|
||||
if (isShowingQuests) {
|
||||
setupQuest(humanDeck);
|
||||
if (isShowingChallenges) {
|
||||
setupChallenge(humanDeck);
|
||||
} else {
|
||||
setupDuel(humanDeck);
|
||||
}
|
||||
@@ -706,17 +706,17 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>setupQuest.</p>
|
||||
* <p>setupChallenge.</p>
|
||||
*
|
||||
* @param humanDeck a {@link forge.deck.Deck} object.
|
||||
*/
|
||||
private void setupQuest(Deck humanDeck) {
|
||||
QuestQuest selectedQuest = (QuestQuest)selectedOpponent.getEvent();
|
||||
private void setupChallenge(Deck humanDeck) {
|
||||
QuestChallenge selectedChallenge = (QuestChallenge)selectedOpponent.getEvent();
|
||||
|
||||
Deck computer = selectedOpponent.getEvent().getEventDeck();
|
||||
Constant.Runtime.ComputerDeck[0] = computer;
|
||||
|
||||
AllZone.setQuestQuest(selectedQuest);
|
||||
AllZone.setQuestChallenge(selectedChallenge);
|
||||
|
||||
int extraLife = 0;
|
||||
|
||||
@@ -725,8 +725,8 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
AllZone.getGameAction().newGame(humanDeck, computer,
|
||||
forge.quest.data.QuestUtil.getHumanStartingCards(questData, selectedQuest), new CardList(),
|
||||
questData.getLife() + extraLife, selectedQuest.getAILife(), selectedQuest);
|
||||
forge.quest.data.QuestUtil.getHumanStartingCards(questData, selectedChallenge), new CardList(),
|
||||
questData.getLife() + extraLife, selectedChallenge.getAILife(), selectedChallenge);
|
||||
|
||||
}
|
||||
|
||||
@@ -740,15 +740,15 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>showQuests.</p>
|
||||
* <p>showChallenges.</p>
|
||||
*/
|
||||
void showQuests() {
|
||||
if (isShowingQuests) {
|
||||
isShowingQuests = false;
|
||||
questButton.setText("Quests");
|
||||
void showChallenges() {
|
||||
if (isShowingChallenges) {
|
||||
isShowingChallenges = false;
|
||||
eventButton.setText("Challenges");
|
||||
} else {
|
||||
isShowingQuests = true;
|
||||
questButton.setText("Battles");
|
||||
isShowingChallenges = true;
|
||||
eventButton.setText("Duels");
|
||||
}
|
||||
|
||||
if (selectedOpponent != null) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* deck, and quest-specific properties.
|
||||
*
|
||||
*/
|
||||
public class QuestQuest extends QuestEvent {
|
||||
public class QuestChallenge extends QuestEvent {
|
||||
// ID (default -1, should be explicitly set at later time.)
|
||||
public int id = -1;
|
||||
|
||||
@@ -8,25 +8,25 @@ package forge.quest.gui.main;
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class QuestQuestPanel extends QuestSelectablePanel {
|
||||
public class QuestChallengePanel extends QuestSelectablePanel {
|
||||
|
||||
//private JLabel repeatabilityLabel;
|
||||
|
||||
/** <p>QuestQuestPanel.</p>
|
||||
* Constructor, using quest data instance.
|
||||
/** <p>QuestChallengePanel.</p>
|
||||
* Constructor, using challenge data instance.
|
||||
*
|
||||
* @param {@link forge.quest.gui.main.QuestDuel}
|
||||
* @param {@link forge.quest.gui.main.QuestChallenge}
|
||||
*/
|
||||
public QuestQuestPanel(QuestQuest q) {
|
||||
public QuestChallengePanel(QuestChallenge q) {
|
||||
super(q);
|
||||
|
||||
// Repeatability is currently meaningless.
|
||||
// Can be added here later if necessary.
|
||||
/*
|
||||
* if (q.getRepeatable()) {
|
||||
repeatabilityLabel = new JLabel("This quest is repeatable");
|
||||
repeatabilityLabel = new JLabel("This challenge is repeatable");
|
||||
} else {
|
||||
repeatabilityLabel = new JLabel("This quest is not repeatable");
|
||||
repeatabilityLabel = new JLabel("This challenge is not repeatable");
|
||||
}
|
||||
|
||||
super.rootPanel.add(repeatabilityLabel);
|
||||
@@ -28,17 +28,16 @@ public class QuestEventManager {
|
||||
public List<QuestDuel> hardAIduels = null;
|
||||
public List<QuestDuel> veryHardAIduels = null;
|
||||
|
||||
public List<QuestDuel> allDuels = null;
|
||||
public List<QuestQuest> allQuests = null;
|
||||
public List<QuestDuel> allDuels = null;
|
||||
public List<QuestChallenge> allChallenges = null;
|
||||
|
||||
/**<p>assembleAllEvents.</p> *
|
||||
* Reads all quest and battle files to extract quest data.
|
||||
* Instantiates all duel and quest events, and difficulty lists accordingly.
|
||||
* Should be used sparingly.
|
||||
* Reads all duel and challenge files and instantiates all events,
|
||||
* and difficulty lists accordingly. Should be used sparingly.
|
||||
*/
|
||||
public void assembleAllEvents() {
|
||||
this.allDuels = new ArrayList<QuestDuel>();
|
||||
this.allQuests = new ArrayList<QuestQuest>();
|
||||
this.allChallenges = new ArrayList<QuestChallenge>();
|
||||
|
||||
List<String> contents;
|
||||
QuestEvent tempEvent;
|
||||
@@ -53,9 +52,9 @@ public class QuestEventManager {
|
||||
contents = FileUtil.readFile(f);
|
||||
|
||||
if(contents.get(0).trim().equals("[quest]")) {
|
||||
tempEvent = new QuestQuest();
|
||||
assembleQuestUniquedata(contents,(QuestQuest)tempEvent);
|
||||
allQuests.add((QuestQuest)tempEvent);
|
||||
tempEvent = new QuestChallenge();
|
||||
assembleChallengeUniquedata(contents,(QuestChallenge)tempEvent);
|
||||
allChallenges.add((QuestChallenge)tempEvent);
|
||||
} // End if([quest])
|
||||
else {
|
||||
tempEvent = new QuestDuel();
|
||||
@@ -99,13 +98,13 @@ public class QuestEventManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>assembleQuestUniquedata.</p>
|
||||
* Handler for any unique data contained in quest files.
|
||||
* <p>assembleChallengeUniquedata.</p>
|
||||
* Handler for any unique data contained in a challenge file.
|
||||
*
|
||||
* @param contents
|
||||
* @param qq
|
||||
* @param qc
|
||||
*/
|
||||
private void assembleQuestUniquedata(List<String> contents, QuestQuest qq) {
|
||||
private void assembleChallengeUniquedata(List<String> contents, QuestChallenge qc) {
|
||||
int eqpos;
|
||||
String key, value;
|
||||
|
||||
@@ -120,23 +119,23 @@ public class QuestEventManager {
|
||||
value = s.substring(eqpos + 1).trim();
|
||||
|
||||
if (key.equalsIgnoreCase("ID")) {
|
||||
qq.id = Integer.parseInt(value);
|
||||
qc.id = Integer.parseInt(value);
|
||||
}
|
||||
else if (key.equalsIgnoreCase("Repeat")) {
|
||||
qq.repeatable = Boolean.parseBoolean(value);
|
||||
qc.repeatable = Boolean.parseBoolean(value);
|
||||
}
|
||||
else if (key.equalsIgnoreCase("AILife")) {
|
||||
qq.aiLife = Integer.parseInt(value);
|
||||
qc.aiLife = Integer.parseInt(value);
|
||||
}
|
||||
else if (key.equalsIgnoreCase("Wins")) {
|
||||
qq.winsReqd = Integer.parseInt(value);
|
||||
qc.winsReqd = Integer.parseInt(value);
|
||||
}
|
||||
else if (key.equalsIgnoreCase("Credit Reward")) {
|
||||
qq.creditsReward = Integer.parseInt(value);
|
||||
qc.creditsReward = Integer.parseInt(value);
|
||||
}
|
||||
else if (key.equalsIgnoreCase("Card Reward")) {
|
||||
qq.cardReward = value;
|
||||
qq.cardRewardList = QuestUtil.generateCardRewardList(value);
|
||||
qc.cardReward = value;
|
||||
qc.cardRewardList = QuestUtil.generateCardRewardList(value);
|
||||
}
|
||||
// Human extra card list assembled here.
|
||||
else if(key.equalsIgnoreCase("HumanExtras") && !value.equals("")) {
|
||||
@@ -147,7 +146,7 @@ public class QuestEventManager {
|
||||
templist.add(readExtraCard(n, AllZone.getHumanPlayer()));
|
||||
}
|
||||
|
||||
qq.humanExtraCards = templist;
|
||||
qc.humanExtraCards = templist;
|
||||
}
|
||||
// AI extra card list assembled here.
|
||||
else if(key.equalsIgnoreCase("AIExtras") && !value.equals("")) {
|
||||
@@ -158,12 +157,12 @@ public class QuestEventManager {
|
||||
templist.add(readExtraCard(n, AllZone.getComputerPlayer()));
|
||||
}
|
||||
|
||||
qq.aiExtraCards = templist;
|
||||
qc.aiExtraCards = templist;
|
||||
}
|
||||
// Card reward list assembled here.
|
||||
else if(key.equalsIgnoreCase("Card Reward")) {
|
||||
qq.cardReward = value;
|
||||
qq.cardRewardList = QuestUtil.generateCardRewardList(value);
|
||||
qc.cardReward = value;
|
||||
qc.cardRewardList = QuestUtil.generateCardRewardList(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,13 +245,13 @@ public class QuestEventManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getAllQuests.</p>
|
||||
* Returns complete list of all quest objects.
|
||||
* <p>getAllChallenges.</p>
|
||||
* Returns complete list of all challenge objects.
|
||||
*
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public List<QuestQuest> getAllQuests() {
|
||||
return this.allQuests;
|
||||
public List<QuestChallenge> getAllChallenges() {
|
||||
return this.allChallenges;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,10 +299,19 @@ public class QuestEventManager {
|
||||
return deckListCopy.get(n);
|
||||
}
|
||||
|
||||
private QuestQuest getQuestOpponentByNumber(int n) {
|
||||
for(QuestQuest qq : allQuests) {
|
||||
if(qq.getId()==n) {
|
||||
return qq;
|
||||
/**
|
||||
* <p>getChallengeOpponentByNumber.</p>
|
||||
* Returns specific challenge event using its ID.
|
||||
* This is to make sure that the opponents do not change
|
||||
* when the deck editor is launched.
|
||||
*
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
private QuestChallenge getChallengeEventByNumber(int n) {
|
||||
for(QuestChallenge qc : allChallenges) {
|
||||
if(qc.getId()==n) {
|
||||
return qc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -358,51 +366,51 @@ public class QuestEventManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>generateQuests.</p>
|
||||
* Generates an array of new quest opponents based on current win conditions.
|
||||
* <p>generateChallenges.</p>
|
||||
* Generates an array of new challenge opponents based on current win conditions.
|
||||
*
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public List<QuestQuest> generateQuests() {
|
||||
public List<QuestChallenge> generateChallenges() {
|
||||
forge.quest.data.QuestData questData = AllZone.getQuestData();
|
||||
|
||||
List<QuestQuest> questOpponents = new ArrayList<QuestQuest>();
|
||||
List<QuestChallenge> challengeOpponents = new ArrayList<QuestChallenge>();
|
||||
|
||||
int maxQuests = questData.getWin() / 10;
|
||||
if (maxQuests > 5) {
|
||||
maxQuests = 5;
|
||||
int maxChallenges = questData.getWin() / 10;
|
||||
if (maxChallenges > 5) {
|
||||
maxChallenges = 5;
|
||||
}
|
||||
|
||||
// Generate IDs as needed.
|
||||
if (questData.getAvailableQuests() == null ||
|
||||
questData.getAvailableQuests().size() < maxQuests) {
|
||||
// Generate IDs as needed.
|
||||
if (questData.getAvailableChallenges() == null ||
|
||||
questData.getAvailableChallenges().size() < maxChallenges) {
|
||||
|
||||
List<Integer> unlockedQuestIds = new ArrayList<Integer>();
|
||||
List<Integer> availableQuestIds = new ArrayList<Integer>();
|
||||
List<Integer> unlockedChallengeIds = new ArrayList<Integer>();
|
||||
List<Integer> availableChallengeIds = new ArrayList<Integer>();
|
||||
|
||||
for(QuestQuest qq : allQuests) {
|
||||
if (qq.getWinsReqd() <= questData.getWin() &&
|
||||
!questData.getCompletedQuests().contains(qq.getId())) {
|
||||
unlockedQuestIds.add(qq.getId());
|
||||
for(QuestChallenge qc : allChallenges) {
|
||||
if (qc.getWinsReqd() <= questData.getWin() &&
|
||||
!questData.getCompletedChallenges().contains(qc.getId())) {
|
||||
unlockedChallengeIds.add(qc.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Collections.shuffle(unlockedQuestIds);
|
||||
Collections.shuffle(unlockedChallengeIds);
|
||||
|
||||
for (int i = 0; i < maxQuests; i++) {
|
||||
availableQuestIds.add(unlockedQuestIds.get(i));
|
||||
for (int i = 0; i < maxChallenges; i++) {
|
||||
availableChallengeIds.add(unlockedChallengeIds.get(i));
|
||||
}
|
||||
|
||||
questData.setAvailableQuests(availableQuestIds);
|
||||
questData.setAvailableChallenges(availableChallengeIds);
|
||||
questData.saveData();
|
||||
}
|
||||
|
||||
// Finally, pull quest events from available IDs and return.
|
||||
for(int i : questData.getAvailableQuests()) {
|
||||
questOpponents.add(getQuestOpponentByNumber(i));
|
||||
// Finally, pull challenge events from available IDs and return.
|
||||
for(int i : questData.getAvailableChallenges()) {
|
||||
challengeOpponents.add(getChallengeEventByNumber(i));
|
||||
}
|
||||
|
||||
return questOpponents;
|
||||
return challengeOpponents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user