mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Replaced AllZone global "QuestChallenge" with its superclass "QuestEvent".
This commit is contained in:
@@ -17,7 +17,6 @@ import forge.properties.ForgeProps;
|
|||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
import forge.quest.data.QuestMatchState;
|
import forge.quest.data.QuestMatchState;
|
||||||
import forge.quest.data.QuestData;
|
import forge.quest.data.QuestData;
|
||||||
import forge.quest.gui.main.QuestChallenge;
|
|
||||||
import forge.quest.gui.main.QuestEvent;
|
import forge.quest.gui.main.QuestEvent;
|
||||||
import forge.quest.gui.main.QuestEventManager;
|
import forge.quest.gui.main.QuestEventManager;
|
||||||
|
|
||||||
@@ -42,11 +41,6 @@ public final class AllZone implements NewConstants {
|
|||||||
|
|
||||||
/** Global <code>questData</code>. */
|
/** Global <code>questData</code>. */
|
||||||
private static forge.quest.data.QuestData questData = null;
|
private static forge.quest.data.QuestData questData = null;
|
||||||
|
|
||||||
/** Global <code>QuestChallenge</code>. */
|
|
||||||
private static QuestChallenge questChallenge = null;
|
|
||||||
// QuestChallenge extends QuestEvent. This global will be deprecated shortly,
|
|
||||||
// and the QuestEvent global used instead. doublestrike 28-09-11
|
|
||||||
|
|
||||||
/** Global <code>QuestChallenge</code>. */
|
/** Global <code>QuestChallenge</code>. */
|
||||||
private static QuestEvent questEvent = null;
|
private static QuestEvent questEvent = null;
|
||||||
@@ -141,27 +135,6 @@ public final class AllZone implements NewConstants {
|
|||||||
public static void setQuestData(final QuestData questData0) {
|
public static void setQuestData(final QuestData questData0) {
|
||||||
questData = questData0;
|
questData = questData0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>getQuestChallenge.</p>
|
|
||||||
*
|
|
||||||
* @return a {@link forge.quest.gui.main.QuestChallenge} object.
|
|
||||||
* @since 1.0.15
|
|
||||||
*/
|
|
||||||
// QuestChallenge extends QuestEvent. This global will be deprecated shortly,
|
|
||||||
// and the QuestEvent global used instead. doublestrike 28-09-11
|
|
||||||
public static QuestChallenge getQuestChallenge() {
|
|
||||||
return questChallenge;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>setQuestChallenge.</p>
|
|
||||||
*
|
|
||||||
* @param {@link forge.quest.gui.main.QuestChallenge} object.
|
|
||||||
*/
|
|
||||||
public static void setQuestChallenge(final QuestChallenge q) {
|
|
||||||
questChallenge = q;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getQuestEvent.</p>
|
* <p>getQuestEvent.</p>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.item.CardPrinted;
|
|||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;
|
import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;
|
||||||
import forge.quest.gui.main.QuestChallenge;
|
import forge.quest.gui.main.QuestChallenge;
|
||||||
|
import forge.quest.gui.main.QuestEvent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -654,7 +655,7 @@ public class GameAction {
|
|||||||
AllZone.getDisplay().savePrefs();
|
AllZone.getDisplay().savePrefs();
|
||||||
frame.setEnabled(false);
|
frame.setEnabled(false);
|
||||||
//frame.dispose();
|
//frame.dispose();
|
||||||
Gui_WinLose gwl = new Gui_WinLose(AllZone.getMatchState(), AllZone.getQuestData(), AllZone.getQuestChallenge());
|
Gui_WinLose gwl = new Gui_WinLose(AllZone.getMatchState(), AllZone.getQuestData(), AllZone.getQuestEvent());
|
||||||
//gwl.setAlwaysOnTop(true);
|
//gwl.setAlwaysOnTop(true);
|
||||||
gwl.toFront();
|
gwl.toFront();
|
||||||
canShowWinLose = false;
|
canShowWinLose = false;
|
||||||
@@ -1092,15 +1093,15 @@ public class GameAction {
|
|||||||
* @param computer a {@link forge.CardList} object.
|
* @param computer a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
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 QuestChallenge qc)
|
final CardList computer, final int humanLife, final int computerLife, final QuestEvent qe)
|
||||||
{
|
{
|
||||||
this.newGame(humanDeck, computerDeck);
|
this.newGame(humanDeck, computerDeck);
|
||||||
|
|
||||||
AllZone.getComputerPlayer().setLife(computerLife, null);
|
AllZone.getComputerPlayer().setLife(computerLife, null);
|
||||||
AllZone.getHumanPlayer().setLife(humanLife, null);
|
AllZone.getHumanPlayer().setLife(humanLife, null);
|
||||||
|
|
||||||
if (qc != null) {
|
if (qe != null && ((QuestChallenge)qe).getEventType().equals("challenge")) {
|
||||||
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestChallenge()));
|
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestEvent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Card c : human) {
|
for (Card c : human) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import forge.quest.data.QuestMatchState;
|
|||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.quest.gui.QuestFrame;
|
import forge.quest.gui.QuestFrame;
|
||||||
import forge.quest.gui.main.QuestChallenge;
|
import forge.quest.gui.main.QuestChallenge;
|
||||||
|
import forge.quest.gui.main.QuestEvent;
|
||||||
import forge.view.swing.Gui_HomeScreen;
|
import forge.view.swing.Gui_HomeScreen;
|
||||||
import forge.view.swing.OldGuiNewGame;
|
import forge.view.swing.OldGuiNewGame;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -66,7 +67,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
private class WinLoseModel {
|
private class WinLoseModel {
|
||||||
public QuestMatchState match;
|
public QuestMatchState match;
|
||||||
public QuestData quest;
|
public QuestData quest;
|
||||||
public QuestChallenge qc;
|
public QuestEvent event;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WinLoseModel model;
|
private WinLoseModel model;
|
||||||
@@ -78,11 +79,11 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
* @param quest a QuestData object
|
* @param quest a QuestData object
|
||||||
* @param chall a QuestChallenge object
|
* @param chall a QuestChallenge object
|
||||||
*/
|
*/
|
||||||
public Gui_WinLose(final QuestMatchState matchState, final QuestData quest, final QuestChallenge chall) {
|
public Gui_WinLose(final QuestMatchState matchState, final QuestData quest, final QuestEvent event) {
|
||||||
model = new WinLoseModel();
|
model = new WinLoseModel();
|
||||||
model.match = matchState;
|
model.match = matchState;
|
||||||
model.quest = quest;
|
model.quest = quest;
|
||||||
model.qc = chall;
|
model.event = event;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
jbInit();
|
jbInit();
|
||||||
@@ -188,25 +189,28 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
void prepareForNextRound() {
|
void prepareForNextRound() {
|
||||||
if (Constant.Quest.fantasyQuest[0]) {
|
if (Constant.Quest.fantasyQuest[0]) {
|
||||||
int extraLife = 0;
|
int extraLife = 0;
|
||||||
if (model.qc != null) {
|
|
||||||
|
System.out.println("Gui_WinLose: "+model.event.getEventType()); // ghandi
|
||||||
|
|
||||||
|
if (model.event.getEventType().equals("challenge")) {
|
||||||
if (model.quest.getInventory().hasItem("Zeppelin")) {
|
if (model.quest.getInventory().hasItem("Zeppelin")) {
|
||||||
extraLife = 3;
|
extraLife = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
//AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
||||||
//humanList, computerList, humanLife, computerLife);
|
//humanList, computerList, humanLife, computerLife);
|
||||||
CardList humanList = forge.quest.data.QuestUtil.getHumanStartingCards(model.quest, model.qc);
|
CardList humanList = forge.quest.data.QuestUtil.getHumanStartingCards(model.quest, model.event);
|
||||||
CardList computerList = new CardList();
|
CardList computerList = new CardList();
|
||||||
|
|
||||||
|
|
||||||
int humanLife = model.quest.getLife() + extraLife;
|
int humanLife = model.quest.getLife() + extraLife;
|
||||||
int computerLife = 20;
|
int computerLife = 20;
|
||||||
if (model.qc != null) {
|
if (model.event.getEventType().equals("challenge")) {
|
||||||
computerLife = model.qc.getAILife();
|
computerLife = ((QuestChallenge)model.event).getAILife();
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
||||||
humanList, computerList, humanLife, computerLife, model.qc);
|
humanList, computerList, humanLife, computerLife, model.event);
|
||||||
} else {
|
} else {
|
||||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
|
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
|
||||||
}
|
}
|
||||||
@@ -377,7 +381,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
giveQuestRewards(wonMatch);
|
giveQuestRewards(wonMatch);
|
||||||
|
|
||||||
model.match.reset();
|
model.match.reset();
|
||||||
AllZone.setQuestChallenge(null);
|
AllZone.setQuestEvent(null);
|
||||||
|
|
||||||
model.quest.saveData();
|
model.quest.saveData();
|
||||||
|
|
||||||
@@ -455,16 +459,16 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rewards from QuestAssignment
|
// Rewards from QuestAssignment
|
||||||
if (wonMatch && model.qc != null) {
|
if (wonMatch && model.event.getEventType().equals("challenge")) {
|
||||||
// Set repeatability
|
// Set repeatability
|
||||||
if(!model.qc.getRepeatable()) {
|
if(!((QuestChallenge)model.event).getRepeatable()) {
|
||||||
model.quest.addCompletedChallenge(model.qc.getId());
|
model.quest.addCompletedChallenge(((QuestChallenge)model.event).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
model.quest.addChallengesPlayed();
|
model.quest.addChallengesPlayed();
|
||||||
|
|
||||||
List<CardPrinted> challengeRewardCards = model.qc.getCardRewardList();
|
List<CardPrinted> challengeRewardCards = ((QuestChallenge)model.event).getCardRewardList();
|
||||||
long questRewardCredits = model.qc.getCreditsReward();
|
long questRewardCredits = ((QuestChallenge)model.event).getCreditsReward();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Challenge Completed - \r\n");
|
sb.append("Challenge Completed - \r\n");
|
||||||
@@ -485,7 +489,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
|||||||
|
|
||||||
String fileName = "BoxIcon.png";
|
String fileName = "BoxIcon.png";
|
||||||
ImageIcon icon = getIcon(fileName);
|
ImageIcon icon = getIcon(fileName);
|
||||||
String title = "Challenge Rewards for " + model.qc.getTitle();
|
String title = "Challenge Rewards for " + ((QuestChallenge)model.event).getTitle();
|
||||||
JOptionPane.showMessageDialog(null, sb.toString(), title, JOptionPane.INFORMATION_MESSAGE, icon);
|
JOptionPane.showMessageDialog(null, sb.toString(), title, JOptionPane.INFORMATION_MESSAGE, icon);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import forge.card.CardRarity;
|
|||||||
import forge.card.BoosterUtils;
|
import forge.card.BoosterUtils;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.quest.gui.main.QuestChallenge;
|
import forge.quest.gui.main.QuestChallenge;
|
||||||
|
import forge.quest.gui.main.QuestEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -30,17 +31,17 @@ public class QuestUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getComputerStartingCards.</p>
|
* <p>getComputerStartingCards.</p>
|
||||||
* Returns extra AI cards in play at start of quest.
|
* Returns extra AI cards in play at start of event.
|
||||||
*
|
*
|
||||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||||
* @param qc a QuestChallenge object.
|
* @param qe a {@link forge.quest.gui.main.QuestEvent} object.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public static CardList getComputerStartingCards(final QuestData qd, QuestChallenge qc) {
|
public static CardList getComputerStartingCards(final QuestData qd, QuestEvent qe) {
|
||||||
CardList list = new CardList();
|
CardList list = new CardList();
|
||||||
|
|
||||||
if (qc != null) {
|
if (qe.getEventType().equals("challenge")) {
|
||||||
list.addAll(qc.getAIExtraCards());
|
list.addAll(((QuestChallenge)qe).getAIExtraCards());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -72,14 +73,14 @@ public class QuestUtil {
|
|||||||
* and cards in play at start of quest.
|
* and cards in play at start of quest.
|
||||||
*
|
*
|
||||||
* @param qd a {@link forge.quest.data.QuestData} object.
|
* @param qd a {@link forge.quest.data.QuestData} object.
|
||||||
* @param qc a QuestChallenge object.
|
* @param qe a {@link forge.quest.gui.main.QuestEvent} object.
|
||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
public static CardList getHumanStartingCards(final QuestData qd, QuestChallenge qc) {
|
public static CardList getHumanStartingCards(final QuestData qd, QuestEvent qe) {
|
||||||
CardList list = getHumanStartingCards(qd);
|
CardList list = getHumanStartingCards(qd);
|
||||||
|
|
||||||
if (qc != null) {
|
if (qe.getEventType().equals("challenge")) {
|
||||||
list.addAll(qc.getHumanExtraCards());
|
list.addAll(((QuestChallenge)qe).getHumanExtraCards());
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -722,9 +722,6 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
|||||||
Constant.Runtime.ComputerDeck[0] = computer;
|
Constant.Runtime.ComputerDeck[0] = computer;
|
||||||
|
|
||||||
AllZone.setQuestEvent(selectedChallenge);
|
AllZone.setQuestEvent(selectedChallenge);
|
||||||
|
|
||||||
// will be deprecated in favor of setQuestEvent, see note in AllZone. doublestrike 28-09-11
|
|
||||||
AllZone.setQuestChallenge(selectedChallenge);
|
|
||||||
|
|
||||||
int extraLife = 0;
|
int extraLife = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ public class QuestChallenge extends QuestEvent {
|
|||||||
public CardList aiExtraCards = new CardList();
|
public CardList aiExtraCards = new CardList();
|
||||||
public List<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
|
public List<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
|
public QuestChallenge() {
|
||||||
|
super();
|
||||||
|
eventType = "challenge";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getAILife.</p>
|
* <p>getAILife.</p>
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ package forge.quest.gui.main;
|
|||||||
*/
|
*/
|
||||||
public class QuestDuel extends QuestEvent {
|
public class QuestDuel extends QuestEvent {
|
||||||
|
|
||||||
// [QuestDuel has no unique properties yet.]
|
public QuestDuel() {
|
||||||
|
super();
|
||||||
|
eventType = "duel";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ public class QuestEvent {
|
|||||||
public String description = "";
|
public String description = "";
|
||||||
public String difficulty = "Medium";
|
public String difficulty = "Medium";
|
||||||
public String icon = "Unknown.jpg";
|
public String icon = "Unknown.jpg";
|
||||||
public String name = "Noname";
|
public String name = "Noname";
|
||||||
|
public String eventType = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getTitle.</p>
|
* <p>getTitle.</p>
|
||||||
@@ -53,6 +54,15 @@ public class QuestEvent {
|
|||||||
return eventDeck;
|
return eventDeck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>getEventDeck.</p>
|
||||||
|
*
|
||||||
|
* @return {@link forge.deck.Deck}
|
||||||
|
*/
|
||||||
|
public final String getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getIcon.</p>
|
* <p>getIcon.</p>
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user