OoT: trap display rework

Traps from all games now disguise themselves as OoT items
Traps all display "[Player] is a FOOL!" when picked up
This commit is contained in:
espeon65536 2022-05-25 17:52:49 -05:00 committed by Fabian Dill
parent a66b11e6ec
commit 1c231b703a
2 changed files with 12 additions and 12 deletions

View File

@ -1828,7 +1828,6 @@ def get_override_entry(player_id, location):
player_id = 0 if player_id == location.item.player else min(location.item.player, 255) player_id = 0 if player_id == location.item.player else min(location.item.player, 255)
if location.item.game != 'Ocarina of Time': if location.item.game != 'Ocarina of Time':
# This is an AP sendable. It's guaranteed to not be None. # This is an AP sendable. It's guaranteed to not be None.
looks_like_item_id = 0
if location.item.advancement: if location.item.advancement:
item_id = 0xCB item_id = 0xCB
else: else:
@ -1838,7 +1837,8 @@ def get_override_entry(player_id, location):
if None in [scene, default, item_id]: if None in [scene, default, item_id]:
return None return None
if location.item.looks_like_item is not None: if location.item.trap:
item_id = 0x7C # Ice Trap ID, to get "X is a fool" message
looks_like_item_id = location.item.looks_like_item.index looks_like_item_id = location.item.looks_like_item.index
else: else:
looks_like_item_id = 0 looks_like_item_id = 0
@ -2078,15 +2078,15 @@ def place_shop_items(rom, world, shop_items, messages, locations, init_shop_id=F
shop_objs.add(location.item.special['object']) shop_objs.add(location.item.special['object'])
rom.write_int16(location.address1, location.item.index) rom.write_int16(location.address1, location.item.index)
else: else:
if location.item.game != "Ocarina of Time": if location.item.trap:
item_display = location.item.looks_like_item
elif location.item.game != "Ocarina of Time":
item_display = location.item item_display = location.item
if location.item.advancement: if location.item.advancement:
item_display.index = 0xCB item_display.index = 0xCB
else: else:
item_display.index = 0xCC item_display.index = 0xCC
item_display.special = {} item_display.special = {}
elif location.item.looks_like_item is not None:
item_display = location.item.looks_like_item
else: else:
item_display = location.item item_display = location.item
@ -2137,7 +2137,7 @@ def place_shop_items(rom, world, shop_items, messages, locations, init_shop_id=F
else: else:
shop_item_name = item_display.name shop_item_name = item_display.name
if location.item.name == 'Ice Trap': if location.item.trap:
shop_item_name = create_fake_name(shop_item_name) shop_item_name = create_fake_name(shop_item_name)
if len(world.world.worlds) > 1: if len(world.world.worlds) > 1:

View File

@ -567,7 +567,7 @@ class OOTWorld(World):
self.fake_items.extend(item for item in self.itempool if item.index and self.is_major_item(item)) self.fake_items.extend(item for item in self.itempool if item.index and self.is_major_item(item))
if self.ice_trap_appearance in ['junk_only', 'anything']: if self.ice_trap_appearance in ['junk_only', 'anything']:
self.fake_items.extend(item for item in self.itempool if self.fake_items.extend(item for item in self.itempool if
item.index and not self.is_major_item(item) and item.name != 'Ice Trap') item.index and not self.type == 'Shop' and not self.is_major_item(item) and item.name != 'Ice Trap')
# Kill unreachable events that can't be gotten even with all items # Kill unreachable events that can't be gotten even with all items
# Make sure to only kill actual internal events, not in-game "events" # Make sure to only kill actual internal events, not in-game "events"
@ -803,8 +803,8 @@ class OOTWorld(World):
self.hint_data_available.wait() self.hint_data_available.wait()
with i_o_limiter: with i_o_limiter:
# Make ice traps appear as other random items # Make traps appear as other random items
ice_traps = [loc.item for loc in self.get_locations() if loc.item.name == 'Ice Trap'] ice_traps = [loc.item for loc in self.get_locations() if loc.item.trap]
for trap in ice_traps: for trap in ice_traps:
trap.looks_like_item = self.create_item(self.world.slot_seeds[self.player].choice(self.fake_items).name) trap.looks_like_item = self.create_item(self.world.slot_seeds[self.player].choice(self.fake_items).name)