- Quest Assignments are available less frequently now.

- Added a new shop with two new items to the bazaar (these items make quest assignments avaible more frequently).
This commit is contained in:
jendave
2011-08-06 05:02:44 +00:00
parent 58961306bb
commit c5716c5e3b
14 changed files with 293 additions and 18 deletions

4
.gitattributes vendored
View File

@@ -46,12 +46,15 @@ res/pics/icons/CoinIcon.png -text svneol=unset#image/png
res/pics/icons/CoinIconSmall.jpg -text svneol=unset#image/jpeg
res/pics/icons/ElixirIcon.png -text svneol=unset#image/png
res/pics/icons/FoxIconSmall.png -text svneol=unset#image/png
res/pics/icons/GearIconSmall.png -text svneol=unset#image/png
res/pics/icons/GoldIcon.png -text svneol=unset#image/png
res/pics/icons/GoldIconLarge.png -text svneol=unset#image/png
res/pics/icons/GoldIconSmall.png -text svneol=unset#image/png
res/pics/icons/HeartIcon.png -text svneol=unset#image/png
res/pics/icons/LeafIconSmall.png -text svneol=unset#image/png
res/pics/icons/MapIcon.png -text svneol=unset#image/png
res/pics/icons/MapIconLarge.png -text svneol=unset#image/png
res/pics/icons/ZeppelinIcon.png -text svneol=unset#image/png
res/pics/icons/bookIconSmall.png -text svneol=unset#image/png
res/pics/icons/notesIcon.png -text svneol=unset#image/png
res/pics_link/card-pictures_a.txt -text svneol=native#text/plain
@@ -353,6 +356,7 @@ src/forge/Gui_DeckEditor_Menu.java svneol=native#text/plain
src/forge/Gui_DownloadPictures.java svneol=native#text/plain
src/forge/Gui_DownloadPictures_LQ.java -text svneol=native#text/plain
src/forge/Gui_ElixirShop.java -text svneol=native#text/plain
src/forge/Gui_Gear.java -text svneol=native#text/plain
src/forge/Gui_Library.java -text svneol=native#text/plain
src/forge/Gui_MultipleBlockers.java svneol=native#text/plain
src/forge/Gui_NewGame.java svneol=native#text/plain

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -23,7 +23,7 @@ public class QuestData_State implements Serializable {
private static final long serialVersionUID = 7007940230351051937L;
int rankIndex, win, lost;
int plantLevel, wolfPetLevel, crocPetLevel, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, questsPlayed;
int plantLevel, wolfPetLevel, crocPetLevel, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, gearLevel, questsPlayed;
long credits;
String difficulty, mode, selectedPet;
@@ -43,6 +43,6 @@ public class QuestData_State implements Serializable {
for(Entry<String, Deck> deck:this.aiDecks.entrySet()) {
aiDecks.put(deck.getKey(), deck.getValue().migrate());
}
return new forge.QuestData_State(rankIndex, win, lost, plantLevel, wolfPetLevel, crocPetLevel, selectedPet, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, questsPlayed, availableQuests, completedQuests,credits, difficulty, mode, cardPool, shopList, myDecks, aiDecks);
return new forge.QuestData_State(rankIndex, win, lost, plantLevel, wolfPetLevel, crocPetLevel, selectedPet, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, gearLevel, questsPlayed, availableQuests, completedQuests,credits, difficulty, mode, cardPool, shopList, myDecks, aiDecks);
}
}

View File

@@ -774,7 +774,7 @@ public class GameAction {
public void destroy(Card c) {
if(!AllZone.GameAction.isCardInPlay(c)
|| (c.getKeyword().contains("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) return;
|| (c.getKeyword().contains("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) return;
if(c.getShield() > 0) {
c.subtractShield();

View File

@@ -4,7 +4,6 @@ package forge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import javax.swing.JOptionPane;

222
src/forge/Gui_Gear.java Normal file
View File

@@ -0,0 +1,222 @@
package forge;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import forge.error.ErrorViewer;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
public class Gui_Gear extends JFrame implements NewConstants{
private static final long serialVersionUID = -2124386606846472829L;
private JFrame shopsGUI;
private JLabel titleLabel = new JLabel();
private JLabel gearDescLabel = new JLabel();
private JLabel gearPriceLabel = new JLabel();
private JLabel gearIconLabel = new JLabel();
private JLabel creditsLabel = new JLabel();
private ImageIcon gearIcon = new ImageIcon();
private JButton gearButton = new JButton();
private JButton quitButton = new JButton();
private QuestData questData = AllZone.QuestData;
public Gui_Gear(JFrame parent) {
try {
jbInit();
} catch(Exception ex) {
ErrorViewer.showError(ex);
}
shopsGUI = parent;
setup();
//for some reason, the Bazaar window does not return when closing with X
//for now, just disable X closing:
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
Dimension screen = this.getToolkit().getScreenSize();
setBounds(screen.width / 3, 100, //position
530, 430); //size
setVisible(true);
}
//only do this ONCE:
private void setup() {
gearButton.setBounds(new Rectangle(10, 297, 120, 50));
gearButton.setText(getButtonText());
//buyPlantButton.setIcon(icon);
gearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
learnEstatesButton_actionPerformed(e);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
}//setup();
private String getDesc()
{
StringBuilder sb = new StringBuilder();
sb.append("<html>");
if (questData.getGearLevel() == 0)
{
sb.append("<u><b>Adventurer's Map</b></u><br>");
sb.append("These ancient charts should facilitate navigation during your travels significantly.<br>");
sb.append("<u>Quest assignments become available more frequently</u>.");
}
else if (questData.getGearLevel() == 1)
{
sb.append("<u><b>Adventurer's Zeppelin</b></u><br>");
sb.append("This extremely comfortable airship allows for more efficient and safe travel to faraway destinations. <br>");
sb.append("<u>Quest assignments become available more frequently, adds +3 to max life</u>.");
}
else
{
sb.append("Currently nothing for sale. <br>Please check back later.");
}
sb.append("</html>");
return sb.toString();
}
private long getPrice()
{
long l = 0;
if (questData.getGearLevel() == 0)
l = 2000;
else if (questData.getGearLevel() == 1)
l = 5000;
return l;
}
private String getButtonText()
{
return "Buy";
}
private String getImageString()
{
if (questData.getGearLevel() == 0)
return "MapIconLarge.png";
else if (questData.getGearLevel() == 1)
return "ZeppelinIcon.png";
return "";
}
private void jbInit() throws Exception {
titleLabel.setFont(new java.awt.Font("sserif", Font.BOLD, 22));
titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
titleLabel.setText("Adventurer's Gear");
titleLabel.setBounds(new Rectangle(155, 5, 198, 60));
this.getContentPane().setLayout(null);
/*
potionStatsLabel.setFont(new Font("sserif", Font.BOLD, 12));
potionStatsLabel.setText(getStats());
potionStatsLabel.setBounds(new Rectangle(10, 65, 100, 15));
*/
gearDescLabel.setFont(new Font("sserif", 0, 12));
gearDescLabel.setText(getDesc());
gearDescLabel.setBounds(new Rectangle(10, 80, 300, 150));
gearPriceLabel.setFont(new Font("sserif", 0, 12));
gearPriceLabel.setText("<html><b><u>Price</u></b>: " + getPrice() + " credits</html>");
gearPriceLabel.setBounds(new Rectangle(10, 230, 150, 15));
creditsLabel.setFont(new Font("sserif", 0, 12));
creditsLabel.setText("Credits: " + questData.getCredits());
creditsLabel.setBounds(new Rectangle(10, 265, 150, 15));
gearIcon = getIcon(getImageString());
gearIconLabel.setText("");
gearIconLabel.setIcon(gearIcon);
gearIconLabel.setBounds(new Rectangle(325, 100, 128, 128));
gearIconLabel.setIconTextGap(0);
//String fileName = "LeafIconSmall.png";
//ImageIcon icon = getIcon(fileName);
gearButton.setEnabled(true);
if (questData.getCredits() < getPrice() || questData.getGearLevel() >= 2)
gearButton.setEnabled(false);
quitButton.setBounds(new Rectangle(140, 297, 120, 50));
quitButton.setText("Quit");
quitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
quitButton_actionPerformed(e);
}
});
//jPanel2.add(quitButton, null);
this.getContentPane().add(gearButton, null);
this.getContentPane().add(titleLabel, null);
this.getContentPane().add(gearDescLabel, null);
this.getContentPane().add(gearIconLabel, null);
this.getContentPane().add(gearPriceLabel, null);
this.getContentPane().add(creditsLabel, null);
this.getContentPane().add(quitButton,null);
}
void learnEstatesButton_actionPerformed(ActionEvent e) throws Exception {
questData.subtractCredits(getPrice());
if (questData.getGearLevel() < 2)
{
questData.addGearLevel(1);
}
QuestData.saveData(questData);
jbInit();
}
private ImageIcon getIcon(String fileName)
{
File base = ForgeProps.getFile(IMAGE_ICON);
File file = new File(base, fileName);
ImageIcon icon = new ImageIcon(file.toString());
return icon;
}
void quitButton_actionPerformed(ActionEvent e) {
QuestData.saveData(questData);
//new Gui_Shops();
shopsGUI.setVisible(true);
dispose();
}
void this_windowClosing(WindowEvent e) {
quitButton_actionPerformed(null);
}
}

View File

@@ -287,8 +287,14 @@ public class Gui_Quest extends JFrame implements NewConstants{
this.getContentPane().add(petComboBox, null);
int questsPlayed = questData.getQuestsPlayed();
int div = 6;
if (questData.getGearLevel() == 1)
div = 5;
else if (questData.getGearLevel() == 2)
div = 4;
//System.out.println("questsPlayed: " + questsPlayed);
if (questData.getWin() / 5 < questsPlayed || questData.getWin() < 25)
if (questData.getWin() / div < questsPlayed || questData.getWin() < 25)
questsButton.setEnabled(false);
else
questsButton.setEnabled(true);
@@ -326,8 +332,6 @@ public class Gui_Quest extends JFrame implements NewConstants{
void infoButton_actionPerformed(ActionEvent e)
{
StringBuilder sb = new StringBuilder();
sb.append("Abraham Lincoln 3 hard Some flying creatures with Flamebreak and life gaining");
sb.append("\r\n");

View File

@@ -265,7 +265,10 @@ public class Gui_Quest_Assignments extends JFrame implements NewConstants{
Constant.Quest.oppIconName[0] = selectedQuest.getIconName();
AllZone.GameAction.newGame(hDeck, computerDeck, QuestUtil.getHumanPlantAndPet(questData, selectedQuest), new CardList(), questData.getLife(),
int extraLife = 0;
if (questData.getGearLevel() == 2)
extraLife = 3;
AllZone.GameAction.newGame(hDeck, computerDeck, QuestUtil.getHumanPlantAndPet(questData, selectedQuest), new CardList(), questData.getLife()+extraLife,
selectedQuest.getComputerLife(), selectedQuest);
AllZone.Display = new GuiDisplay3();

View File

@@ -36,6 +36,7 @@ public class Gui_Shops extends JFrame implements NewConstants {
private JButton healthShopButton = new JButton();
private JButton bankButton = new JButton();
private JButton libraryButton = new JButton();
private JButton gearButton = new JButton();
private JButton quitButton = new JButton();
private JPanel jPanel2 = new JPanel();
@@ -64,7 +65,7 @@ public class Gui_Shops extends JFrame implements NewConstants {
Dimension screen = this.getToolkit().getScreenSize();
setBounds(screen.width / 3, 100, //position
286, 700); //size
286, 785); //size
setVisible(true);
}
@@ -136,7 +137,18 @@ public class Gui_Shops extends JFrame implements NewConstants {
}
});
quitButton.setBounds(new Rectangle(45, 530, 180, 77));
fileName = "GearIconSmall.png";
icon = getIcon(fileName);
gearButton.setBounds(new Rectangle(25, 445, 180, 77));
gearButton.setText("Gear");
gearButton.setIcon(icon);
gearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
gearButton_actionPerformed(e);
}
});
quitButton.setBounds(new Rectangle(45, 615, 180, 77));
quitButton.setText("Quit");
quitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -145,7 +157,7 @@ public class Gui_Shops extends JFrame implements NewConstants {
});
jPanel2.setBorder(BorderFactory.createLineBorder(Color.black));
jPanel2.setBounds(new Rectangle(20, 50, 234, 452));
jPanel2.setBounds(new Rectangle(20, 50, 234, 538));
jPanel2.setLayout(null);
this.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
@@ -159,6 +171,7 @@ public class Gui_Shops extends JFrame implements NewConstants {
jPanel2.add(bankButton, null);
jPanel2.add(healthShopButton, null);
jPanel2.add(libraryButton, null);
jPanel2.add(gearButton, null);
//jPanel2.add(quitButton, null);
jPanel2.add(petShopButton, null);
this.getContentPane().add(titleLabel, null);
@@ -225,6 +238,13 @@ public class Gui_Shops extends JFrame implements NewConstants {
dispose();
}
void gearButton_actionPerformed(ActionEvent e){
Gui_Gear g = new Gui_Gear(this);
g.setVisible(true);
dispose();
}
private ImageIcon getIcon(String fileName)
{
File base = ForgeProps.getFile(IMAGE_ICON);

View File

@@ -237,14 +237,18 @@ public class Gui_WinLose extends JFrame implements NewConstants {
if (!Constant.Quest.fantasyQuest[0])
AllZone.GameAction.newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
else{
if (AllZone.QuestAssignment != null)
int extraLife = 0;
if (AllZone.QuestAssignment != null) {
QuestUtil.setupQuest(AllZone.QuestAssignment);
if (AllZone.QuestData.getGearLevel() == 2)
extraLife = 3;
}
//AllZone.GameAction.newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0], humanList, computerList, humanLife, computerLife);
CardList humanList = QuestUtil.getHumanPlantAndPet(AllZone.QuestData, AllZone.QuestAssignment);
CardList computerList = new CardList();
int humanLife = QuestUtil.getLife(AllZone.QuestData);
int humanLife = QuestUtil.getLife(AllZone.QuestData) + extraLife;
int computerLife = 20;
if (AllZone.QuestAssignment!=null)
computerLife = AllZone.QuestAssignment.getComputerLife();
@@ -262,15 +266,19 @@ public class Gui_WinLose extends JFrame implements NewConstants {
if (!Constant.Quest.fantasyQuest[0])
AllZone.GameAction.newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]);
else{
int extraLife = 0;
//AllZone.GameAction.newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0], humanList, computerList, humanLife, computerLife);
if (AllZone.QuestAssignment != null)
if (AllZone.QuestAssignment != null) {
QuestUtil.setupQuest(AllZone.QuestAssignment);
if (AllZone.QuestData.getGearLevel() == 2)
extraLife = 3;
}
CardList humanList = QuestUtil.getHumanPlantAndPet(AllZone.QuestData, AllZone.QuestAssignment);
//CardList computerList = QuestUtil.getComputerCreatures(AllZone.QuestData, AllZone.QuestAssignment);
CardList computerList = new CardList();
int humanLife = QuestUtil.getLife(AllZone.QuestData);
int humanLife = QuestUtil.getLife(AllZone.QuestData) +extraLife;
int computerLife = 20;
if (AllZone.QuestAssignment!=null)

View File

@@ -60,6 +60,7 @@ public class QuestData implements NewConstants {
private int estatesLevel;
private int luckyCoinLevel;
private int sleightOfHandLevel;
private int gearLevel;
private int questsPlayed;
@@ -263,6 +264,7 @@ public class QuestData implements NewConstants {
data.estatesLevel = state.estatesLevel;
data.luckyCoinLevel = state.luckyCoinLevel;
data.sleightOfHandLevel = state.sleightOfHandLevel;
data.gearLevel = state.gearLevel;
data.questsPlayed = state.questsPlayed;
data.availableQuests = state.availableQuests;
data.completedQuests = state.completedQuests;
@@ -719,6 +721,16 @@ public class QuestData implements NewConstants {
sleightOfHandLevel+=n;
}
public int getGearLevel()
{
return gearLevel;
}
public void addGearLevel(int n)
{
gearLevel+=n;
}
public int getQuestsPlayed()
{
return questsPlayed;
@@ -849,6 +861,7 @@ public class QuestData implements NewConstants {
state.estatesLevel = q.estatesLevel;
state.luckyCoinLevel = q.luckyCoinLevel;
state.sleightOfHandLevel = q.sleightOfHandLevel;
state.gearLevel = q.gearLevel;
state.questsPlayed = q.questsPlayed;
state.availableQuests = q.availableQuests;

View File

@@ -24,7 +24,7 @@ public class QuestData_State implements Serializable {
private static final long serialVersionUID = 7007940230351051937L;
int rankIndex, win, lost;
int plantLevel, wolfPetLevel, crocPetLevel, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, questsPlayed;
int plantLevel, wolfPetLevel, crocPetLevel, life, estatesLevel, luckyCoinLevel, sleightOfHandLevel, gearLevel, questsPlayed;
long credits;
String difficulty, mode, selectedPet;
@@ -38,7 +38,7 @@ public class QuestData_State implements Serializable {
* This constructor is used by QestData_State in the default package to create a replacement object for the
* obsolete class.
*/
public QuestData_State(int rankIndex, int win, int lost, int plantLevel, int wolfPetLevel, int crocPetLevel, String selectedPet, int life, int estatesLevel, int luckyCoinLevel, int sleightOfHandLevel, int questsPlayed,
public QuestData_State(int rankIndex, int win, int lost, int plantLevel, int wolfPetLevel, int crocPetLevel, String selectedPet, int life, int estatesLevel, int luckyCoinLevel, int sleightOfHandLevel, int gearLevel, int questsPlayed,
ArrayList<Integer> availableQuests, ArrayList<Integer> completedQuests, long credits, String difficulty, String mode,
ArrayList<String> cardPool, ArrayList<String> shopList, Map<String, Deck> myDecks, Map<String, Deck> aiDecks) {
this.rankIndex = rankIndex;
@@ -50,6 +50,8 @@ public class QuestData_State implements Serializable {
this.life = life;
this.estatesLevel = estatesLevel;
this.luckyCoinLevel = luckyCoinLevel;
this.sleightOfHandLevel = sleightOfHandLevel;
this.gearLevel = gearLevel;
this.questsPlayed = questsPlayed;
this.availableQuests = availableQuests;
this.completedQuests = completedQuests;