From 2e385482f49f9bbb57b35c83e039990162ee6a4c Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 13:38:10 +0000 Subject: [PATCH] - Quest will now ask before overwriting quest data with a new quest. - Quest will list the actual credits earned after winning a match. --- src/forge/Gui_QuestOptions.java | 23 ++++++++++++++++------- src/forge/Gui_WinLose.java | 27 +++++++++++++++------------ 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/forge/Gui_QuestOptions.java b/src/forge/Gui_QuestOptions.java index 4c3f876948e..49e1b8acdd3 100644 --- a/src/forge/Gui_QuestOptions.java +++ b/src/forge/Gui_QuestOptions.java @@ -13,6 +13,7 @@ import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextArea; @@ -132,8 +133,8 @@ public class Gui_QuestOptions extends JFrame { gridLayout1.setRows(4); easyRadio.setText("Easy - 50 games"); - hardRadio.setText("Hard - 200 games"); mediumRadio.setText("Medium - 100 games"); + hardRadio.setText("Hard - 200 games"); veryHardRadio.setText("Very Hard - 300 games"); realisticRadio.setText("Realistic"); fantasyRadio.setText("Fantasy"); @@ -207,10 +208,7 @@ public class Gui_QuestOptions extends JFrame { void newQuestButton_actionPerformed(ActionEvent e) { int difficulty = 0; - String mode = "Realistic"; - - if (fantasyRadio.isSelected()) - mode = "Fantasy"; + String mode = fantasyRadio.isSelected() ? "Fantasy" : "Realistic"; if(easyRadio.isSelected()) difficulty = 0; @@ -220,8 +218,19 @@ public class Gui_QuestOptions extends JFrame { else if(veryHardRadio.isSelected()) difficulty = 3; - else //user didn't select a difficulty - return; + else //user didn't select a difficulty{ + return; + + if (questData.hasSaveFile()){ + // this will overwrite your save file! + Object[] possibleValues = {"Yes", "No"}; + Object choice = JOptionPane.showOptionDialog(null, "Starting a new quest will overwrite your current quest. Continue?", + "Start New Quest?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, + null, possibleValues, possibleValues[0]); + + if (!choice.equals(0)) + return; + } //give the user a few cards to build a deck questData.newGame(difficulty, mode); diff --git a/src/forge/Gui_WinLose.java b/src/forge/Gui_WinLose.java index a4251134b3e..ef33116c60e 100644 --- a/src/forge/Gui_WinLose.java +++ b/src/forge/Gui_WinLose.java @@ -297,6 +297,8 @@ public class Gui_WinLose extends JFrame implements NewConstants { sb.append(""); + QuestData_Prefs qdPrefs = q.qdPrefs; + for (String s : wins) { if (s != null) { @@ -307,15 +309,15 @@ public class Gui_WinLose extends JFrame implements NewConstants { sb.append("! Bonus: +"); if (s.equals("Poison Counters")) - sb.append(q.qdPrefs.getMatchRewardPoisonWinBonus()); + sb.append(qdPrefs.getMatchRewardPoisonWinBonus()); else if (s.equals("Milled")) - sb.append(q.qdPrefs.getMatchRewardMilledWinBonus()); + sb.append(qdPrefs.getMatchRewardMilledWinBonus()); else if (s.equals("Battle of Wits") || s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") || s.equals("Door to Nothingness") || s.equals("Barren Glory") || s.equals("Near-Death Experience") || s.equals("Mortal Combat") || s.equals("Test of Endurance") ) { - sb.append(q.qdPrefs.getMatchRewardAltWinBonus()); + sb.append(qdPrefs.getMatchRewardAltWinBonus()); } sb.append(" credits.
"); @@ -329,14 +331,14 @@ public class Gui_WinLose extends JFrame implements NewConstants { System.out.println("Quest, won by turn:" + i); if (i != 0) { - if (i == 1) - sb.append("Won in one turn! Bonus: +1500 credits.
"); + if (i == 1) + creds += qdPrefs.getMatchRewardWinFirst(); else if (i <= 5) - sb.append("Won by turn 5! Bonus: +250 credits.
"); + creds += qdPrefs.getMatchRewardWinByFifth(); else if (i <= 10) - sb.append("Won by turn 10! Bonus: +50 credits.
"); + creds += qdPrefs.getMatchRewardWinByTen(); else if (i <= 15) - sb.append("Won by turn 15! Bonus: +5 credits.
"); + creds += qdPrefs.getMatchRewardWinByFifteen(); } } @@ -344,14 +346,15 @@ public class Gui_WinLose extends JFrame implements NewConstants { for (boolean b : mulliganedToZero) { - if (b == true) - { - sb.append("Mulliganed to zero and still won! Bonus: +500 credits.
"); + if (b){ + sb.append("Mulliganed to zero and still won! Bonus: +"); + sb.append(qdPrefs.getMatchMullToZero()).append(" credits.
"); } } if (winLose.getLose()==0) - sb.append("You have not lost once! Bonus: +10 credits.
"); + sb.append("You have not lost once! Bonus: +"); + sb.append(qdPrefs.getMatchRewardNoLosses()).append(" credits.
"); if(q.getEstatesLevel() == 1) sb.append("Estates bonus: 10%.
");