diff --git a/args/chests.py b/args/chests.py index dfefa4e7..960236ef 100644 --- a/args/chests.py +++ b/args/chests.py @@ -18,6 +18,12 @@ def parse(parser): chests.add_argument("-cms", "--chest-monsters-shuffle", action = "store_true", help = "Monsters-in-a-box shuffled but locations unchanged") + chests.add_argument("-ntc", "--no-trash-chests", action = "store_true", + help="Replace Low Tier Items with gold in chests") + + + + def process(args): if args.chest_contents_shuffle_random is not None: args.chest_contents_shuffle_random_percent = args.chest_contents_shuffle_random @@ -37,6 +43,8 @@ def flags(args): if args.chest_monsters_shuffle: flags += " -cms" + if args.no_trash_chests: + flags += " -ntc" return flags @@ -58,6 +66,10 @@ def options(args): result.append(("Random Percent", f"{args.chest_contents_shuffle_random_percent}%")) result.append(("Monsters-In-A-Box Shuffled", args.chest_monsters_shuffle)) + if args.no_trash_chests: + result.append(("No Trash Chests", args.no_trash_chests)) + + return result def menu(args): diff --git a/args/items.py b/args/items.py index b97737ce..eed7a77f 100644 --- a/args/items.py +++ b/args/items.py @@ -49,6 +49,8 @@ def parse(parser): items.add_argument("-saw", "--stronger-atma-weapon", action = "store_true", help = "Atma Weapon moved to higher tier and divisor reduced from 64 to 32") + + def process(args): args._process_min_max("item_equipable_random") if args.item_equipable_balanced_random is not None: @@ -108,6 +110,7 @@ def flags(args): if args.stronger_atma_weapon: flags += " -saw" + return flags def options(args): diff --git a/args/shops.py b/args/shops.py index 1ab2dab7..771e0b2a 100644 --- a/args/shops.py +++ b/args/shops.py @@ -53,6 +53,9 @@ def parse(parser): shops.add_argument("-snil", "--shops-no-illuminas", action = "store_true", help = "Illuminas not sold in shops") + shops.add_argument("-nts", "--no-trash-shops", action = "store_true", + help="Omit Low tier items in shops") + def process(args): if args.shop_inventory_shuffle_random is not None: args.shop_inventory_shuffle_random_percent = args.shop_inventory_shuffle_random @@ -106,6 +109,9 @@ def flags(args): if args.shops_no_illuminas: flags += " -snil" + if args.no_trash_shops: + flags += " -nts" + return flags def options(args): @@ -159,6 +165,7 @@ def options(args): ("Expensive Balls", args.shops_expensive_super_balls), ("No Exp. Eggs", args.shops_no_exp_eggs), ("No Illuminas", args.shops_no_illuminas), + ("No Trash Shops", args.no_trash_shops) ]) return result diff --git a/constants/items.py b/constants/items.py index 4617dedb..ef51fe93 100644 --- a/constants/items.py +++ b/constants/items.py @@ -295,3 +295,25 @@ "Marvel Shoes", "Exp. Egg", ] + +## TRASH LIST https://docs.google.com/spreadsheets/d/1Cit5Xl_TCBPFI4q1NEVQhSYGH1wKY9st_1yee3lzCP8/edit#gid=0 + +TRASH_WEAPONS = [ + "Dirk", "MithrilKnife", "Guardian", "MithrilBlade", "RegalCutlass", "Crystal", "Mithril Pike", + "Stout Spear", "Imperial", "Kodachi", "Hardened", "Ashura", "Kotetsu", "Forged", + "Aura", "Strato", "Punisher", "MetalKnuckle", "Mithril Claw", "Kaiser", + "Flail", "Morning Star", "Full Moon", "Boomerang", "Rising Sun", "Cards", "Darts", "Chocobo Brsh", + ] + +TRASH_ARMOR = ["Buckler", "Mithril Shld", "Heavy Shld", "Gold Shld", "Leather Hat", "Plumed Hat", "Bandana", + "Iron Helmet", "Mithril Helm", "Gold Helmet", "LeatherArmor", "Kung Fu Suit", "Mithril Vest", + "Diamond Vest", "Cotton Robe", "Silk Robe", "Iron Armor", + "DiamondArmor", "Crystal Mail", "Gold Armor", + "Mithril Mail" +] +TRASH_RElICS = ["Charm Bangle", "Coin Toss", "FakeMustache"] + + +TRASH_ITEMS = TRASH_WEAPONS + TRASH_ARMOR + TRASH_RElICS + +TRASH_IDS = [name_id.get(value) for value in TRASH_ITEMS] diff --git a/data/chests.py b/data/chests.py index d80f8234..0b644bca 100644 --- a/data/chests.py +++ b/data/chests.py @@ -1,5 +1,6 @@ from data.chest import Chest import data.chests_asm as chests_asm +from data.item import Item from data.structures import DataArrays import random @@ -105,6 +106,27 @@ def shuffle_random(self): elif chest.type == Chest.ITEM: chest.contents = self.items.get_random() + if self.args.no_trash_chests: + if self.args.shop_sell_fraction4: + sell_factor = 1/4 + elif self.args.shop_sell_fraction8: + sell_factor = 1 / 8 + elif self.args.shop_sell_fraction0: + sell_factor = 0 + else: + sell_factor = 1/2 + for chest in possible_chests: + if not chest.type == Chest.ITEM: + continue + item = Item(chest.contents, self.rom) + if item.is_trash: + item_chest_value = int(min((item.price * sell_factor)//100, Chest.MAX_GOLD_VALUE)) + if not item.sell_gold_value: + chest.type = Chest.EMPTY + chest.type = Chest.GOLD + chest.contents = item_chest_value + + def random_tiered(self): def get_item(tiers, tier_s_distribution): from data.chest_item_tiers import weights diff --git a/data/item.py b/data/item.py index 578f4048..a1ed563f 100644 --- a/data/item.py +++ b/data/item.py @@ -1,4 +1,5 @@ import data.text as text +from constants.items import TRASH_IDS from data.text.text2 import text_value, value_text class Item(): @@ -20,6 +21,10 @@ def __init__(self, id, rom): self.read() + @property + def is_trash(self): + return self.id in TRASH_IDS + def is_equipable(self): return self.equipable_characters @@ -42,6 +47,11 @@ def remove_learnable_spell(self): self.learnable_spell = 0 self.learnable_spell_rate = 0 + @property + def sell_gold_value(self): + ## half price for sell and //100 + return self.price//200 + def scale_price(self, factor): self.price = int(self.price * factor) self.price = max(min(self.price, 2**16 - 1), 0) diff --git a/data/shops.py b/data/shops.py index a78d4c0b..264efb75 100644 --- a/data/shops.py +++ b/data/shops.py @@ -1,3 +1,5 @@ +from constants.items import TRASH_IDS +from data.item import Item from data.shop import Shop from data.structures import DataArray @@ -226,6 +228,8 @@ def remove_excluded_items(self): exclude.append(self.items.get_id("Exp. Egg")) if self.args.shops_no_illuminas: exclude.append(self.items.get_id("Illumina")) + if self.args.no_trash_shops: + exclude.extend(TRASH_IDS) for shop in self.shops: for item in exclude: