Pokemon Emerald: Use `self.player_name` (#3384)
This commit is contained in:
parent
91c89604a5
commit
67cd32b37c
|
@ -174,26 +174,26 @@ class PokemonEmeraldWorld(World):
|
||||||
# In race mode we don't patch any item location information into the ROM
|
# In race mode we don't patch any item location information into the ROM
|
||||||
if self.multiworld.is_race and not self.options.remote_items:
|
if self.multiworld.is_race and not self.options.remote_items:
|
||||||
logging.warning("Pokemon Emerald: Forcing Player %s (%s) to use remote items due to race mode.",
|
logging.warning("Pokemon Emerald: Forcing Player %s (%s) to use remote items due to race mode.",
|
||||||
self.player, self.multiworld.player_name[self.player])
|
self.player, self.player_name)
|
||||||
self.options.remote_items.value = Toggle.option_true
|
self.options.remote_items.value = Toggle.option_true
|
||||||
|
|
||||||
if self.options.goal == Goal.option_legendary_hunt:
|
if self.options.goal == Goal.option_legendary_hunt:
|
||||||
# Prevent turning off all legendary encounters
|
# Prevent turning off all legendary encounters
|
||||||
if len(self.options.allowed_legendary_hunt_encounters.value) == 0:
|
if len(self.options.allowed_legendary_hunt_encounters.value) == 0:
|
||||||
raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) "
|
raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.player_name}) needs to allow at "
|
||||||
"needs to allow at least one legendary encounter when goal is legendary hunt.")
|
"least one legendary encounter when goal is legendary hunt.")
|
||||||
|
|
||||||
# Prevent setting the number of required legendaries higher than the number of enabled legendaries
|
# Prevent setting the number of required legendaries higher than the number of enabled legendaries
|
||||||
if self.options.legendary_hunt_count.value > len(self.options.allowed_legendary_hunt_encounters.value):
|
if self.options.legendary_hunt_count.value > len(self.options.allowed_legendary_hunt_encounters.value):
|
||||||
logging.warning("Pokemon Emerald: Legendary hunt count for Player %s (%s) higher than number of allowed "
|
logging.warning("Pokemon Emerald: Legendary hunt count for Player %s (%s) higher than number of allowed "
|
||||||
"legendary encounters. Reducing to number of allowed encounters.", self.player,
|
"legendary encounters. Reducing to number of allowed encounters.", self.player,
|
||||||
self.multiworld.player_name[self.player])
|
self.player_name)
|
||||||
self.options.legendary_hunt_count.value = len(self.options.allowed_legendary_hunt_encounters.value)
|
self.options.legendary_hunt_count.value = len(self.options.allowed_legendary_hunt_encounters.value)
|
||||||
|
|
||||||
# Require random wild encounters if dexsanity is enabled
|
# Require random wild encounters if dexsanity is enabled
|
||||||
if self.options.dexsanity and self.options.wild_pokemon == RandomizeWildPokemon.option_vanilla:
|
if self.options.dexsanity and self.options.wild_pokemon == RandomizeWildPokemon.option_vanilla:
|
||||||
raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) must "
|
raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.player_name}) must not leave wild "
|
||||||
"not leave wild encounters vanilla if enabling dexsanity.")
|
"encounters vanilla if enabling dexsanity.")
|
||||||
|
|
||||||
# If badges or HMs are vanilla, Norman locks you from using Surf,
|
# If badges or HMs are vanilla, Norman locks you from using Surf,
|
||||||
# which means you're not guaranteed to be able to reach Fortree Gym,
|
# which means you're not guaranteed to be able to reach Fortree Gym,
|
||||||
|
@ -223,7 +223,7 @@ class PokemonEmeraldWorld(World):
|
||||||
|
|
||||||
if self.options.norman_count.value > max_norman_count:
|
if self.options.norman_count.value > max_norman_count:
|
||||||
logging.warning("Pokemon Emerald: Norman requirements for Player %s (%s) are unsafe in combination with "
|
logging.warning("Pokemon Emerald: Norman requirements for Player %s (%s) are unsafe in combination with "
|
||||||
"other settings. Reducing to 4.", self.player, self.multiworld.get_player_name(self.player))
|
"other settings. Reducing to 4.", self.player, self.player_name)
|
||||||
self.options.norman_count.value = max_norman_count
|
self.options.norman_count.value = max_norman_count
|
||||||
|
|
||||||
def create_regions(self) -> None:
|
def create_regions(self) -> None:
|
||||||
|
@ -588,7 +588,7 @@ class PokemonEmeraldWorld(World):
|
||||||
randomize_opponent_parties(self)
|
randomize_opponent_parties(self)
|
||||||
randomize_starters(self)
|
randomize_starters(self)
|
||||||
|
|
||||||
patch = PokemonEmeraldProcedurePatch(player=self.player, player_name=self.multiworld.player_name[self.player])
|
patch = PokemonEmeraldProcedurePatch(player=self.player, player_name=self.player_name)
|
||||||
patch.write_file("base_patch.bsdiff4", pkgutil.get_data(__name__, "data/base_patch.bsdiff4"))
|
patch.write_file("base_patch.bsdiff4", pkgutil.get_data(__name__, "data/base_patch.bsdiff4"))
|
||||||
write_tokens(self, patch)
|
write_tokens(self, patch)
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ class PokemonEmeraldWorld(World):
|
||||||
if self.options.dexsanity:
|
if self.options.dexsanity:
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
spoiler_handle.write(f"\n\nWild Pokemon ({self.multiworld.player_name[self.player]}):\n\n")
|
spoiler_handle.write(f"\n\nWild Pokemon ({self.player_name}):\n\n")
|
||||||
|
|
||||||
species_maps = defaultdict(set)
|
species_maps = defaultdict(set)
|
||||||
for map in self.modified_maps.values():
|
for map in self.modified_maps.values():
|
||||||
|
@ -669,7 +669,7 @@ class PokemonEmeraldWorld(World):
|
||||||
|
|
||||||
def modify_multidata(self, multidata: Dict[str, Any]):
|
def modify_multidata(self, multidata: Dict[str, Any]):
|
||||||
import base64
|
import base64
|
||||||
multidata["connect_names"][base64.b64encode(self.auth).decode("ascii")] = multidata["connect_names"][self.multiworld.player_name[self.player]]
|
multidata["connect_names"][base64.b64encode(self.auth).decode("ascii")] = multidata["connect_names"][self.player_name]
|
||||||
|
|
||||||
def fill_slot_data(self) -> Dict[str, Any]:
|
def fill_slot_data(self) -> Dict[str, Any]:
|
||||||
slot_data = self.options.as_dict(
|
slot_data = self.options.as_dict(
|
||||||
|
|
|
@ -452,7 +452,7 @@ class PokemonEmeraldClient(BizHawkClient):
|
||||||
self.death_counter = times_whited_out
|
self.death_counter = times_whited_out
|
||||||
elif times_whited_out > self.death_counter:
|
elif times_whited_out > self.death_counter:
|
||||||
await ctx.send_death(f"{ctx.player_names[ctx.slot]} is out of usable POKéMON! "
|
await ctx.send_death(f"{ctx.player_names[ctx.slot]} is out of usable POKéMON! "
|
||||||
f"{ctx.player_names[ctx.slot]} whited out!")
|
f"{ctx.player_names[ctx.slot]} whited out!")
|
||||||
self.ignore_next_death_link = True
|
self.ignore_next_death_link = True
|
||||||
self.death_counter = times_whited_out
|
self.death_counter = times_whited_out
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ def write_tokens(world: "PokemonEmeraldWorld", patch: PokemonEmeraldProcedurePat
|
||||||
location.item.name
|
location.item.name
|
||||||
) for trainer in alternates)
|
) for trainer in alternates)
|
||||||
|
|
||||||
player_name_ids: Dict[str, int] = {world.multiworld.player_name[world.player]: 0}
|
player_name_ids: Dict[str, int] = {world.player_name: 0}
|
||||||
item_name_offsets: Dict[str, int] = {}
|
item_name_offsets: Dict[str, int] = {}
|
||||||
next_item_name_offset = 0
|
next_item_name_offset = 0
|
||||||
for i, (flag, item_player, item_name) in enumerate(sorted(location_info, key=lambda t: t[0])):
|
for i, (flag, item_player, item_name) in enumerate(sorted(location_info, key=lambda t: t[0])):
|
||||||
|
@ -208,7 +208,7 @@ def write_tokens(world: "PokemonEmeraldWorld", patch: PokemonEmeraldProcedurePat
|
||||||
struct.pack("<B", 0)
|
struct.pack("<B", 0)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
player_name = world.multiworld.player_name[item_player]
|
player_name = world.multiworld.get_player_name(item_player)
|
||||||
|
|
||||||
if player_name not in player_name_ids:
|
if player_name not in player_name_ids:
|
||||||
# Only space for 50 player names
|
# Only space for 50 player names
|
||||||
|
|
Loading…
Reference in New Issue