From eff6c3d98a100134e9ab65d98748b480228fb3c6 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:46:12 +0000 Subject: [PATCH] - Fixed a bug with Liliana Vess (and probably some other cards) if the human player is targeted while having an empty hand. - Fixed a bug with Ashes to Ashes. - Fixed a bug with Korlash, Heir to Blackblade (selecting all or more than two swamps would put all of them into play). - Added some alternate win condition rewards in Quest mode (untested). --- res/quest/all-prices.txt | 1 + src/forge/CardFactory.java | 10 +++++++--- src/forge/CardFactoryUtil.java | 3 ++- src/forge/CardFactory_Creatures.java | 4 +++- src/forge/GameAction.java | 17 ++++++++++++++++- src/forge/GameActionUtil.java | 15 +++++++++++++++ src/forge/Gui_WinLose.java | 23 ++++++++++++++++++++--- src/forge/QuestData.java | 14 ++++++++++++++ src/forge/WinLose.java | 25 +++++++++++++++++++++++-- 9 files changed, 101 insertions(+), 11 deletions(-) diff --git a/res/quest/all-prices.txt b/res/quest/all-prices.txt index 3581cec64fe..0d27af76199 100644 --- a/res/quest/all-prices.txt +++ b/res/quest/all-prices.txt @@ -4502,6 +4502,7 @@ Izzet Signet =25 Jabari's Banner =23 Jabari's Influence =93 Jace Beleren =630 +Jace, the Mind Sculptor =5055 Jack-in-the-Mox =99 Jackal Familiar =25 Jackal Pup =28 diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 5640d0f2a71..dda23a86da6 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -5015,9 +5015,8 @@ public class CardFactory implements NewConstants { public void resolve() { for(int i = 0; i < target.length; i++) { Card c = target[i]; - PlayerZone remove = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); - - AllZone.GameAction.moveTo(remove, c); + if (AllZone.GameAction.isCardInPlay(c)) + AllZone.GameAction.removeFromGame(c); } PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); @@ -14125,6 +14124,11 @@ public class CardFactory implements NewConstants { @Override public void resolve() { AllZone.GameAction.getPlayerLife(getTargetPlayer()).setLife(0); + + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin()==1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber,"Door to Nothingness"); } @Override diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index df40a768ab8..3f779007a6b 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -541,6 +541,7 @@ public class CardFactoryUtil { @Override public void showMessage() { + if (AllZone.Human_Hand.getCards().length == 0) stop(); AllZone.Display.showMessage("Select " + (nCards - n) + " cards to discard, unless you discard a " + uType + "."); ButtonUtil.disableAll(); @@ -1731,8 +1732,8 @@ public class CardFactoryUtil { @Override public void showMessage() { + if (AllZone.Human_Hand.getCards().length == 0) stop(); - AllZone.Display.showMessage("Select a card to discard"); ButtonUtil.disableAll(); } diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 81cd315cdbc..6b025a50708 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -1099,7 +1099,9 @@ public class CardFactory_Creatures { List selection = AllZone.Display.getChoices("Select up to two swamps", swamp.toArray()); for(int i = 0; i < selection.size(); i++) { - Card c = selection.get(i); + if (i == 2) + break; + Card c = selection.get(i); library.remove(c); play.add(c); diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index b0d6fabd961..f819ace701e 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -415,10 +415,19 @@ public class GameAction { if (isAliFromCairoInPlay(AllZone.Human_Play) && AllZone.Human_Life.getLife() < 1) AllZone.Human_Life.setLife(1); - if(AllZone.Computer_Life.getLife() <= 0 || AllZone.Computer_PoisonCounter.getPoisonCounters() >= 10) { + if(AllZone.Computer_Life.getLife() <= 0 ) { Constant.Runtime.WinLose.addWin(); stop = true; } + if (AllZone.Computer_PoisonCounter.getPoisonCounters() >= 10) + { + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin() == 1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber, "Poison Counters"); + Constant.Runtime.WinLose.addWin(); + stop = true; + } if(AllZone.Human_Life.getLife() <= 0 || AllZone.Human_PoisonCounter.getPoisonCounters() >= 10) { Constant.Runtime.WinLose.addLose(); stop = true; @@ -781,6 +790,12 @@ public class GameAction { //lose: else if(Constant.Runtime.Mill[0]) { PlayerLife life = AllZone.GameAction.getPlayerLife(player); + + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin()==1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber,"Battle of Wits"); + life.setLife(0); checkStateEffects(); } diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index a15b8cd4844..860c05395e2 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -5846,6 +5846,11 @@ public class GameActionUtil { public void resolve() { String opponent = AllZone.GameAction.getOpponent(player); PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); + + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin()==1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber,"Felidar Sovereign"); life.setLife(0); } };// Ability @@ -5869,6 +5874,12 @@ public class GameActionUtil { public void resolve() { String opponent = AllZone.GameAction.getOpponent(player); PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); + + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin()==1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber,"Battle of Wits"); + life.setLife(0); } };// Ability @@ -5891,6 +5902,10 @@ public class GameActionUtil { @Override public void resolve() { + int gameNumber = 0; + if (Constant.Runtime.WinLose.getWin()==1) + gameNumber = 1; + Constant.Runtime.WinLose.setWinMethod(gameNumber,"Helix Pinnacle"); AllZone.GameAction.getPlayerLife(AllZone.GameAction.getOpponent(player)) .setLife(0); } diff --git a/src/forge/Gui_WinLose.java b/src/forge/Gui_WinLose.java index 03a04b68187..cc8f4f81b73 100644 --- a/src/forge/Gui_WinLose.java +++ b/src/forge/Gui_WinLose.java @@ -47,7 +47,6 @@ public class Gui_WinLose extends JFrame implements NewConstants { Constant.Runtime.WinLose.addWin(); Constant.Runtime.WinLose.addLose(); - //setup limited deck Deck deck = new Deck(Constant.GameType.Sealed); CardList pack = new CardList(BoosterPack.getBoosterPack(1).toArray()); @@ -181,8 +180,24 @@ public class Gui_WinLose extends JFrame implements NewConstants { private String getWinText(long creds, WinLose winLose) { StringBuilder sb = new StringBuilder(); + String[] wins = winLose.getWinMethods(); + + + for (String s : wins) + { + if (s != null) { + if (s.equals("Poison Counters") || s.equals("Milled") || s.equals("Battle of Wits") || + s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") || + s.equals("Door to Nothingness")) { + sb.append("Alternate win condition: "); + sb.append(s); + sb.append("! Bonus: +100 credits.\r\n"); + } + } + } + if (winLose.getLose()==0) - sb.append("You have not lost once! Bonus: 10 credits.\r\n"); + sb.append("You have not lost once! Bonus: +10 credits.\r\n"); sb.append("You have earned " + creds + " credits in total."); return sb.toString(); } @@ -197,7 +212,9 @@ public class Gui_WinLose extends JFrame implements NewConstants { void quitButton_actionPerformed(ActionEvent e) { //are we on a quest? - if(AllZone.QuestData == null) new Gui_NewGame(); + if(AllZone.QuestData == null) { + new Gui_NewGame(); + } else { //Quest WinLose winLose = Constant.Runtime.WinLose; QuestData quest = AllZone.QuestData; diff --git a/src/forge/QuestData.java b/src/forge/QuestData.java index 344c817a21f..01301f3cf47 100644 --- a/src/forge/QuestData.java +++ b/src/forge/QuestData.java @@ -419,8 +419,22 @@ public class QuestData implements NewConstants { public long getCreditsToAdd(WinLose winLose) { long creds = (long) (10 + (0.2 * win)); + String[] wins = winLose.getWinMethods(); + if (winLose.getLose() == 0) creds += 10; + + for(String s : wins) + { + if (s != null) { + if (s.equals("Poison Counters") || s.equals("Milled") || s.equals("Battle of Wits") || + s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") || + s.equals("Door to Nothingness")) { + creds+=100; + } + } + } + this.addCredits(creds); return creds; diff --git a/src/forge/WinLose.java b/src/forge/WinLose.java index 2d700ff0e0f..273ece47b8e 100644 --- a/src/forge/WinLose.java +++ b/src/forge/WinLose.java @@ -1,17 +1,38 @@ package forge; public class WinLose { + //the way wins were achieved: + //Damage + //Poison Counters + //Battle of Wits + //Milled + //Felidar Sovereign + //... + // + private String[] winMethods = new String[2]; + private int win; private int lose; private boolean winRecently; - public void reset() {win = 0; lose = 0;} + public void reset() {win = 0; lose = 0; winMethods = new String[2];} public void addWin() {win++; winRecently = true;} public void addLose(){lose++; winRecently = false;} - + public int getWin() {return win;} public int getLose() {return lose;} public int countWinLose() {return win + lose;} + + public void setWinMethod(int gameNumber, String method) + { + winMethods[gameNumber] = method; + } + + public String[] getWinMethods() + { + return winMethods; + } + public boolean didWinRecently() {return winRecently;} } \ No newline at end of file