Skip to content

Commit 4b841e0

Browse files
authored
Merge pull request #1 from Alchav/The-Legend-of-Zelda-AP
Some fixes
2 parents c0b7bae + 2982289 commit 4b841e0

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

worlds/tloz/Items.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ItemData(typing.NamedTuple):
7373
"Triforce Fragment": 8,
7474
"Small Key": 45,
7575
"Bomb": 24,
76-
"Five Rupees": 18,
76+
"Five Rupees": 19,
7777
"Silver Arrow": 2,
7878
"Rupee": 0,
7979
"Fairy": 6,

worlds/tloz/__init__.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from worlds.AutoWorld import World, WebWorld
1414
from worlds.generic.Rules import add_rule, set_rule, forbid_item
1515

16+
1617
class TLoZWeb(WebWorld):
1718
theme = "stone"
1819
setup = Tutorial(
@@ -74,7 +75,7 @@ def __init__(self, world: MultiWorld, player: int):
7475
self.levels = None
7576

7677
def create_item(self, name: str):
77-
return TLoZItem(name, ItemClassification.progression, self.item_name_to_id[name], self.player)
78+
return TLoZItem(name, item_table[name].classification, self.item_name_to_id[name], self.player)
7879

7980
def create_event(self, event: str):
8081
return TLoZItem(event, ItemClassification.progression, None, self.player)
@@ -165,9 +166,10 @@ def create_items(self):
165166
if item_name == starting_weapon: # To remove the extra Sword if that's our weapon
166167
item_amounts[item_name] -= 1
167168
if self.multiworld.TriforceLocations[self.player] > 0 or item_name != "Triforce Fragment":
168-
i = 0
169169
for i in range(0, item_amounts[item_name]):
170170
self.multiworld.itempool.append(self.create_item(item_name))
171+
if item_name == "Bomb":
172+
self.multiworld.itempool[-1].classification = ItemClassification.progression
171173
else:
172174
level = 1
173175
for i in range(0, item_amounts[item_name]):
@@ -177,7 +179,8 @@ def create_items(self):
177179
).place_locked_item(self.multiworld.create_item(item_name, self.player))
178180
level = level + 1
179181
else:
180-
self.multiworld.itempool.append(self.create_item(item_name))
182+
if item_name != starting_weapon:
183+
self.multiworld.itempool.append(self.create_item(item_name))
181184

182185
def set_rules(self):
183186
# Boss events for a nicer spoiler log playthrough
@@ -341,10 +344,6 @@ def set_rules(self):
341344
lambda state: state.has_group("candles", self.player) or
342345
state.has("Bomb", self.player))
343346

344-
345-
set_rule(self.multiworld.get_region("Menu", self.player), lambda state: True)
346-
set_rule(self.multiworld.get_region("Overworld", self.player), lambda state: True)
347-
348347
def generate_basic(self):
349348
ganon = self.multiworld.get_location("Ganon", self.player)
350349
ganon.place_locked_item(self.create_event("Triforce of Power"))
@@ -356,6 +355,7 @@ def generate_basic(self):
356355

357356
self.multiworld.completion_condition[self.player] = lambda state: state.has("Rescued Zelda!", self.player)
358357

358+
359359
def apply_base_patch(self, rom_data):
360360
# Remove Triforce check for recorder so you can always warp.
361361
rom_data[0x60CC:0x60CF] = bytearray([0xA9, 0xFF, 0xEA])
@@ -498,6 +498,9 @@ def modify_multidata(self, multidata: dict):
498498
new_name = base64.b64encode(bytes(self.rom_name)).decode()
499499
multidata["connect_names"][new_name] = multidata["connect_names"][self.multiworld.player_name[self.player]]
500500

501+
def get_filler_item_name(self) -> str:
502+
filler_items = [item for item in item_table if item_table[item].classification == ItemClassification.filler]
503+
return self.multiworld.random.choice(filler_items)
501504

502505
class TLoZItem(Item):
503506
game = 'The Legend of Zelda'

0 commit comments

Comments
 (0)