From c7e735da15278e75beaa411a65844aae200f3e2e Mon Sep 17 00:00:00 2001 From: axe-y <58866768+axe-y@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:12:55 -0400 Subject: [PATCH] DLCQuest: progression coin bundle update (#2785) --- worlds/dlcquest/Items.py | 96 +++++--- worlds/dlcquest/Locations.py | 11 + worlds/dlcquest/Options.py | 16 ++ worlds/dlcquest/Regions.py | 13 + worlds/dlcquest/Rules.py | 302 +++++++++++++++--------- worlds/dlcquest/__init__.py | 10 +- worlds/dlcquest/data/items.csv | 16 +- worlds/dlcquest/test/TestItemShuffle.py | 22 +- 8 files changed, 330 insertions(+), 156 deletions(-) diff --git a/worlds/dlcquest/Items.py b/worlds/dlcquest/Items.py index e7008f7b..65b36fe6 100644 --- a/worlds/dlcquest/Items.py +++ b/worlds/dlcquest/Items.py @@ -25,6 +25,10 @@ class Group(enum.Enum): Item = enum.auto() Coin = enum.auto() Trap = enum.auto() + Twice = enum.auto() + Piece = enum.auto() + Deprecated = enum.auto() + @dataclass(frozen=True) @@ -85,49 +89,75 @@ initialize_item_table() initialize_groups() -def create_trap_items(world, World_Options: Options.DLCQuestOptions, trap_needed: int, random: Random) -> List[Item]: +def create_trap_items(world, world_options: Options.DLCQuestOptions, trap_needed: int, random: Random) -> List[Item]: traps = [] for i in range(trap_needed): trap = random.choice(items_by_group[Group.Trap]) - traps.append(world.create_item(trap)) + traps.append(world.create_item(trap, ItemClassification.trap)) return traps -def create_items(world, World_Options: Options.DLCQuestOptions, locations_count: int, random: Random): +def create_items(world, world_options: Options.DLCQuestOptions, locations_count: int, random: Random): created_items = [] - if World_Options.campaign == Options.Campaign.option_basic or World_Options.campaign == Options.Campaign.option_both: - for item in items_by_group[Group.DLCQuest]: - if item.has_any_group(Group.DLC): - created_items.append(world.create_item(item)) - if item.has_any_group(Group.Item) and World_Options.item_shuffle == Options.ItemShuffle.option_shuffled: - created_items.append(world.create_item(item)) - if World_Options.coinsanity == Options.CoinSanity.option_coin: - coin_bundle_needed = math.floor(825 / World_Options.coinbundlequantity) - for item in items_by_group[Group.DLCQuest]: - if item.has_any_group(Group.Coin): - for i in range(coin_bundle_needed): - created_items.append(world.create_item(item)) - if 825 % World_Options.coinbundlequantity != 0: - created_items.append(world.create_item(item)) + if world_options.campaign == Options.Campaign.option_basic or world_options.campaign == Options.Campaign.option_both: + create_items_basic(world_options, created_items, world) - if (World_Options.campaign == Options.Campaign.option_live_freemium_or_die or - World_Options.campaign == Options.Campaign.option_both): - for item in items_by_group[Group.Freemium]: - if item.has_any_group(Group.DLC): - created_items.append(world.create_item(item)) - if item.has_any_group(Group.Item) and World_Options.item_shuffle == Options.ItemShuffle.option_shuffled: - created_items.append(world.create_item(item)) - if World_Options.coinsanity == Options.CoinSanity.option_coin: - coin_bundle_needed = math.floor(889 / World_Options.coinbundlequantity) - for item in items_by_group[Group.Freemium]: - if item.has_any_group(Group.Coin): - for i in range(coin_bundle_needed): - created_items.append(world.create_item(item)) - if 889 % World_Options.coinbundlequantity != 0: - created_items.append(world.create_item(item)) + if (world_options.campaign == Options.Campaign.option_live_freemium_or_die or + world_options.campaign == Options.Campaign.option_both): + create_items_lfod(world_options, created_items, world) - trap_items = create_trap_items(world, World_Options, locations_count - len(created_items), random) + trap_items = create_trap_items(world, world_options, locations_count - len(created_items), random) created_items += trap_items return created_items + + +def create_items_lfod(world_options, created_items, world): + for item in items_by_group[Group.Freemium]: + if item.has_any_group(Group.DLC): + created_items.append(world.create_item(item)) + if item.has_any_group(Group.Item) and world_options.item_shuffle == Options.ItemShuffle.option_shuffled: + created_items.append(world.create_item(item)) + if item.has_any_group(Group.Twice): + created_items.append(world.create_item(item)) + if world_options.coinsanity == Options.CoinSanity.option_coin: + if world_options.coinbundlequantity == -1: + create_coin_piece(created_items, world, 889, 200, Group.Freemium) + return + create_coin(world_options, created_items, world, 889, 200, Group.Freemium) + + +def create_items_basic(world_options, created_items, world): + for item in items_by_group[Group.DLCQuest]: + if item.has_any_group(Group.DLC): + created_items.append(world.create_item(item)) + if item.has_any_group(Group.Item) and world_options.item_shuffle == Options.ItemShuffle.option_shuffled: + created_items.append(world.create_item(item)) + if item.has_any_group(Group.Twice): + created_items.append(world.create_item(item)) + if world_options.coinsanity == Options.CoinSanity.option_coin: + if world_options.coinbundlequantity == -1: + create_coin_piece(created_items, world, 825, 250, Group.DLCQuest) + return + create_coin(world_options, created_items, world, 825, 250, Group.DLCQuest) + + +def create_coin(world_options, created_items, world, total_coins, required_coins, group): + coin_bundle_required = math.ceil(required_coins / world_options.coinbundlequantity) + coin_bundle_useful = math.ceil((total_coins - coin_bundle_required * world_options.coinbundlequantity) / world_options.coinbundlequantity) + for item in items_by_group[group]: + if item.has_any_group(Group.Coin): + for i in range(coin_bundle_required): + created_items.append(world.create_item(item)) + for i in range(coin_bundle_useful): + created_items.append(world.create_item(item, ItemClassification.useful)) + + +def create_coin_piece(created_items, world, total_coins, required_coins, group): + for item in items_by_group[group]: + if item.has_any_group(Group.Piece): + for i in range(required_coins*10): + created_items.append(world.create_item(item)) + for i in range((total_coins - required_coins) * 10): + created_items.append(world.create_item(item, ItemClassification.useful)) diff --git a/worlds/dlcquest/Locations.py b/worlds/dlcquest/Locations.py index a9fdd00a..dfc52485 100644 --- a/worlds/dlcquest/Locations.py +++ b/worlds/dlcquest/Locations.py @@ -76,3 +76,14 @@ for i in range(1, 826): for i in range(1, 890): item_coin_freemium = f"Live Freemium or Die: {i} Coin" location_table[item_coin_freemium] = offset + 825 + 58 + i + + +offset_special = 3829200000 + +for i in range(1, 8251): + item_coin_piece = f"DLC Quest: {i} Coin Piece" + location_table[item_coin_piece] = offset_special + i + +for i in range(1, 8891): + item_coin_piece_freemium = f"Live Freemium or Die: {i} Coin Piece" + location_table[item_coin_piece_freemium] = offset_special + 8250 + i \ No newline at end of file diff --git a/worlds/dlcquest/Options.py b/worlds/dlcquest/Options.py index 769acbec..067e349b 100644 --- a/worlds/dlcquest/Options.py +++ b/worlds/dlcquest/Options.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +import datetime from Options import Choice, DeathLink, NamedRange, PerGameCommonOptions @@ -48,6 +49,20 @@ class CoinSanityRange(NamedRange): "normal": 20, "high": 50, } + if datetime.datetime.today().month == 4: + if datetime.datetime.today().day == 1: + special_range_names["surprise"] = -1 + else: + special_range_names["coin piece"] = -1 + + +class PermanentCoins(Choice): + """If purchasing a pack decreases your current coins amounts.""" + internal_name = "permanent_coins" + display_name = "Permanent Coins" + option_false = 0 + option_true = 1 + default = 0 class EndingChoice(Choice): @@ -83,6 +98,7 @@ class DLCQuestOptions(PerGameCommonOptions): double_jump_glitch: DoubleJumpGlitch coinsanity: CoinSanity coinbundlequantity: CoinSanityRange + permanent_coins: PermanentCoins time_is_money: TimeIsMoney ending_choice: EndingChoice campaign: Campaign diff --git a/worlds/dlcquest/Regions.py b/worlds/dlcquest/Regions.py index 6dad9fc1..5b256afd 100644 --- a/worlds/dlcquest/Regions.py +++ b/worlds/dlcquest/Regions.py @@ -182,9 +182,22 @@ def create_coinsanity_locations_lfod(has_coinsanity: bool, coin_bundle_size: int def create_coinsanity_locations(has_coinsanity: bool, coin_bundle_size: int, player: int, region: Region, last_coin_number: int, campaign_prefix: str): if not has_coinsanity: return + if coin_bundle_size == -1: + create_coinsanity_piece_locations(player, region, last_coin_number, campaign_prefix) + return + coin_bundle_needed = math.ceil(last_coin_number / coin_bundle_size) for i in range(1, coin_bundle_needed + 1): number_coins = min(last_coin_number, coin_bundle_size * i) item_coin = f"{campaign_prefix}: {number_coins} Coin" region.locations += [DLCQuestLocation(player, item_coin, location_table[item_coin], region)] + + +def create_coinsanity_piece_locations(player: int, region: Region, total_coin: int, campaign_prefix:str): + + pieces_needed = total_coin * 10 + for i in range(1, pieces_needed + 1): + number_piece = i + item_piece = f"{campaign_prefix}: {number_piece} Coin Piece" + region.locations += [DLCQuestLocation(player, item_piece, location_table[item_piece], region)] diff --git a/worlds/dlcquest/Rules.py b/worlds/dlcquest/Rules.py index 5792d9c3..3461d063 100644 --- a/worlds/dlcquest/Rules.py +++ b/worlds/dlcquest/Rules.py @@ -1,5 +1,4 @@ import math -import re from BaseClasses import ItemClassification from worlds.generic.Rules import add_rule, item_name_in_locations, set_rule @@ -19,23 +18,23 @@ def has_enough_coin_freemium(player: int, coin: int): return lambda state: state.prog_items[player][" coins freemium"] >= coin -def set_rules(world, player, World_Options: Options.DLCQuestOptions): - set_basic_rules(World_Options, player, world) - set_lfod_rules(World_Options, player, world) - set_completion_condition(World_Options, player, world) +def set_rules(world, player, world_options: Options.DLCQuestOptions): + set_basic_rules(world_options, player, world) + set_lfod_rules(world_options, player, world) + set_completion_condition(world_options, player, world) -def set_basic_rules(World_Options, player, world): - if World_Options.campaign == Options.Campaign.option_live_freemium_or_die: +def set_basic_rules(world_options, player, world): + if world_options.campaign == Options.Campaign.option_live_freemium_or_die: return set_basic_entrance_rules(player, world) - set_basic_self_obtained_items_rules(World_Options, player, world) - set_basic_shuffled_items_rules(World_Options, player, world) - set_double_jump_glitchless_rules(World_Options, player, world) - set_easy_double_jump_glitch_rules(World_Options, player, world) - self_basic_coinsanity_funded_purchase_rules(World_Options, player, world) - set_basic_self_funded_purchase_rules(World_Options, player, world) - self_basic_win_condition(World_Options, player, world) + set_basic_self_obtained_items_rules(world_options, player, world) + set_basic_shuffled_items_rules(world_options, player, world) + set_double_jump_glitchless_rules(world_options, player, world) + set_easy_double_jump_glitch_rules(world_options, player, world) + self_basic_coinsanity_funded_purchase_rules(world_options, player, world) + set_basic_self_funded_purchase_rules(world_options, player, world) + self_basic_win_condition(world_options, player, world) def set_basic_entrance_rules(player, world): @@ -49,13 +48,13 @@ def set_basic_entrance_rules(player, world): lambda state: state.has("Double Jump Pack", player)) -def set_basic_self_obtained_items_rules(World_Options, player, world): - if World_Options.item_shuffle != Options.ItemShuffle.option_disabled: +def set_basic_self_obtained_items_rules(world_options, player, world): + if world_options.item_shuffle != Options.ItemShuffle.option_disabled: return set_rule(world.get_entrance("Behind Ogre", player), lambda state: state.has("Gun Pack", player)) - if World_Options.time_is_money == Options.TimeIsMoney.option_required: + if world_options.time_is_money == Options.TimeIsMoney.option_required: set_rule(world.get_entrance("Tree", player), lambda state: state.has("Time is Money Pack", player)) set_rule(world.get_entrance("Cave Tree", player), @@ -70,35 +69,35 @@ def set_basic_self_obtained_items_rules(World_Options, player, world): lambda state: state.has("Time is Money Pack", player)) -def set_basic_shuffled_items_rules(World_Options, player, world): - if World_Options.item_shuffle != Options.ItemShuffle.option_shuffled: +def set_basic_shuffled_items_rules(world_options, player, world): + if world_options.item_shuffle != Options.ItemShuffle.option_shuffled: return set_rule(world.get_entrance("Behind Ogre", player), - lambda state: state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player, 2)) set_rule(world.get_entrance("Tree", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_entrance("Cave Tree", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_entrance("True Double Jump", player), lambda state: state.has("Double Jump Pack", player)) set_rule(world.get_location("Shepherd Sheep", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_location("North West Ceiling Sheep", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_location("North West Alcove Sheep", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_location("West Cave Sheep", player), - lambda state: state.has("Sword", player) or state.has("Gun", player)) + lambda state: state.has("DLC Quest: Progressive Weapon", player)) set_rule(world.get_location("Gun", player), lambda state: state.has("Gun Pack", player)) - if World_Options.time_is_money == Options.TimeIsMoney.option_required: + if world_options.time_is_money == Options.TimeIsMoney.option_required: set_rule(world.get_location("Sword", player), lambda state: state.has("Time is Money Pack", player)) -def set_double_jump_glitchless_rules(World_Options, player, world): - if World_Options.double_jump_glitch != Options.DoubleJumpGlitch.option_none: +def set_double_jump_glitchless_rules(world_options, player, world): + if world_options.double_jump_glitch != Options.DoubleJumpGlitch.option_none: return set_rule(world.get_entrance("Cloud Double Jump", player), lambda state: state.has("Double Jump Pack", player)) @@ -106,8 +105,8 @@ def set_double_jump_glitchless_rules(World_Options, player, world): lambda state: state.has("Double Jump Pack", player)) -def set_easy_double_jump_glitch_rules(World_Options, player, world): - if World_Options.double_jump_glitch == Options.DoubleJumpGlitch.option_all: +def set_easy_double_jump_glitch_rules(world_options, player, world): + if world_options.double_jump_glitch == Options.DoubleJumpGlitch.option_all: return set_rule(world.get_entrance("Behind Tree Double Jump", player), lambda state: state.has("Double Jump Pack", player)) @@ -115,71 +114,74 @@ def set_easy_double_jump_glitch_rules(World_Options, player, world): lambda state: state.has("Double Jump Pack", player)) -def self_basic_coinsanity_funded_purchase_rules(World_Options, player, world): - if World_Options.coinsanity != Options.CoinSanity.option_coin: +def self_basic_coinsanity_funded_purchase_rules(world_options, player, world): + if world_options.coinsanity != Options.CoinSanity.option_coin: return - number_of_bundle = math.floor(825 / World_Options.coinbundlequantity) + if world_options.coinbundlequantity == -1: + self_basic_coinsanity_piece_rules(player, world) + return + number_of_bundle = math.floor(825 / world_options.coinbundlequantity) for i in range(number_of_bundle): - item_coin = f"DLC Quest: {World_Options.coinbundlequantity * (i + 1)} Coin" + item_coin = f"DLC Quest: {world_options.coinbundlequantity * (i + 1)} Coin" set_rule(world.get_location(item_coin, player), - has_enough_coin(player, World_Options.coinbundlequantity * (i + 1))) - if 825 % World_Options.coinbundlequantity != 0: + has_enough_coin(player, world_options.coinbundlequantity * (i + 1))) + if 825 % world_options.coinbundlequantity != 0: set_rule(world.get_location("DLC Quest: 825 Coin", player), has_enough_coin(player, 825)) set_rule(world.get_location("Movement Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(4 / World_Options.coinbundlequantity))) + math.ceil(4 / world_options.coinbundlequantity))) set_rule(world.get_location("Animation Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Audio Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Pause Menu Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Time is Money Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(20 / World_Options.coinbundlequantity))) + math.ceil(20 / world_options.coinbundlequantity))) set_rule(world.get_location("Double Jump Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(100 / World_Options.coinbundlequantity))) + math.ceil(100 / world_options.coinbundlequantity))) set_rule(world.get_location("Pet Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Sexy Outfits Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Top Hat Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Map Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(140 / World_Options.coinbundlequantity))) + math.ceil(140 / world_options.coinbundlequantity))) set_rule(world.get_location("Gun Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(75 / World_Options.coinbundlequantity))) + math.ceil(75 / world_options.coinbundlequantity))) set_rule(world.get_location("The Zombie Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Night Map Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(75 / World_Options.coinbundlequantity))) + math.ceil(75 / world_options.coinbundlequantity))) set_rule(world.get_location("Psychological Warfare Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(50 / World_Options.coinbundlequantity))) + math.ceil(50 / world_options.coinbundlequantity))) set_rule(world.get_location("Armor for your Horse Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(250 / World_Options.coinbundlequantity))) + math.ceil(250 / world_options.coinbundlequantity))) set_rule(world.get_location("Finish the Fight Pack", player), lambda state: state.has("DLC Quest: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) -def set_basic_self_funded_purchase_rules(World_Options, player, world): - if World_Options.coinsanity != Options.CoinSanity.option_none: +def set_basic_self_funded_purchase_rules(world_options, player, world): + if world_options.coinsanity != Options.CoinSanity.option_none: return set_rule(world.get_location("Movement Pack", player), has_enough_coin(player, 4)) @@ -215,25 +217,25 @@ def set_basic_self_funded_purchase_rules(World_Options, player, world): has_enough_coin(player, 5)) -def self_basic_win_condition(World_Options, player, world): - if World_Options.ending_choice == Options.EndingChoice.option_any: +def self_basic_win_condition(world_options, player, world): + if world_options.ending_choice == Options.EndingChoice.option_any: set_rule(world.get_location("Winning Basic", player), lambda state: state.has("Finish the Fight Pack", player)) - if World_Options.ending_choice == Options.EndingChoice.option_true: + if world_options.ending_choice == Options.EndingChoice.option_true: set_rule(world.get_location("Winning Basic", player), lambda state: state.has("Armor for your Horse Pack", player) and state.has("Finish the Fight Pack", player)) -def set_lfod_rules(World_Options, player, world): - if World_Options.campaign == Options.Campaign.option_basic: +def set_lfod_rules(world_options, player, world): + if world_options.campaign == Options.Campaign.option_basic: return set_lfod_entrance_rules(player, world) set_boss_door_requirements_rules(player, world) - set_lfod_self_obtained_items_rules(World_Options, player, world) - set_lfod_shuffled_items_rules(World_Options, player, world) - self_lfod_coinsanity_funded_purchase_rules(World_Options, player, world) - set_lfod_self_funded_purchase_rules(World_Options, has_enough_coin_freemium, player, world) + set_lfod_self_obtained_items_rules(world_options, player, world) + set_lfod_shuffled_items_rules(world_options, player, world) + self_lfod_coinsanity_funded_purchase_rules(world_options, player, world) + set_lfod_self_funded_purchase_rules(world_options, has_enough_coin_freemium, player, world) def set_lfod_entrance_rules(player, world): @@ -251,8 +253,6 @@ def set_lfod_entrance_rules(player, world): lambda state: state.has("Death of Comedy Pack", player)) set_rule(world.get_location("Story is Important", player), lambda state: state.has("DLC NPC Pack", player)) - set_rule(world.get_entrance("Pickaxe Hard Cave", player), - lambda state: state.has("Pickaxe", player)) def set_boss_door_requirements_rules(player, world): @@ -280,8 +280,8 @@ def set_boss_door_requirements_rules(player, world): set_rule(world.get_entrance("Boss Door", player), has_3_swords) -def set_lfod_self_obtained_items_rules(World_Options, player, world): - if World_Options.item_shuffle != Options.ItemShuffle.option_disabled: +def set_lfod_self_obtained_items_rules(world_options, player, world): + if world_options.item_shuffle != Options.ItemShuffle.option_disabled: return set_rule(world.get_entrance("Vines", player), lambda state: state.has("Incredibly Important Pack", player)) @@ -292,13 +292,15 @@ def set_lfod_self_obtained_items_rules(World_Options, player, world): state.has("Name Change Pack", player)) -def set_lfod_shuffled_items_rules(World_Options, player, world): - if World_Options.item_shuffle != Options.ItemShuffle.option_shuffled: +def set_lfod_shuffled_items_rules(world_options, player, world): + if world_options.item_shuffle != Options.ItemShuffle.option_shuffled: return set_rule(world.get_entrance("Vines", player), - lambda state: state.has("Wooden Sword", player) or state.has("Pickaxe", player)) + lambda state: state.has("Live Freemium or Die: Progressive Weapon", player)) set_rule(world.get_entrance("Behind Rocks", player), - lambda state: state.has("Pickaxe", player)) + lambda state: state.has("Live Freemium or Die: Progressive Weapon", player, 2)) + set_rule(world.get_entrance("Pickaxe Hard Cave", player), + lambda state: state.has("Live Freemium or Die: Progressive Weapon", player, 2)) set_rule(world.get_location("Wooden Sword", player), lambda state: state.has("Incredibly Important Pack", player)) @@ -311,83 +313,84 @@ def set_lfod_shuffled_items_rules(World_Options, player, world): lambda state: state.can_reach("Cut Content", 'region', player)) -def self_lfod_coinsanity_funded_purchase_rules(World_Options, player, world): - if World_Options.coinsanity != Options.CoinSanity.option_coin: +def self_lfod_coinsanity_funded_purchase_rules(world_options, player, world): + if world_options.coinsanity != Options.CoinSanity.option_coin: return - number_of_bundle = math.floor(889 / World_Options.coinbundlequantity) + if world_options.coinbundlequantity == -1: + self_lfod_coinsanity_piece_rules(player, world) + return + number_of_bundle = math.floor(889 / world_options.coinbundlequantity) for i in range(number_of_bundle): - item_coin_freemium = "Live Freemium or Die: number Coin" - item_coin_loc_freemium = re.sub("number", str(World_Options.coinbundlequantity * (i + 1)), - item_coin_freemium) - set_rule(world.get_location(item_coin_loc_freemium, player), - has_enough_coin_freemium(player, World_Options.coinbundlequantity * (i + 1))) - if 889 % World_Options.coinbundlequantity != 0: + item_coin_freemium = f"Live Freemium or Die: {world_options.coinbundlequantity * (i + 1)} Coin" + set_rule(world.get_location(item_coin_freemium, player), + has_enough_coin_freemium(player, world_options.coinbundlequantity * (i + 1))) + if 889 % world_options.coinbundlequantity != 0: set_rule(world.get_location("Live Freemium or Die: 889 Coin", player), has_enough_coin_freemium(player, 889)) add_rule(world.get_entrance("Boss Door", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(889 / World_Options.coinbundlequantity))) + math.ceil(200 / world_options.coinbundlequantity))) set_rule(world.get_location("Particles Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Day One Patch Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Checkpoint Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Incredibly Important Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(15 / World_Options.coinbundlequantity))) + math.ceil(15 / world_options.coinbundlequantity))) set_rule(world.get_location("Wall Jump Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(35 / World_Options.coinbundlequantity))) + math.ceil(35 / world_options.coinbundlequantity))) set_rule(world.get_location("Health Bar Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Parallax Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(5 / World_Options.coinbundlequantity))) + math.ceil(5 / world_options.coinbundlequantity))) set_rule(world.get_location("Harmless Plants Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(130 / World_Options.coinbundlequantity))) + math.ceil(130 / world_options.coinbundlequantity))) set_rule(world.get_location("Death of Comedy Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(15 / World_Options.coinbundlequantity))) + math.ceil(15 / world_options.coinbundlequantity))) set_rule(world.get_location("Canadian Dialog Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(10 / World_Options.coinbundlequantity))) + math.ceil(10 / world_options.coinbundlequantity))) set_rule(world.get_location("DLC NPC Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(15 / World_Options.coinbundlequantity))) + math.ceil(15 / world_options.coinbundlequantity))) set_rule(world.get_location("Cut Content Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(40 / World_Options.coinbundlequantity))) + math.ceil(40 / world_options.coinbundlequantity))) set_rule(world.get_location("Name Change Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(150 / World_Options.coinbundlequantity))) + math.ceil(150 / world_options.coinbundlequantity))) set_rule(world.get_location("Season Pass", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(199 / World_Options.coinbundlequantity))) + math.ceil(199 / world_options.coinbundlequantity))) set_rule(world.get_location("High Definition Next Gen Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(20 / World_Options.coinbundlequantity))) + math.ceil(20 / world_options.coinbundlequantity))) set_rule(world.get_location("Increased HP Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(10 / World_Options.coinbundlequantity))) + math.ceil(10 / world_options.coinbundlequantity))) set_rule(world.get_location("Remove Ads Pack", player), lambda state: state.has("Live Freemium or Die: Coin Bundle", player, - math.ceil(25 / World_Options.coinbundlequantity))) + math.ceil(25 / world_options.coinbundlequantity))) -def set_lfod_self_funded_purchase_rules(World_Options, has_enough_coin_freemium, player, world): - if World_Options.coinsanity != Options.CoinSanity.option_none: +def set_lfod_self_funded_purchase_rules(world_options, has_enough_coin_freemium, player, world): + if world_options.coinsanity != Options.CoinSanity.option_none: return add_rule(world.get_entrance("Boss Door", player), - has_enough_coin_freemium(player, 889)) + has_enough_coin_freemium(player, 200)) set_rule(world.get_location("Particles Pack", player), has_enough_coin_freemium(player, 5)) @@ -425,11 +428,98 @@ def set_lfod_self_funded_purchase_rules(World_Options, has_enough_coin_freemium, has_enough_coin_freemium(player, 25)) -def set_completion_condition(World_Options, player, world): - if World_Options.campaign == Options.Campaign.option_basic: +def set_completion_condition(world_options, player, world): + if world_options.campaign == Options.Campaign.option_basic: world.completion_condition[player] = lambda state: state.has("Victory Basic", player) - if World_Options.campaign == Options.Campaign.option_live_freemium_or_die: + if world_options.campaign == Options.Campaign.option_live_freemium_or_die: world.completion_condition[player] = lambda state: state.has("Victory Freemium", player) - if World_Options.campaign == Options.Campaign.option_both: + if world_options.campaign == Options.Campaign.option_both: world.completion_condition[player] = lambda state: state.has("Victory Basic", player) and state.has( "Victory Freemium", player) + + +def self_basic_coinsanity_piece_rules(player, world): + for i in range(1,8251): + + item_coin = f"DLC Quest: {i} Coin Piece" + set_rule(world.get_location(item_coin, player), + has_enough_coin(player, math.ceil(i / 10))) + + set_rule(world.get_location("Movement Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 40)) + set_rule(world.get_location("Animation Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Audio Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Pause Menu Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Time is Money Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 200)) + set_rule(world.get_location("Double Jump Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 100)) + set_rule(world.get_location("Pet Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Sexy Outfits Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Top Hat Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Map Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 1400)) + set_rule(world.get_location("Gun Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 750)) + set_rule(world.get_location("The Zombie Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + set_rule(world.get_location("Night Map Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 750)) + set_rule(world.get_location("Psychological Warfare Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 500)) + set_rule(world.get_location("Armor for your Horse Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 2500)) + set_rule(world.get_location("Finish the Fight Pack", player), + lambda state: state.has("DLC Quest: Coin Piece", player, 50)) + + +def self_lfod_coinsanity_piece_rules(player, world): + for i in range(1, 8891): + + item_coin_freemium = f"Live Freemium or Die: {i} Coin Piece" + set_rule(world.get_location(item_coin_freemium, player), + has_enough_coin_freemium(player, math.ceil(i / 10))) + + add_rule(world.get_entrance("Boss Door", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 2000)) + + set_rule(world.get_location("Particles Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 50)) + set_rule(world.get_location("Day One Patch Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 50)) + set_rule(world.get_location("Checkpoint Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 50)) + set_rule(world.get_location("Incredibly Important Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 150)) + set_rule(world.get_location("Wall Jump Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 350)) + set_rule(world.get_location("Health Bar Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 50)) + set_rule(world.get_location("Parallax Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 50)) + set_rule(world.get_location("Harmless Plants Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 1300)) + set_rule(world.get_location("Death of Comedy Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 150)) + set_rule(world.get_location("Canadian Dialog Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 100)) + set_rule(world.get_location("DLC NPC Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 150)) + set_rule(world.get_location("Cut Content Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 400)) + set_rule(world.get_location("Name Change Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 1500)) + set_rule(world.get_location("Season Pass", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 199)) + set_rule(world.get_location("High Definition Next Gen Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 20)) + set_rule(world.get_location("Increased HP Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 100)) + set_rule(world.get_location("Remove Ads Pack", player), + lambda state: state.has("Live Freemium or Die: Coin Piece", player, 250)) diff --git a/worlds/dlcquest/__init__.py b/worlds/dlcquest/__init__.py index db55b190..2200729a 100644 --- a/worlds/dlcquest/__init__.py +++ b/worlds/dlcquest/__init__.py @@ -1,6 +1,6 @@ from typing import Union -from BaseClasses import Tutorial, CollectionState +from BaseClasses import Tutorial, CollectionState, ItemClassification from worlds.AutoWorld import WebWorld, World from . import Options from .Items import DLCQuestItem, ItemData, create_items, item_table, items_by_group, Group @@ -82,11 +82,13 @@ class DLCqworld(World): if self.options.coinsanity == Options.CoinSanity.option_coin and self.options.coinbundlequantity >= 5: self.multiworld.push_precollected(self.create_item("Movement Pack")) - def create_item(self, item: Union[str, ItemData]) -> DLCQuestItem: + def create_item(self, item: Union[str, ItemData], classification: ItemClassification = None) -> DLCQuestItem: if isinstance(item, str): item = item_table[item] + if classification is None: + classification = item.classification - return DLCQuestItem(item.name, item.classification, item.code, self.player) + return DLCQuestItem(item.name, classification, item.code, self.player) def get_filler_item_name(self) -> str: trap = self.multiworld.random.choice(items_by_group[Group.Trap]) @@ -94,7 +96,7 @@ class DLCqworld(World): def fill_slot_data(self): options_dict = self.options.as_dict( - "death_link", "ending_choice", "campaign", "coinsanity", "item_shuffle" + "death_link", "ending_choice", "campaign", "coinsanity", "item_shuffle", "permanent_coins" ) options_dict.update({ "coinbundlerange": self.options.coinbundlequantity.value, diff --git a/worlds/dlcquest/data/items.csv b/worlds/dlcquest/data/items.csv index cc5ac0bb..82150254 100644 --- a/worlds/dlcquest/data/items.csv +++ b/worlds/dlcquest/data/items.csv @@ -27,8 +27,8 @@ id,name,classification,groups 25,Canadian Dialog Pack,filler,"DLC,Freemium" 26,DLC NPC Pack,progression,"DLC,Freemium" 27,Cut Content Pack,progression,"DLC,Freemium" -28,Name Change Pack,progression,"DLC,Freemium" -29,Pickaxe,progression,"Item,Freemium" +28,Name Change Pack,progression,"DLC,Freemium,Trap" +29,Pickaxe,progression,"Deprecated" 30,Season Pass,progression,"DLC,Freemium" 31,High Definition Next Gen Pack,filler,"DLC,Freemium" 32,Increased HP Pack,useful,"DLC,Freemium" @@ -36,13 +36,17 @@ id,name,classification,groups 34,Big Sword Pack,progression,"DLC,Freemium" 35,Really Big Sword Pack,progression,"DLC,Freemium" 36,Unfathomable Sword Pack,progression,"DLC,Freemium" -37,Gun,progression,"Item,DLCQuest" -38,Sword,progression,"Item,DLCQuest" -39,Wooden Sword,progression,"Item,Freemium" +37,Gun,progression,"Deprecated" +38,Sword,progression,"Deprecated" +39,Wooden Sword,progression,"Deprecated" 40,Box of Various Supplies,progression,"Item,Freemium" 41,Humble Indie Bindle,progression,"Item,Freemium" 42,DLC Quest: Coin Bundle,progression,"Coin,DLCQuest" 43,Live Freemium or Die: Coin Bundle,progression,"Coin,Freemium" 44,Zombie Sheep,trap,Trap 45,Temporary Spike,trap,Trap -46,Loading Screen,trap,Trap \ No newline at end of file +46,Loading Screen,trap,Trap +48,DLC Quest: Progressive Weapon,progression,"Item,Twice,DLCQuest" +49,Live Freemium or Die: Progressive Weapon,progression,"Item,Twice,Freemium" +50,DLC Quest: Coin Piece,progression,"Piece,DLCQuest" +51,Live Freemium or Die: Coin Piece,progression,"Piece,Freemium" \ No newline at end of file diff --git a/worlds/dlcquest/test/TestItemShuffle.py b/worlds/dlcquest/test/TestItemShuffle.py index bfe99924..7a9e5d95 100644 --- a/worlds/dlcquest/test/TestItemShuffle.py +++ b/worlds/dlcquest/test/TestItemShuffle.py @@ -7,7 +7,10 @@ wooden_sword = "Wooden Sword" pickaxe = "Pickaxe" humble_bindle = "Humble Indie Bindle" box_supplies = "Box of Various Supplies" -items = [sword, gun, wooden_sword, pickaxe, humble_bindle, box_supplies] +locations = [sword, gun, wooden_sword, pickaxe, humble_bindle, box_supplies] +prog_weapon_basic = "DLC Quest: Progressive Weapon" +prog_weapon_lfod = "Live Freemium or Die: Progressive Weapon" +items = [prog_weapon_basic, prog_weapon_lfod, humble_bindle, box_supplies] important_pack = "Incredibly Important Pack" @@ -22,9 +25,14 @@ class TestItemShuffle(DLCQuestTestBase): with self.subTest(f"{item}"): self.assertIn(item, item_names) + def test_progressive_weapon_in_pool(self): + item_names = [item.name for item in self.multiworld.get_items()] + self.assertEqual(item_names.count(prog_weapon_basic), 2) + self.assertEqual(item_names.count(prog_weapon_lfod), 2) + def test_item_locations_in_pool(self): location_names = {location.name for location in self.multiworld.get_locations()} - for item_location in items: + for item_location in locations: with self.subTest(f"{item_location}"): self.assertIn(item_location, location_names) @@ -42,7 +50,7 @@ class TestItemShuffle(DLCQuestTestBase): movement_pack = self.multiworld.create_item("Movement Pack", self.player) self.collect(movement_pack) self.assertFalse(self.can_reach_location(gun)) - sword_item = self.multiworld.create_item(sword, self.player) + sword_item = self.multiworld.create_item(prog_weapon_basic, self.player) self.collect(sword_item) self.assertFalse(self.can_reach_location(gun)) gun_pack = self.multiworld.create_item("Gun Pack", self.player) @@ -57,7 +65,7 @@ class TestItemShuffle(DLCQuestTestBase): def test_bindle_location_has_correct_rules(self): self.assertFalse(self.can_reach_location(humble_bindle)) - wooden_sword_item = self.multiworld.create_item(wooden_sword, self.player) + wooden_sword_item = self.multiworld.create_item(prog_weapon_lfod, self.player) self.collect(wooden_sword_item) self.assertFalse(self.can_reach_location(humble_bindle)) plants_pack = self.multiworld.create_item("Harmless Plants Pack", self.player) @@ -78,7 +86,7 @@ class TestItemShuffle(DLCQuestTestBase): def test_box_supplies_location_has_correct_rules(self): self.assertFalse(self.can_reach_location(box_supplies)) - wooden_sword_item = self.multiworld.create_item(wooden_sword, self.player) + wooden_sword_item = self.multiworld.create_item(prog_weapon_lfod, self.player) self.collect(wooden_sword_item) self.assertFalse(self.can_reach_location(box_supplies)) plants_pack = self.multiworld.create_item("Harmless Plants Pack", self.player) @@ -96,7 +104,7 @@ class TestItemShuffle(DLCQuestTestBase): def test_pickaxe_location_has_correct_rules(self): self.assertFalse(self.can_reach_location(pickaxe)) - wooden_sword_item = self.multiworld.create_item(wooden_sword, self.player) + wooden_sword_item = self.multiworld.create_item(prog_weapon_lfod, self.player) self.collect(wooden_sword_item) self.assertFalse(self.can_reach_location(pickaxe)) plants_pack = self.multiworld.create_item("Harmless Plants Pack", self.player) @@ -125,6 +133,6 @@ class TestNoItemShuffle(DLCQuestTestBase): def test_item_locations_not_in_pool(self): location_names = {location.name for location in self.multiworld.get_locations()} - for item_location in items: + for item_location in locations: with self.subTest(f"{item_location}"): self.assertNotIn(item_location, location_names) \ No newline at end of file