From 7963decb11e10b4491b820c942498ca00942e7ef Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Sat, 11 Apr 2015 14:25:41 -0400 Subject: [PATCH] Editing Game Values, made new Items, changed price increase algorithm, Extended the combobox in TransactionUI --- MerchantRPGCSE2102/src/config/inventory.txt | 35 ++++++++++++++----- MerchantRPGCSE2102/src/controller/RPGame.java | 29 ++++++++++----- .../src/view/TransactionUI.java | 4 +-- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/MerchantRPGCSE2102/src/config/inventory.txt b/MerchantRPGCSE2102/src/config/inventory.txt index fcf6cb0..55691b5 100644 --- a/MerchantRPGCSE2102/src/config/inventory.txt +++ b/MerchantRPGCSE2102/src/config/inventory.txt @@ -1,11 +1,30 @@ merchant 1 -water 3 -armor 5 -food 10 +Water 2 +Candy 5 +Apple 7 +Bread 3 +Cake 14 +Jerky 9 merchant 2 -wood 3 -tarp 6 +PigIron 19 +HighQualityIron 25 +Steel 29 +WoodPlanks 10 +HighQualityWood 18 +FairyTreeWood 40 +WornSword 23 +IronSword 29 +SteelSword 38 +FairySteelSword 95 +BlessedIronDaggerofPig 50000 merchant 3 -glass 3 -tape 13 -rope 5 \ No newline at end of file +LooseGems 60 +FineCutDiamond 70 +SilverBracelets 85 +SilverNecklace 93 +SilverEmeraldRing 100 +GoldBracelets 84 +GoldNecklace 103 +GoldSapphireRing 133 +GoldDiamondCrown 210 +ExpensiveJewlery? 500 \ No newline at end of file diff --git a/MerchantRPGCSE2102/src/controller/RPGame.java b/MerchantRPGCSE2102/src/controller/RPGame.java index 9711281..c79d02c 100644 --- a/MerchantRPGCSE2102/src/controller/RPGame.java +++ b/MerchantRPGCSE2102/src/controller/RPGame.java @@ -74,9 +74,9 @@ else if (currentMerchant == 3) */ public void buildMerchants() { - _merchant1 = new Merchant("Merchant 1", 1000, merchantInventoryList1); - _merchant2 = new Merchant("Merchant 2", 1000, merchantInventoryList2); - _merchant3 = new Merchant("Merchant 3", 1000, merchantInventoryList3); + _merchant1 = new Merchant("Cheap Merchant", 200, merchantInventoryList1); + _merchant2 = new Merchant("Medium Merchant", 600, merchantInventoryList2); + _merchant3 = new Merchant("Expensive Merchant", 1000, merchantInventoryList3); } /** @@ -163,11 +163,13 @@ public void advanceDailyCycle(){ scaleAllMerchantPrices(allMerchants); //will scale all the prices of the items that the merchants hold based on their dailyRandomPercent - if( (_currentDay % 3) == 0) //will increase the merchant's base cash every 3 days + if( (_currentDay % 6) == 0) //will increase the merchant's base cash every 6 days { - addAndRefreshCash(_merchant1, 100); - addAndRefreshCash(_merchant2, 100); - addAndRefreshCash(_merchant3, 100); + int multiplier = (int) Math.floor(_currentDay / 10) + 1; + + addAndRefreshCash(_merchant1, multiplier * 100); + addAndRefreshCash(_merchant2, multiplier * 100); + addAndRefreshCash(_merchant3, multiplier * 100); } else //if not on a third day, will just refresh the merchant's cash amount { @@ -251,6 +253,15 @@ public int getDay() { return _currentDay; } + + /** + * + * @return Movement variable + */ + public boolean getMovement() + { + return _movement; + } /** * Main method used to test the GUI components since test classes do not maintain the GUI @@ -265,7 +276,7 @@ public static void main(String[] args) throws InterruptedException playerInventory.addAll(_rpg.getMerchantInventoryList(2)); playerInventory.addAll(_rpg.getMerchantInventoryList(3)); _rpg.buildPlayer("test", 500, playerInventory); - _rpg.getPlayer().getItem("armor").increaseQuantity(15); - _rpg.createTransaction(_rpg.getPlayer(), _rpg.getMerchant(1)); + _rpg.getPlayer().getItem("WoodPlanks").increaseQuantity(15); + _rpg.createTransaction(_rpg.getPlayer(), _rpg.getMerchant(3)); } } diff --git a/MerchantRPGCSE2102/src/view/TransactionUI.java b/MerchantRPGCSE2102/src/view/TransactionUI.java index 033be48..ba98daa 100644 --- a/MerchantRPGCSE2102/src/view/TransactionUI.java +++ b/MerchantRPGCSE2102/src/view/TransactionUI.java @@ -121,7 +121,7 @@ public void createBuyWindow() @SuppressWarnings({ "rawtypes", "unchecked" }) final JComboBox comboBox = new JComboBox(itemList); //create a drop-down menu for the player to choose from - comboBox.setBounds(61, 141, 131, 20); + comboBox.setBounds(61, 141, 250, 20); contentPane.add(comboBox); final JTextField textField = new JTextField(); //create a text field for the player to enter the amount desired into @@ -208,7 +208,7 @@ public void createSellWindow() contentPane.add(lblYouHave); final JComboBox comboBox = new JComboBox(itemList); //create a drop-down menu for the player to choose from - comboBox.setBounds(61, 141, 131, 20); + comboBox.setBounds(61, 141, 250, 20); contentPane.add(comboBox); final JTextField textField = new JTextField(); //create a text field for the player to enter the amount desired into