LADX: Add Hints (#1932)
This commit is contained in:
@@ -59,6 +59,8 @@ from .patches.aesthetics import rgb_to_bin, bin_to_rgb
|
||||
|
||||
from .locations.keyLocation import KeyLocation
|
||||
|
||||
from BaseClasses import ItemClassification
|
||||
from ..Locations import LinksAwakeningLocation
|
||||
from ..Options import TrendyGame, Palette, MusicChangeCondition
|
||||
|
||||
|
||||
@@ -238,12 +240,40 @@ def generateRom(args, settings, ap_settings, auth, seed_name, logic, rnd=None, m
|
||||
elif settings.quickswap == 'b':
|
||||
patches.core.quickswap(rom, 0)
|
||||
|
||||
# TODO: hints bad
|
||||
|
||||
world_setup = logic.world_setup
|
||||
|
||||
JUNK_HINT = 0.33
|
||||
RANDOM_HINT= 0.66
|
||||
# USEFUL_HINT = 1.0
|
||||
# TODO: filter events, filter unshuffled keys
|
||||
all_items = multiworld.get_items()
|
||||
our_items = [item for item in all_items if item.player == player_id and item.code is not None and item.location.show_in_spoiler]
|
||||
our_useful_items = [item for item in our_items if ItemClassification.progression in item.classification]
|
||||
def gen_hint():
|
||||
chance = rnd.uniform(0, 1)
|
||||
if chance < JUNK_HINT:
|
||||
return None
|
||||
elif chance < RANDOM_HINT:
|
||||
location = rnd.choice(our_items).location
|
||||
else: # USEFUL_HINT
|
||||
location = rnd.choice(our_useful_items).location
|
||||
|
||||
hints.addHints(rom, rnd, item_list)
|
||||
if location.item.player == player_id:
|
||||
name = "Your"
|
||||
else:
|
||||
name = f"{multiworld.player_name[location.item.player]}'s"
|
||||
|
||||
if isinstance(location, LinksAwakeningLocation):
|
||||
location_name = location.ladxr_item.metadata.name
|
||||
else:
|
||||
location_name = location.name
|
||||
hint = f"{name} {location.item} is at {location_name}"
|
||||
if location.player != player_id:
|
||||
hint += f" in {multiworld.player_name[location.player]}'s world"
|
||||
|
||||
return hint
|
||||
|
||||
hints.addHints(rom, rnd, gen_hint)
|
||||
|
||||
if world_setup.goal == "raft":
|
||||
patches.goal.setRaftGoal(rom)
|
||||
|
||||
Reference in New Issue
Block a user