mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Fixed a bug in the cardshop.
- In the BO3 quest format, winning in just 2 games will yield a bonus of 10 credits. - Added some icons to the reward message pop-ups (after a quest match has been won). - After a quest win, the random rare is displayed if one is won.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -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
|
||||
|
||||
BIN
res/pics/BookIcon.png
Normal file
BIN
res/pics/BookIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
res/pics/GoldIcon.png
Normal file
BIN
res/pics/GoldIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -362,16 +362,15 @@ public class QuestData implements NewConstants {
|
||||
|
||||
}//addCards()
|
||||
|
||||
public void addAdditionalCards() {
|
||||
int nRare = 1;
|
||||
|
||||
public String addRandomRare() {
|
||||
|
||||
ArrayList<String> newCards = new ArrayList<String>();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user