From 0c48899181ec6b43f07b55e21f40b9aa57a3141e Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:32:57 +0000 Subject: [PATCH] - Fixed Dark Catacombs. - Added some beginning code of quest rewards for winning within a certain amount of turns. --- src/forge/CardFactory.java | 2 +- src/forge/Gui_WinLose.java | 35 ++++++++++++++++++++++++++++++++--- src/forge/WinLose.java | 11 +++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 80dc3921ab6..30f7b9f8203 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -231,7 +231,7 @@ public class CardFactory implements NewConstants { { Card c = clICtrl.get(i); for (int j = 0; j < types.length; j++) - if (c.getType().contains(types[j])) + if (c.getType().contains(types[j].trim())) fnd = true; } diff --git a/src/forge/Gui_WinLose.java b/src/forge/Gui_WinLose.java index 0f4ff4aebc3..4513d282637 100644 --- a/src/forge/Gui_WinLose.java +++ b/src/forge/Gui_WinLose.java @@ -136,9 +136,24 @@ public class Gui_WinLose extends JFrame implements NewConstants { statsLabel.setText("Won: " + winLose.getWin() + ", Lost: " + winLose.getLose()); //show "You Won" or "You Lost" - if(winLose.didWinRecently()) titleLabel.setText("You Won"); - else titleLabel.setText("You Lost"); - + if(winLose.didWinRecently()) + { + titleLabel.setText("You Won"); + + int game = 0; + if (winLose.getWinTurns()[0] != 0) + game = 1; + winLose.setWinTurn(game, AllZone.Phase.getTurn()); + //winLose.setWinTurn(winLose.countWinLose()-1, AllZone.Phase.getTurn()); + + //System.out.println("CountwinLose:" + winLose.countWinLose()); + //System.out.println("You won by turn: " + AllZone.Phase.getTurn()); + } + else + { + titleLabel.setText("You Lost"); + //System.out.println("You lost by turn: " + AllZone.Phase.getTurn()); + } }//setup(); private void jbInit() throws Exception { @@ -280,6 +295,20 @@ public class Gui_WinLose extends JFrame implements NewConstants { } } } + + int[] winTurns = winLose.getWinTurns(); + + for (int i : winTurns) + { + System.out.println("Quest, won by turn:" + i); + if (i != 0) + { + if (i == 1) + sb.append("Won in one turn! Bonus: +1500 credits.
"); + else if (i <= 5) + sb.append("Won by turn 5! Bonus: +250 credits.
"); + } + } if (winLose.getLose()==0) sb.append("You have not lost once! Bonus: +10 credits.
"); diff --git a/src/forge/WinLose.java b/src/forge/WinLose.java index 273ece47b8e..651afdd06a6 100644 --- a/src/forge/WinLose.java +++ b/src/forge/WinLose.java @@ -10,6 +10,8 @@ public class WinLose //... // private String[] winMethods = new String[2]; + private int[] winTurns = new int[2]; + private int win; private int lose; @@ -33,6 +35,15 @@ public class WinLose return winMethods; } + public void setWinTurn(int gameNumber, int turns) + { + winTurns[gameNumber] = turns; + } + + public int[] getWinTurns() + { + return winTurns; + } public boolean didWinRecently() {return winRecently;} } \ No newline at end of file