LADX: Fix being forced to farm for money, fix set iteration (#1924)
This commit is contained in:
parent
b6e78bd1a3
commit
153125a5ea
|
@ -199,11 +199,11 @@ links_awakening_items = [
|
|||
ItemData(ItemName.BIRD_KEY, "BIRD_KEY", ItemClassification.progression),
|
||||
ItemData(ItemName.SLIME_KEY, "SLIME_KEY", ItemClassification.progression),
|
||||
ItemData(ItemName.GOLD_LEAF, "GOLD_LEAF", ItemClassification.progression),
|
||||
ItemData(ItemName.RUPEES_20, "RUPEES_20", ItemClassification.filler),
|
||||
ItemData(ItemName.RUPEES_50, "RUPEES_50", ItemClassification.useful),
|
||||
ItemData(ItemName.RUPEES_20, "RUPEES_20", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.RUPEES_50, "RUPEES_50", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.RUPEES_100, "RUPEES_100", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.RUPEES_200, "RUPEES_200", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.RUPEES_500, "RUPEES_500", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.RUPEES_200, "RUPEES_200", ItemClassification.progression),
|
||||
ItemData(ItemName.RUPEES_500, "RUPEES_500", ItemClassification.progression),
|
||||
ItemData(ItemName.SEASHELL, "SEASHELL", ItemClassification.progression_skip_balancing),
|
||||
ItemData(ItemName.MESSAGE, "MESSAGE", ItemClassification.filler),
|
||||
ItemData(ItemName.GEL, "GEL", ItemClassification.trap),
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
from ..assembler import ASM
|
||||
|
||||
|
||||
# Patches the max rupee count to be 9999
|
||||
# works, but (1) needs testing at 9999
|
||||
# (2) needs GUI rendering support code
|
||||
def patchMaxRupees(rom):
|
||||
rom.patch(0x02, 0x6296 - 0x4000, "09", "63")
|
||||
|
||||
rom.patch(0x02, 0x6292 - 0x4000, "0A", "64")
|
||||
# noop out the cp to 0x10, we want to instead just check the daa overflow
|
||||
rom.patch(0x02, 0x625C - 0x4000, "FE1038", "000030")
|
||||
rom.patch(0x02, 0x6261 - 0x4000, "09", "99")
|
||||
|
||||
def fixShop(rom):
|
||||
# Move shield visuals to the 2nd slot, and arrow to 3th slot
|
||||
rom.patch(0x04, 0x3732 + 22, "986A027FB2B098AC01BAB1", "9867027FB2B098A801BAB1")
|
||||
|
|
|
@ -88,12 +88,6 @@ def can_farm_rupees(state: CollectionState, player: int) -> bool:
|
|||
return has_free_weapon(state, player) and (state.has("Can Play Trendy Game", player=player) or state.has("RAFT", player=player))
|
||||
|
||||
|
||||
def get_credits(state: CollectionState, player: int):
|
||||
if can_farm_rupees(state, player):
|
||||
return 999999999
|
||||
return state.prog_items["RUPEES", player]
|
||||
|
||||
|
||||
class LinksAwakeningRegion(Region):
|
||||
dungeon_index = None
|
||||
ladxr_region = None
|
||||
|
@ -127,8 +121,11 @@ class GameStateAdapater:
|
|||
return self.state.has(item, self.player)
|
||||
|
||||
def get(self, item, default):
|
||||
# Don't allow any money usage if you can't get back wasted rupees
|
||||
if item == "RUPEES":
|
||||
return get_credits(self.state, self.player)
|
||||
if can_farm_rupees(self.state, self.player):
|
||||
return self.state.prog_items["RUPEES", self.player]
|
||||
return 0
|
||||
elif item.endswith("_USED"):
|
||||
return 0
|
||||
else:
|
||||
|
|
|
@ -83,8 +83,8 @@ class LinksAwakeningWorld(World):
|
|||
player_options = None
|
||||
|
||||
rupees = {
|
||||
ItemName.RUPEES_20: 0,
|
||||
ItemName.RUPEES_50: 0,
|
||||
ItemName.RUPEES_20: 20,
|
||||
ItemName.RUPEES_50: 50,
|
||||
ItemName.RUPEES_100: 100,
|
||||
ItemName.RUPEES_200: 200,
|
||||
ItemName.RUPEES_500: 500,
|
||||
|
@ -236,21 +236,7 @@ class LinksAwakeningWorld(World):
|
|||
event_location = Location(self.player, "Can Play Trendy Game", parent=trendy_region)
|
||||
trendy_region.locations.insert(0, event_location)
|
||||
event_location.place_locked_item(self.create_event("Can Play Trendy Game"))
|
||||
|
||||
# For now, special case first item
|
||||
FORCE_START_ITEM = True
|
||||
if FORCE_START_ITEM:
|
||||
start_loc = self.multiworld.get_location("Tarin's Gift (Mabe Village)", self.player)
|
||||
if not start_loc.item:
|
||||
possible_start_items = [index for index, item in enumerate(self.multiworld.itempool)
|
||||
if item.player == self.player
|
||||
and item.item_data.ladxr_id in start_loc.ladxr_item.OPTIONS]
|
||||
|
||||
index = self.multiworld.random.choice(possible_start_items)
|
||||
start_item = self.multiworld.itempool.pop(index)
|
||||
start_loc.place_locked_item(start_item)
|
||||
|
||||
|
||||
|
||||
self.dungeon_locations_by_dungeon = [[], [], [], [], [], [], [], [], []]
|
||||
for r in self.multiworld.get_regions():
|
||||
if r.player != self.player:
|
||||
|
@ -267,12 +253,28 @@ class LinksAwakeningWorld(World):
|
|||
# Properly fill locations within dungeon
|
||||
location.dungeon = r.dungeon_index
|
||||
|
||||
def force_start_item(self):
|
||||
start_loc = self.multiworld.get_location("Tarin's Gift (Mabe Village)", self.player)
|
||||
if not start_loc.item:
|
||||
possible_start_items = [index for index, item in enumerate(self.multiworld.itempool)
|
||||
if item.player == self.player
|
||||
and item.item_data.ladxr_id in start_loc.ladxr_item.OPTIONS and not item.location]
|
||||
if possible_start_items:
|
||||
index = self.multiworld.random.choice(possible_start_items)
|
||||
start_item = self.multiworld.itempool.pop(index)
|
||||
start_loc.place_locked_item(start_item)
|
||||
|
||||
|
||||
def get_pre_fill_items(self):
|
||||
return self.pre_fill_items
|
||||
|
||||
def pre_fill(self) -> None:
|
||||
allowed_locations_by_item = {}
|
||||
|
||||
# For now, special case first item
|
||||
FORCE_START_ITEM = True
|
||||
if FORCE_START_ITEM:
|
||||
self.force_start_item()
|
||||
|
||||
# Set up filter rules
|
||||
|
||||
|
@ -284,7 +286,7 @@ class LinksAwakeningWorld(World):
|
|||
# Do dungeon specific things
|
||||
for dungeon_index in range(0, 9):
|
||||
# set up allow-list for dungeon specific items
|
||||
locs = set(self.dungeon_locations_by_dungeon[dungeon_index])
|
||||
locs = set(loc for loc in self.dungeon_locations_by_dungeon[dungeon_index] if not loc.item)
|
||||
for item in self.prefill_original_dungeon[dungeon_index]:
|
||||
allowed_locations_by_item[item] = locs
|
||||
|
||||
|
@ -310,7 +312,8 @@ class LinksAwakeningWorld(World):
|
|||
allowed_locations_by_item[item] = all_dungeon_locs
|
||||
|
||||
# Get the list of locations and shuffle
|
||||
all_dungeon_locs_to_fill = list(all_dungeon_locs)
|
||||
all_dungeon_locs_to_fill = sorted(all_dungeon_locs)
|
||||
|
||||
self.multiworld.random.shuffle(all_dungeon_locs_to_fill)
|
||||
|
||||
# Get the list of items and sort by priority
|
||||
|
@ -414,11 +417,12 @@ class LinksAwakeningWorld(World):
|
|||
for loc in r.locations:
|
||||
if isinstance(loc, LinksAwakeningLocation):
|
||||
assert(loc.item)
|
||||
|
||||
# If we're a links awakening item, just use the item
|
||||
if isinstance(loc.item, LinksAwakeningItem):
|
||||
loc.ladxr_item.item = loc.item.item_data.ladxr_id
|
||||
|
||||
# TODO: if the item name contains "sword", use a sword icon, etc
|
||||
# If the item name contains "sword", use a sword icon, etc
|
||||
# Otherwise, use a cute letter as the icon
|
||||
else:
|
||||
loc.ladxr_item.item = self.guess_icon_for_other_world(loc.item.name)
|
||||
|
|
Loading…
Reference in New Issue