Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LttP: extract Dungeon and Boss from core #1787

Merged
merged 11 commits into from
May 20, 2023
Merged

Conversation

Berserker66
Copy link
Member

What is this fixing or adding?

moves Boss and Dungeon out of BaseClasses

How was this tested?

by genning just Factorio, just LttP and a multiworld with both.

If this makes graphical changes, please attach screenshots.



def format_boss_location(location: str, level: str) -> str:
return location + (' (' + level + ')' if level else '')


def place_bosses(world, player: int) -> None:
def place_bosses(multiworld, world, player: int) -> None:
Copy link
Collaborator

@el-u el-u May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pass around multiworld separately everywhere (in addition to world) when one could access it via world.multiworld where needed?

(Yes, I realize that in the old code the world argument is of type MultiWorld and that therefore in the new code it is actually the world argument that has been newly added, but still, that makes passing the multiworld redundant.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fixed now

def place_boss(world, player: int, boss: str, location: str, level: Optional[str]) -> None:
if location == 'Ganons Tower' and world.mode[player] == 'inverted':
def place_boss(multiworld, world, player: int, boss: str, location: str, level: Optional[str]) -> None:
if location == 'Ganons Tower' and multiworld.mode[player] == 'inverted':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I agree, with el-u's comment. It'd be better to either pass multiworld+player or world, not both.)
Here we could do world.multiworld.mode and once options are part of world, this can be simplified.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fixed now

# will either be an int or a lower case string with ';' between options
boss_shuffle: Union[str, int] = world.boss_shuffle[player].value
boss_shuffle: Union[str, int] = multiworld.boss_shuffle[player].value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above and also the random might go away when/if we fade out non-slot-random? multiworld is only required for random and the one option, so you could capture both from world.multiworld at the top.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fixed now

if remaining_boss_locations:
raise Exception("Unfilled boss locations!")
else:
raise FillError(f"Could not find boss shuffle mode {boss_shuffle}")


def place_where_possible(world, player: int, boss: str, boss_locations) -> Tuple[List[Tuple[str, str]], List[str]]:
def place_where_possible(multiworld, world, player: int, boss: str, boss_locations) -> Tuple[List[Tuple[str, str]], List[str]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we only pass it down to the next stage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fixed now

# Most to least restrictive order
boss_locations = boss_location_table.copy()
world.random.shuffle(boss_locations)
multiworld.random.shuffle(boss_locations)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only use multiworld here for random. see the other comment about random

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am keeping this intentionally like this for now.

@@ -279,26 +279,26 @@ def apply_random_sprite_on_event(rom: LocalRom, sprite, local_random, allow_rand
rom.write_bytes(0x307078 + (i * 0x8000), sprite.glove_palette)


def patch_enemizer(world, player: int, rom: LocalRom, enemizercli, output_directory):
def patch_enemizer(multiworld, world, player: int, rom: LocalRom, enemizercli, output_directory):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either world = multiworld.worlds[player] at the top or just pass world.

In general, I think the nicer design is to lay out functions as if they were members of the one alttp world (where that makes sense). I.e. make it work the same as generate_output.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fixed now

@Berserker66
Copy link
Member Author

by pure blind luck this might actually fix https://discord.com/channels/731205301247803413/731213907380666488/1104187582574768289 so I guess I need to clean this up now.

@Berserker66
Copy link
Member Author

So originally I had no intention of merging this for 0.4.1, as I didn't think it was adressing any bugs, but it might fix the above mentioned problem and it also fixes that LttP dungeon fill was considering OoT dungeons, fortunately not actually filling them due to logic, but still wasting time on checking them for viability.

if location.parent_region.dungeon:

if getattr(location.parent_region, "dungeon", None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't isinstance(location.parent_region, OOTRegion) and location.parent_region.dungeon be a better fix for all of these?
The current fix looks as if it can break again if an unrelated world had a "dungeon" attr on its regions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question for @espeon65536, I went for this approach as for the current case, it just assumes that dungeon then has a .name, which for LttP is the case, making it work crossworld. So I preserved the current cross-game dungeon awareness of the original code.

Copy link
Member

@black-sliver black-sliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rolled a couple of lttp seeds and didn't see any extra crashes - I did not test OoT.

@Berserker66
Copy link
Member Author

This was in the Async Gen branch, so crashes with OoT we should have seen.

@Berserker66 Berserker66 merged commit c845303 into main May 20, 2023
@Berserker66 Berserker66 deleted the lttp_free_core_boss_dungeon branch May 20, 2023 17:57
Joethepic added a commit to Joethepic/Archipelago that referenced this pull request Jun 5, 2023
* Added undertale world files

* Tried to fix generation

* Fixed generation of Undertale

* added Undertale Client

* Finished making everything

* fixed an item being in the wrong location

* Fixed having same item ids as another game

* Fixed some duplicate item ids and removed a connection that might cause problems

* Added partially automatic patching of Undertale

* fixed not building the client

* Made changes to Undertale AP

* Added an option to remove Temy Armor from the Undertale pool

* updated the undertale patch

* Added the setups folder to gitignore

* updated the undertale patch

* Made the plot be location based items

* Fixed items that have a negative id

* Made changes and additions to Undertale

* Added features to Undertale

* Added Soul Hunt to Undertale

* Fixed the Undertale rules

* Fixed another bug

* Forgot to fix this Undertale

* Added missing client variables

* Made UndertaleClient not have copies of CommonClient

* fixed hotland logic rules for Undertale

* Added deathlink

* Fixed some stuff with deathlink

* Updated the Undertale patch

* Fixed deathlink and local items

* Fixed deathlink again in undertale

* Fixed a permission error bug with opening files

* Made online mode and deathlink a toggle command

* Added Progressive Plot to undertale

* Updated the patch for Undertale

* Added LV rando to Undertale

* hopefully made Undertale online mode more stable

* Fixed LOVE rando not actually getting told to Undertale

* Added a secret feature to Undertale

* Added locations for Undertale plot

* Added All Routes setting to Undertale

* Fixed Undertale rules

* Added Area rando to Undertale AP

* Fixed a crash in Undertale with starting a new save from nothing

* Added stats rando

* Almost fixed Undertale generation

* Fixed Undertale Stat Rando

* Fixed one thing with undertale stat rando

* Added progressive weapons and armor to Undertale

* Made progressive plot change based on area

* Undertale: Updated the patch

* Fixed some things with the Undertale Client

* Fixed a bunch of stuff with Undertale

* attempt at fix

* True Fix Undertale

* Wow, fixed Undertale

* Fixed stuff with Undertale, and made some items marked as useful

* Updated the patch for Undertale

* Fixed some stuff with Undertale ap

* Finally made Undertale have an auto patch feature

* Added docs to Undertale

* Fixed something with the auto patching of undertale

* Actually got the docs right for Undertale

* Fixed the Docs for Undertale

* Changed gold amount

* Fixed data_version for Undertale

* Fixed some stuff with Undertale

* Fixed some Undertale stuff

* Fixed the Undertale init.py file

* Fixed some generation errors with Undertale

* Fixed the Undertale Client freezing

* Made the auto patcher create the Custom Sprites folder

* Updated Undertale

* Fixed Undertale bugs

* Made some changes to UndertaleClient

* Fixed some stuff

* Fixed some Undertale bugs

* Fixed Undertale AP bugs

* Final changes

* Changed docs some, and fixed a bug with photoshop flowey

* Some more fixes

* Made a change to a line in UT docs

* Forgot to fix the data version

* Fixed some Undertale bugs

* Made requested changes

* Fixed it

* Fixed broken stuff

* Fixed pacifist route

* Fixed player hitbox

* Fixed some stuff with clearing files

* Fully made Undertale work as an apworld file

* Actually fixed undertale client

* Forgot to update the patch

* fixed some stuff

* Actually updated the patch

* Made suggested changes

* Quality of life change

* Updated the Undertale Client launcher component to use the new method

* Made requested changes, and removed unused install argument

* Missed two lines with the removal of the unused install argument

* KH2: AntipointReset (ArchipelagoMW#1815)

* Core: skip ModuleUpdate in subprocess

* ALttP: fix dungeon fill failures properly (ArchipelagoMW#1812)

* Blasphemous: Fixed logic errors in WotHP

* CI: add a workflow to show flake8/mypy violations in modified files of a PR (ArchipelagoMW#1513)

* CI: add a workflow to show flake8 violations in modified files of a PR

* modify a file to trigger the lint check

* CI: add a workflow to show mypy violations in modified files of a PR

* modify a file to trigger the type check

* Split flake8 and mypy into two parallel jobs; run a variant of the workflow on push event; modify a file to trigger the push workflow

* fail the task if there are syntax errors; remove old lint workflow

* LADX: Add --no-magpie argument for disabling magpie bridge (ArchipelagoMW#1788)

* Subnautica: move mod exports to own module

* Main: add __all__ and change wrong imports (ArchipelagoMW#1824)

* Main: add __all__ and change wrong imports

* Adjusters: fix __version__ import

* Logging: make sure level is applied for websockets

* Core: update modules

* LttP: deterministic shop_shuffle

* LttP: extract Dungeon and Boss from core (ArchipelagoMW#1787)

* Docs: Update world api excluded/priority locations description (ArchipelagoMW#1807)

* Update world api doc

Changed the description of excluded and priority locations to match how they appear in other places such as the options api doc

* Update world api.md

* CI: treat all files as modified on new branches (ArchipelagoMW#1826)

* The Messenger: override start_inventory description (ArchipelagoMW#1695)

* The Messenger: override start_inventory description

* use StartInventoryPool directly

* WebHost: index columns used by landing page.

* WebHost: add game to template export

* Core: log race mode enabled

* DLCQuest: Fix Documentation Broken Link

* [Blasphemous] Various logic fixes (ArchipelagoMW#1830)

This makes a few changes to logic to better match the 1.3 rando's logic. This fixes instances where the wrong items were expected, fixes a typo of "Lorqiana", moves the expert logic on "PotSS: Second area ledge" to only apply if on expert, and adds a new route to "DC: Mea Culpa altar" via Linen of Golden Thread + Three Gnarled Tongues

* [SM] Minor update to link in Options.py (ArchipelagoMW#1831)

* Core: clean up BaseClasses a bit (ArchipelagoMW#1731)

* WebHost: use Py3.11 compatible ponyorm

* LttP: fix patching crash if old always_apply adjuster settings were applied

* Stardew valley: Fix package and imports for apworld linux (ArchipelagoMW#1842)

- Fix csv load to use explicitly imported self package instead of keyword __package__
- Fix init.py having a relative import to outside of the apworld

* Wargroove: Fixed commander.json file never being closed by the mod (ArchipelagoMW#1841)

The Wargroove mod didn't close the commander.json's file handle. The Wargroove mod will now close that file handle. The change for the mod can be viewed here: FlySniper/WargrooveArchipelagoMod@fc9aeb3
The change can be verified as present in this repository by viewing the binary data in the modAssets.dat file and searching for "commander.json"

* SMZ3 decoding fix (ArchipelagoMW#1847)

* Zillion: cache key includes gun requirement (ArchipelagoMW#1846)

The key for the logic cache was missing some important information, so it was yielding a cache hit when it should have been a miss.

---------

Co-authored-by: jonloveslegos <[email protected]>
Co-authored-by: Mewlif <[email protected]>
Co-authored-by: Fabian Dill <[email protected]>
Co-authored-by: JaredWeakStrike <[email protected]>
Co-authored-by: Fabian Dill <[email protected]>
Co-authored-by: espeon65536 <[email protected]>
Co-authored-by: Exempt-Medic <[email protected]>
Co-authored-by: el-u <[email protected]>
Co-authored-by: Cybrou <[email protected]>
Co-authored-by: black-sliver <[email protected]>
Co-authored-by: alwaysintreble <[email protected]>
Co-authored-by: axe-y <[email protected]>
Co-authored-by: ScootyPuffJr1 <[email protected]>
Co-authored-by: agilbert1412 <[email protected]>
Co-authored-by: FlySniper <[email protected]>
Co-authored-by: lordlou <[email protected]>
Co-authored-by: Doug Hoskisson <[email protected]>
kindasneaki pushed a commit to kindasneaki/Archipelago that referenced this pull request Jun 28, 2023
FlySniper pushed a commit to FlySniper/Archipelago that referenced this pull request Nov 14, 2023
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants