fix: perf optimization

fix: playthrough calc and drop rules
refactor: using compass_mode for map info
This commit is contained in:
aerinon
2025-12-02 09:46:09 -07:00
parent 0c50e08cdc
commit 3f0c3ed810
6 changed files with 14 additions and 9 deletions

View File

@@ -2279,7 +2279,7 @@ class Location(object):
self.staleness_count = 0
self.locked = False
self.real = not crystal
self.always_allow = lambda item, state: False
self.always_allow = None
self.access_rule = lambda state: True
self.verbose_rule = None
self.item_rule = lambda item: True
@@ -2293,7 +2293,7 @@ class Location(object):
def can_fill(self, state, item, check_access=True):
if not self.valid_multiworld(state, item):
return False
return self.always_allow(state, item) or (self.parent_region.can_fill(item) and self.item_rule(item) and (not check_access or self.can_reach(state)))
return (self.always_allow and self.always_allow(state, item)) or (self.parent_region.can_fill(item) and self.item_rule(item) and (not check_access or self.can_reach(state)))
def valid_multiworld(self, state, item):
if self.type == LocationType.Pot and self.player != item.player:

View File

@@ -137,6 +137,8 @@ def fill_restrictive(world, base_state, locations, itempool, key_pool=None, sing
spot_to_fill = None
item_locations = filter_locations(item_to_place, locations, world, vanilla)
if is_dungeon_item(item_to_place, world):
item_locations = [l for l in item_locations if valid_dungeon_placement(item_to_place, l, world)]
verify(item_to_place, item_locations, maximum_exploration_state, single_player_placement,
perform_access_check, key_pool, world)
for location in item_locations:

View File

@@ -2,9 +2,10 @@
* 1.5.0
* Logic: Fixed vanilla key logic for GT basement
* Logic (Playthrough): Fixed an issue where enemy kill rules were not applied during playthrough calculation. (Thanks Catobat for the catch)
* Enemy Drop: Added "spies" and shadows for hidden enemies when enemy drop shuffled is enabled
* Keysanity/Keydrop Menu for DR:
* Map is no longer required to see key counts for dungeons if not shuffled. This information is available right away in the menu.
* Map key information is now controlled by the Dungeon Chest Counts setting. If set to always on, this information will be available right away in the menu. And will be on the HUD even when the map is not obtained.
* The key counter on the HUD for the current dungeon now accounts for keys from enemies or pots that are from vanilla key locations.
* The first number on the HUD represents all keys collected either in that dungeon or elsewhere.
* The second number on the HUD is the total keys that can be collected either in that dungeon or elsewhere.
@@ -13,3 +14,4 @@
* The second number is how many keys left to find in chests (not those from pots/enemies unless those item pools are enabled)
* Customizer: free_lamp_cone option added. The logic will account for this, and place the lamp without regard to dark rooms.
* Customizer: force_enemy option added that makes all enemies the specified type if possible. There are known gfx glitches in the overworld.
* Optimization: Improved generation performance (Thanks Catobat!)

2
Rom.py
View File

@@ -42,7 +42,7 @@ from source.enemizer.Enemizer import write_enemy_shuffle_settings
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '53a99b36f47fcb81c372d03e3559c590'
RANDOMIZERBASEHASH = '76d6a1915f52950e1b4b6d0fba95296b'
class JsonRom(object):

View File

@@ -996,13 +996,14 @@ def drop_rules(world, player):
for super_tile, enemy_list in data_tables.uw_enemy_table.room_map.items():
for enemy in enemy_list:
if enemy.location:
rule = defeat_rule_single(world, player, enemy, enemy.location.parent_region)
if enemy.location.parent_region.name in special_rules_check:
rule = special_rules_for_region(world, player, enemy.location.parent_region.name,
enemy.location, rule)
true_location = world.get_location(enemy.location.name, player)
rule = defeat_rule_single(world, player, enemy, true_location.parent_region)
if true_location.parent_region.name in special_rules_check:
rule = special_rules_for_region(world, player, true_location.parent_region.name,
true_location, rule)
if rule.rule_lambda is None:
raise Exception(f'Bad rule for enemy drop. Need to inspect this case: {hex(enemy.kind)}')
add_rule_new(enemy.location, rule)
add_rule_new(true_location, rule)
def ow_inverted_rules(world, player):

Binary file not shown.