DLCQuest: Generation bug fix (#1757)

* Fix documentation error

* init_creation

somehow this fix bug

* item_shuffle_fix

also a count as been corrected

* Fix_early_generation

* Update __init__.py

* Update __init__.py

fix version specific bug

* fix rule set for final boss

and did some reformation
(thanks kaito)

* Update Rules.py

the sword trio can now be in itself if before or actually themself

* Core: correct typing info for item_in_locations
Core: rename item_in_locations to item_name_in_location_names
Core: add actual item_name_in_locations

* item_shuffle_fix

also a count as been corrected

* Fix_early_generation

* fix rule set for final boss

and did some reformation
(thanks kaito)

* Update Rules.py

the sword trio can now be in itself if before or actually themself

* Fix the missing []
and switch to the good function

* - Cleanup and Black Sliver's suggestions

---------

Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: Alex Gilbert <alexgilbert@yahoo.com>
This commit is contained in:
axe-y 2023-04-25 03:06:58 -04:00 committed by GitHub
parent c0cf35edda
commit 173513c9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 382 additions and 303 deletions

View File

@ -1,7 +1,7 @@
import math
import re
from .Locations import DLCQuestLocation
from ..generic.Rules import add_rule, set_rule
from ..generic.Rules import add_rule, set_rule, item_name_in_locations
from .Items import DLCQuestItem
from BaseClasses import ItemClassification
from . import Options
@ -22,7 +22,6 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
return coin_possessed >= coins
return lambda state: has_coin(state, player, coin)
def has_enough_coin_freemium(player: int, coin: int):
@ -37,8 +36,25 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
return lambda state: has_coin(state, player, coin)
if World_Options[Options.Campaign] == Options.Campaign.option_basic or World_Options[
Options.Campaign] == Options.Campaign.option_both:
set_basic_rules(World_Options, has_enough_coin, player, world)
set_lfod_rules(World_Options, has_enough_coin_freemium, player, world)
set_completion_condition(World_Options, player, world)
def set_basic_rules(World_Options, has_enough_coin, player, world):
if World_Options[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, has_enough_coin, player, world)
set_basic_self_funded_purchase_rules(World_Options, has_enough_coin, player, world)
self_basic_win_condition(World_Options, player, world)
def set_basic_entrance_rules(player, world):
set_rule(world.get_entrance("Moving", player),
lambda state: state.has("Movement Pack", player))
set_rule(world.get_entrance("Cloud", player),
@ -48,7 +64,10 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_entrance("Forest True Double Jump", player),
lambda state: state.has("Double Jump Pack", player))
if World_Options[Options.ItemShuffle] == Options.ItemShuffle.option_disabled:
def set_basic_self_obtained_items_rules(World_Options, player, world):
if World_Options[Options.ItemShuffle] != Options.ItemShuffle.option_disabled:
return
set_rule(world.get_entrance("Behind Ogre", player),
lambda state: state.has("Gun Pack", player))
@ -66,7 +85,10 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("West Cave Sheep", player),
lambda state: state.has("Time is Money Pack", player))
if World_Options[Options.ItemShuffle] == Options.ItemShuffle.option_shuffled:
def set_basic_shuffled_items_rules(World_Options, player, world):
if World_Options[Options.ItemShuffle] != Options.ItemShuffle.option_shuffled:
return
set_rule(world.get_entrance("Behind Ogre", player),
lambda state: state.has("Gun", player))
set_rule(world.get_entrance("Tree", player),
@ -88,20 +110,28 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("Sword", player),
lambda state: state.has("Time is Money Pack", player))
if World_Options[Options.FalseDoubleJump] == Options.FalseDoubleJump.option_none:
def set_double_jump_glitchless_rules(World_Options, player, world):
if World_Options[Options.FalseDoubleJump] != Options.FalseDoubleJump.option_none:
return
set_rule(world.get_entrance("Cloud Double Jump", player),
lambda state: state.has("Double Jump Pack", player))
set_rule(world.get_entrance("Forest Double Jump", player),
lambda state: state.has("Double Jump Pack", player))
if World_Options[Options.FalseDoubleJump] == Options.FalseDoubleJump.option_none or World_Options[
Options.FalseDoubleJump] == Options.FalseDoubleJump.option_simple:
def set_easy_double_jump_glitch_rules(World_Options, player, world):
if World_Options[Options.FalseDoubleJump] == Options.FalseDoubleJump.option_all:
return
set_rule(world.get_entrance("Behind Tree Double Jump", player),
lambda state: state.has("Double Jump Pack", player))
set_rule(world.get_entrance("Cave Roof", player),
lambda state: state.has("Double Jump Pack", player))
if World_Options[Options.CoinSanity] == Options.CoinSanity.option_coin:
def self_basic_coinsanity_funded_purchase_rules(World_Options, has_enough_coin, player, world):
if World_Options[Options.CoinSanity] != Options.CoinSanity.option_coin:
return
number_of_bundle = math.floor(825 / World_Options[Options.CoinSanityRange])
for i in range(number_of_bundle):
@ -161,7 +191,10 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
lambda state: state.has("DLC Quest: Coin Bundle", player,
math.ceil(5 / World_Options[Options.CoinSanityRange])))
if World_Options[Options.CoinSanity] == Options.CoinSanity.option_none:
def set_basic_self_funded_purchase_rules(World_Options, has_enough_coin, player, world):
if World_Options[Options.CoinSanity] != Options.CoinSanity.option_none:
return
set_rule(world.get_location("Movement Pack", player),
has_enough_coin(player, 4))
set_rule(world.get_location("Animation Pack", player),
@ -195,6 +228,8 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("Finish the Fight Pack", player),
has_enough_coin(player, 5))
def self_basic_win_condition(World_Options, player, world):
if World_Options[Options.EndingChoice] == Options.EndingChoice.option_any:
set_rule(world.get_location("Winning Basic", player),
lambda state: state.has("Finish the Fight Pack", player))
@ -203,8 +238,19 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
lambda state: state.has("Armor for your Horse Pack", player) and state.has("Finish the Fight Pack",
player))
if World_Options[Options.Campaign] == Options.Campaign.option_live_freemium_or_die or World_Options[
Options.Campaign] == Options.Campaign.option_both:
def set_lfod_rules(World_Options, has_enough_coin_freemium, player, world):
if World_Options[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, has_enough_coin_freemium, player, world)
set_lfod_self_funded_purchase_rules(World_Options, has_enough_coin_freemium, player, world)
def set_lfod_entrance_rules(player, world):
set_rule(world.get_entrance("Wall Jump Entrance", player),
lambda state: state.has("Wall Jump Pack", player))
set_rule(world.get_entrance("Harmless Plants", player),
@ -215,10 +261,6 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
lambda state: state.has("Cut Content Pack", player))
set_rule(world.get_entrance("Blizzard", player),
lambda state: state.has("Season Pass", player))
set_rule(world.get_entrance("Boss Door", player),
lambda state: state.has("Big Sword Pack", player) and state.has("Really Big Sword Pack",
player) and state.has(
"Unfathomable Sword Pack", player))
set_rule(world.get_location("I Get That Reference!", player),
lambda state: state.has("Death of Comedy Pack", player))
set_rule(world.get_location("Story is Important", player),
@ -226,16 +268,47 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_entrance("Pickaxe Hard Cave", player),
lambda state: state.has("Pickaxe", player))
if World_Options[Options.ItemShuffle] == Options.ItemShuffle.option_disabled:
def set_boss_door_requirements_rules(player, world):
sword_1 = "Big Sword Pack"
sword_2 = "Really Big Sword Pack"
sword_3 = "Unfathomable Sword Pack"
big_sword_location = world.get_location(sword_1, player)
really_big_sword_location = world.get_location(sword_2, player)
unfathomable_sword_location = world.get_location(sword_3, player)
big_sword_valid_locations = [big_sword_location]
really_big_sword_valid_locations = [big_sword_location, really_big_sword_location]
unfathomable_sword_valid_locations = [big_sword_location, really_big_sword_location, unfathomable_sword_location]
big_sword_during_boss_fight = item_name_in_locations(sword_1, player, big_sword_valid_locations)
really_big_sword_during_boss_fight = item_name_in_locations(sword_2, player, really_big_sword_valid_locations)
unfathomable_sword_during_boss_fight = item_name_in_locations(sword_3, player, unfathomable_sword_valid_locations)
# For each sword, either already have received it, or be guaranteed to get it during the fight at a valid stage.
# Otherwise, a player can get soft locked.
has_3_swords = lambda state: ((state.has(sword_1, player) or big_sword_during_boss_fight) and
(state.has(sword_2, player) or really_big_sword_during_boss_fight) and
(state.has(sword_3, player) or unfathomable_sword_during_boss_fight))
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[Options.ItemShuffle] != Options.ItemShuffle.option_disabled:
return
set_rule(world.get_entrance("Vines", player),
lambda state: state.has("Incredibly Important Pack", player))
set_rule(world.get_entrance("Behind Rocks", player),
lambda state: state.can_reach("Cut Content", 'region', player))
set_rule(world.get_entrance("Pickaxe Hard Cave", player),
lambda state: state.can_reach("Cut Content", 'region', player) and state.has("Name Change Pack",
player))
lambda state: state.can_reach("Cut Content", 'region', player) and
state.has("Name Change Pack", player))
if World_Options[Options.ItemShuffle] == Options.ItemShuffle.option_shuffled:
def set_lfod_shuffled_items_rules(World_Options, player, world):
if World_Options[Options.ItemShuffle] != Options.ItemShuffle.option_shuffled:
return
set_rule(world.get_entrance("Vines", player),
lambda state: state.has("Wooden Sword", player) or state.has("Pickaxe", player))
set_rule(world.get_entrance("Behind Rocks", player),
@ -246,12 +319,15 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("Pickaxe", player),
lambda state: state.has("Humble Indie Bindle", player))
set_rule(world.get_location("Humble Indie Bindle", player),
lambda state: state.has("Box of Various Supplies", player) and state.can_reach("Cut Content",
'region', player))
lambda state: state.has("Box of Various Supplies", player) and
state.can_reach("Cut Content", 'region', player))
set_rule(world.get_location("Box of Various Supplies", player),
lambda state: state.can_reach("Cut Content", 'region', player))
if World_Options[Options.CoinSanity] == Options.CoinSanity.option_coin:
def self_lfod_coinsanity_funded_purchase_rules(World_Options, has_enough_coin_freemium, player, world):
if World_Options[Options.CoinSanity] != Options.CoinSanity.option_coin:
return
number_of_bundle = math.floor(889 / World_Options[Options.CoinSanityRange])
for i in range(number_of_bundle):
@ -264,7 +340,7 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("Live Freemium or Die: 889 Coin", player),
has_enough_coin_freemium(player, 889))
set_rule(world.get_entrance("Boss Door", player),
add_rule(world.get_entrance("Boss Door", player),
lambda state: state.has("Live Freemium or Die: Coin Bundle", player,
math.ceil(889 / World_Options[Options.CoinSanityRange])))
@ -320,8 +396,11 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
lambda state: state.has("Live Freemium or Die: Coin Bundle", player,
math.ceil(25 / World_Options[Options.CoinSanityRange])))
if World_Options[Options.CoinSanity] == Options.CoinSanity.option_none:
set_rule(world.get_entrance("Boss Door", player),
def set_lfod_self_funded_purchase_rules(World_Options, has_enough_coin_freemium, player, world):
if World_Options[Options.CoinSanity] != Options.CoinSanity.option_none:
return
add_rule(world.get_entrance("Boss Door", player),
has_enough_coin_freemium(player, 889))
set_rule(world.get_location("Particles Pack", player),
@ -359,12 +438,12 @@ def set_rules(world, player, World_Options: Options.DLCQuestOptions):
set_rule(world.get_location("Remove Ads Pack", player),
has_enough_coin_freemium(player, 25))
def set_completion_condition(World_Options, player, world):
if World_Options[Options.Campaign] == Options.Campaign.option_basic:
world.completion_condition[player] = lambda state: state.has("Victory Basic", player)
if World_Options[Options.Campaign] == Options.Campaign.option_live_freemium_or_die:
world.completion_condition[player] = lambda state: state.has("Victory Freemium", player)
if World_Options[Options.Campaign] == Options.Campaign.option_both:
world.completion_condition[player] = lambda state: state.has("Victory Basic", player) and state.has(
"Victory Freemium", player)