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.quest.data.QuestMatchState;
|
||||
import forge.quest.data.QuestData;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.quest.gui.main.QuestEvent;
|
||||
import forge.quest.gui.main.QuestEventManager;
|
||||
|
||||
@@ -43,11 +42,6 @@ public final class AllZone implements NewConstants {
|
||||
/** Global <code>questData</code>. */
|
||||
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>. */
|
||||
private static QuestEvent questEvent = null;
|
||||
|
||||
@@ -142,27 +136,6 @@ public final class AllZone implements NewConstants {
|
||||
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>
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.item.CardPrinted;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.quest.gui.main.QuestEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -654,7 +655,7 @@ public class GameAction {
|
||||
AllZone.getDisplay().savePrefs();
|
||||
frame.setEnabled(false);
|
||||
//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.toFront();
|
||||
canShowWinLose = false;
|
||||
@@ -1092,15 +1093,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 QuestChallenge qc)
|
||||
final CardList computer, final int humanLife, final int computerLife, final QuestEvent qe)
|
||||
{
|
||||
this.newGame(humanDeck, computerDeck);
|
||||
|
||||
AllZone.getComputerPlayer().setLife(computerLife, null);
|
||||
AllZone.getHumanPlayer().setLife(humanLife, null);
|
||||
|
||||
if (qc != null) {
|
||||
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestChallenge()));
|
||||
if (qe != null && ((QuestChallenge)qe).getEventType().equals("challenge")) {
|
||||
computer.addAll(forge.quest.data.QuestUtil.getComputerStartingCards(AllZone.getQuestData(), AllZone.getQuestEvent()));
|
||||
}
|
||||
|
||||
for (Card c : human) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import forge.quest.data.QuestMatchState;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.quest.gui.QuestFrame;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.quest.gui.main.QuestEvent;
|
||||
import forge.view.swing.Gui_HomeScreen;
|
||||
import forge.view.swing.OldGuiNewGame;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
@@ -66,7 +67,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
private class WinLoseModel {
|
||||
public QuestMatchState match;
|
||||
public QuestData quest;
|
||||
public QuestChallenge qc;
|
||||
public QuestEvent event;
|
||||
}
|
||||
|
||||
private WinLoseModel model;
|
||||
@@ -78,11 +79,11 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
* @param quest a QuestData 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.match = matchState;
|
||||
model.quest = quest;
|
||||
model.qc = chall;
|
||||
model.event = event;
|
||||
|
||||
try {
|
||||
jbInit();
|
||||
@@ -188,25 +189,28 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
void prepareForNextRound() {
|
||||
if (Constant.Quest.fantasyQuest[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")) {
|
||||
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.qc);
|
||||
CardList humanList = forge.quest.data.QuestUtil.getHumanStartingCards(model.quest, model.event);
|
||||
CardList computerList = new CardList();
|
||||
|
||||
|
||||
int humanLife = model.quest.getLife() + extraLife;
|
||||
int computerLife = 20;
|
||||
if (model.qc != null) {
|
||||
computerLife = model.qc.getAILife();
|
||||
if (model.event.getEventType().equals("challenge")) {
|
||||
computerLife = ((QuestChallenge)model.event).getAILife();
|
||||
}
|
||||
|
||||
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0],
|
||||
humanList, computerList, humanLife, computerLife, model.qc);
|
||||
humanList, computerList, humanLife, computerLife, model.event);
|
||||
} else {
|
||||
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);
|
||||
|
||||
model.match.reset();
|
||||
AllZone.setQuestChallenge(null);
|
||||
AllZone.setQuestEvent(null);
|
||||
|
||||
model.quest.saveData();
|
||||
|
||||
@@ -455,16 +459,16 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
}
|
||||
|
||||
// Rewards from QuestAssignment
|
||||
if (wonMatch && model.qc != null) {
|
||||
if (wonMatch && model.event.getEventType().equals("challenge")) {
|
||||
// Set repeatability
|
||||
if(!model.qc.getRepeatable()) {
|
||||
model.quest.addCompletedChallenge(model.qc.getId());
|
||||
if(!((QuestChallenge)model.event).getRepeatable()) {
|
||||
model.quest.addCompletedChallenge(((QuestChallenge)model.event).getId());
|
||||
}
|
||||
|
||||
model.quest.addChallengesPlayed();
|
||||
|
||||
List<CardPrinted> challengeRewardCards = model.qc.getCardRewardList();
|
||||
long questRewardCredits = model.qc.getCreditsReward();
|
||||
List<CardPrinted> challengeRewardCards = ((QuestChallenge)model.event).getCardRewardList();
|
||||
long questRewardCredits = ((QuestChallenge)model.event).getCreditsReward();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Challenge Completed - \r\n");
|
||||
@@ -485,7 +489,7 @@ public class Gui_WinLose extends JFrame implements NewConstants {
|
||||
|
||||
String fileName = "BoxIcon.png";
|
||||
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);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -7,6 +7,7 @@ import forge.card.CardRarity;
|
||||
import forge.card.BoosterUtils;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.quest.gui.main.QuestChallenge;
|
||||
import forge.quest.gui.main.QuestEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,17 +31,17 @@ public class QuestUtil {
|
||||
|
||||
/**
|
||||
* <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 qc a QuestChallenge object.
|
||||
* @param qe a {@link forge.quest.gui.main.QuestEvent} 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();
|
||||
|
||||
if (qc != null) {
|
||||
list.addAll(qc.getAIExtraCards());
|
||||
if (qe.getEventType().equals("challenge")) {
|
||||
list.addAll(((QuestChallenge)qe).getAIExtraCards());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -72,14 +73,14 @@ public class QuestUtil {
|
||||
* and cards in play at start of quest.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
public static CardList getHumanStartingCards(final QuestData qd, QuestChallenge qc) {
|
||||
public static CardList getHumanStartingCards(final QuestData qd, QuestEvent qe) {
|
||||
CardList list = getHumanStartingCards(qd);
|
||||
|
||||
if (qc != null) {
|
||||
list.addAll(qc.getHumanExtraCards());
|
||||
if (qe.getEventType().equals("challenge")) {
|
||||
list.addAll(((QuestChallenge)qe).getHumanExtraCards());
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -723,9 +723,6 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
|
||||
AllZone.setQuestEvent(selectedChallenge);
|
||||
|
||||
// will be deprecated in favor of setQuestEvent, see note in AllZone. doublestrike 28-09-11
|
||||
AllZone.setQuestChallenge(selectedChallenge);
|
||||
|
||||
int extraLife = 0;
|
||||
|
||||
if (questData.getInventory().getItemLevel("Gear") == 2) {
|
||||
|
||||
@@ -29,6 +29,11 @@ public class QuestChallenge extends QuestEvent {
|
||||
public CardList aiExtraCards = new CardList();
|
||||
public List<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
|
||||
|
||||
public QuestChallenge() {
|
||||
super();
|
||||
eventType = "challenge";
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getAILife.</p>
|
||||
*
|
||||
|
||||
@@ -7,6 +7,9 @@ package forge.quest.gui.main;
|
||||
*/
|
||||
public class QuestDuel extends QuestEvent {
|
||||
|
||||
// [QuestDuel has no unique properties yet.]
|
||||
public QuestDuel() {
|
||||
super();
|
||||
eventType = "duel";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class QuestEvent {
|
||||
public String difficulty = "Medium";
|
||||
public String icon = "Unknown.jpg";
|
||||
public String name = "Noname";
|
||||
public String eventType = null;
|
||||
|
||||
/**
|
||||
* <p>getTitle.</p>
|
||||
@@ -53,6 +54,15 @@ public class QuestEvent {
|
||||
return eventDeck;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getEventDeck.</p>
|
||||
*
|
||||
* @return {@link forge.deck.Deck}
|
||||
*/
|
||||
public final String getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getIcon.</p>
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user