feat: force_enemy feature

feat: rom-side enemy "spies"
This commit is contained in:
aerinon
2025-11-14 09:05:12 -07:00
parent 9847b71a02
commit 923ba14d61
7 changed files with 33 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
import RaceRandom as random
from collections import defaultdict
from Utils import snes_to_pc
from source.dungeon.EnemyList import SpriteType, EnemySprite, sprite_translation
@@ -428,12 +429,16 @@ def randomize_enemies(world, player):
if world.enemy_shuffle[player] != 'none':
data_tables = world.data_tables[player]
custom_uw, custom_ow = {}, {}
enemy_map = world.customizer.get_enemies() if world.customizer else None
if enemy_map and player in enemy_map:
if 'Underworld' in enemy_map[player]:
custom_uw = enemy_map[player]['Underworld']
if 'Overworld' in enemy_map[player]:
custom_ow = enemy_map[player]['Overworld']
if world.force_enemy[player]:
custom_ow = {area_id: {i: world.force_enemy[player] for i, s in enumerate(sprite_list)} for area_id, sprite_list in world.data_tables[player].ow_enemy_table.items()}
custom_uw = {room_id: {i: world.force_enemy[player] for i, s in enumerate(sprite_list)} for room_id, sprite_list in world.data_tables[player].uw_enemy_table.room_map.items()}
else:
enemy_map = world.customizer.get_enemies() if world.customizer else None
if enemy_map and player in enemy_map:
if 'Underworld' in enemy_map[player]:
custom_uw = enemy_map[player]['Underworld']
if 'Overworld' in enemy_map[player]:
custom_ow = enemy_map[player]['Overworld']
randomize_underworld_sprite_sheets(data_tables.sprite_sheets, data_tables, custom_uw)
randomize_underworld_rooms(data_tables, world, player, custom_uw)
randomize_overworld_sprite_sheets(data_tables.sprite_sheets, data_tables, custom_ow)

View File

@@ -655,9 +655,11 @@ def setup_custom_enemy_sheets(custom_enemies, sheets, data_tables, sheet_range,
if key not in requirements:
continue
req = requirements[key]
if isinstance(req, dict):
if isinstance(req, dict) and room_id in req:
req = req[room_id]
if req.static or not req.can_randomize:
else:
req = None
if req and (req.static or not req.can_randomize):
try:
combine_req(sub_groups_choices, req)
except IncompatibleEnemyException: