diff --git a/.gitattributes b/.gitattributes index aafed2be8d2..4271852c08a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,6 +26,8 @@ res/lib/napkinlaf-swingset-1.2.jar -text svneol=unset#unset res/lib/nimrodlf.jar -text svneol=unset#unset res/lib/substance.jar -text svneol=unset#unset res/main.properties svneol=native#text/plain +res/pics/BookIcon.png -text svneol=unset#image/png +res/pics/GoldIcon.png -text svneol=unset#image/png res/pics_link/card-pictures_a.txt -text svneol=native#text/plain res/pics_link/card-pictures_b.txt -text svneol=native#text/plain res/pics_link/card-pictures_c.txt -text svneol=native#text/plain diff --git a/res/pics/BookIcon.png b/res/pics/BookIcon.png new file mode 100644 index 00000000000..30d49b3a1e9 Binary files /dev/null and b/res/pics/BookIcon.png differ diff --git a/res/pics/GoldIcon.png b/res/pics/GoldIcon.png new file mode 100644 index 00000000000..14464757ced Binary files /dev/null and b/res/pics/GoldIcon.png differ diff --git a/src/forge/Gui_CardShop.java b/src/forge/Gui_CardShop.java index 5d787f4873f..3794701b3bc 100644 --- a/src/forge/Gui_CardShop.java +++ b/src/forge/Gui_CardShop.java @@ -243,9 +243,20 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay, for(int i = 0; i < shopList.size(); i++) { Card c = AllZone.CardFactory.getCard(shopList.get(i).toString(), ""); - - c.setValue(map.get(c.getName())); c.setRarity(pack.getRarity(c.getName())); + if (map.containsKey(c.getName())) + c.setValue(map.get(c.getName())); + else //card is not on pricelist + { + System.out.println("Card " + c.getName() + " is not in the price list."); + if (c.getRarity().equals("Common")) + c.setValue(10); + else if (c.getRarity().equals("Uncommon")) + c.setValue(50); + else if (c.getRarity().equals("Rare")) + c.setValue(200); + } + shop.add(c); } } diff --git a/src/forge/Gui_WinLose.java b/src/forge/Gui_WinLose.java index 14f7144a1cf..03a04b68187 100644 --- a/src/forge/Gui_WinLose.java +++ b/src/forge/Gui_WinLose.java @@ -7,8 +7,10 @@ import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; +import java.io.File; import javax.swing.BorderFactory; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @@ -19,9 +21,11 @@ import javax.swing.border.Border; import javax.swing.border.TitledBorder; import forge.error.ErrorViewer; +import forge.properties.ForgeProps; +import forge.properties.NewConstants; -public class Gui_WinLose extends JFrame { +public class Gui_WinLose extends JFrame implements NewConstants { private static final long serialVersionUID = -5800412940994975483L; private JLabel titleLabel = new JLabel(); @@ -174,6 +178,23 @@ public class Gui_WinLose extends JFrame { dispose(); } + private String getWinText(long creds, WinLose winLose) + { + StringBuilder sb = new StringBuilder(); + if (winLose.getLose()==0) + sb.append("You have not lost once! Bonus: 10 credits.\r\n"); + sb.append("You have earned " + creds + " credits in total."); + return sb.toString(); + } + + private ImageIcon getIcon(String fileName) + { + File base = ForgeProps.getFile(IMAGE_BASE); + File file = new File(base, fileName); + ImageIcon icon = new ImageIcon(file.toString()); + return icon; + } + void quitButton_actionPerformed(ActionEvent e) { //are we on a quest? if(AllZone.QuestData == null) new Gui_NewGame(); @@ -189,19 +210,21 @@ public class Gui_WinLose extends JFrame { if(quest.shouldAddCards(winLose.didWinRecently())) { quest.addCards(); - JOptionPane.showMessageDialog(null, "You have won new cards."); + String fileName = "BookIcon.png"; + ImageIcon icon = getIcon(fileName); + JOptionPane.showMessageDialog(null, "You have won new cards.", "", JOptionPane.INFORMATION_MESSAGE, icon ); } - if(quest.shouldAddAdditionalCards(winLose.didWinRecently())) { - quest.addAdditionalCards(); - JOptionPane.showMessageDialog(null, "You have won a random rare."); - } if (winLose.didWinRecently()) { - long creds = quest.getCreditsToAdd(); - JOptionPane.showMessageDialog(null, "You have earned " + creds + " credits."); + long creds = quest.getCreditsToAdd(winLose); + String s = getWinText(creds, winLose); + + String fileName = "GoldIcon.png"; + ImageIcon icon = getIcon(fileName); + JOptionPane.showMessageDialog(null, s, "", JOptionPane.INFORMATION_MESSAGE, icon); } else { @@ -209,6 +232,13 @@ public class Gui_WinLose extends JFrame { JOptionPane.showMessageDialog(null, "You FAIL! You have lost 15 credits."); } + if(quest.shouldAddAdditionalCards(winLose.didWinRecently())) { + String fileName = quest.addRandomRare() + ".jpg"; + ImageIcon icon = getIcon(fileName); + + JOptionPane.showMessageDialog(null, "You have won a random rare.", "", JOptionPane.INFORMATION_MESSAGE, icon); + } + winLose.reset(); QuestData.saveData(quest); diff --git a/src/forge/QuestData.java b/src/forge/QuestData.java index e9533ea3467..344c817a21f 100644 --- a/src/forge/QuestData.java +++ b/src/forge/QuestData.java @@ -362,16 +362,15 @@ public class QuestData implements NewConstants { }//addCards() - public void addAdditionalCards() { - int nRare = 1; - + public String addRandomRare() { + ArrayList newCards = new ArrayList(); - newCards.addAll(boosterPack.getRare(nRare)); + newCards.addAll(boosterPack.getRare(1)); cardPool.addAll(newCards); - //getAddedCards() uses newCardList - newCardList.addAll(newCards); + + return GuiDisplayUtil.cleanString(newCards.get(0)); } public void addCard(Card c) @@ -417,9 +416,11 @@ public class QuestData implements NewConstants { } } - public long getCreditsToAdd() + public long getCreditsToAdd(WinLose winLose) { long creds = (long) (10 + (0.2 * win)); + if (winLose.getLose() == 0) + creds += 10; this.addCredits(creds); return creds;