Skip to content

Commit

Permalink
Fixed comparison and starting items
Browse files Browse the repository at this point in the history
  • Loading branch information
gaithern committed Jan 8, 2024
1 parent 1e8e671 commit 7160cf3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 7 additions & 6 deletions worlds/lol/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ def has_item(state: CollectionState, player: int, item) -> bool:
def set_rules(multiworld: MultiWorld, player: int, game_mode: str, items: list[str]):
if game_mode == "GameMode(Summoners Rift)":
for item_id in sr_items:
if str(sr_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win Summoners Rift with " + str(sr_items[item_id]), player).access_rule = lambda state, item_id=item_id: has_item(state, player, "SR " + sr_items[item_id])
print(sr_items[item_id])
if "SR " + str(sr_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win Summoners Rift with " + str(sr_items[item_id]), player).access_rule = lambda state, id=item_id: has_item(state, player, "SR " + sr_items[id])
if game_mode == "GameMode(Aram)":
for item_id in aram_items:
if str(aram_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win ARAM with " + str(aram_items[item_id]), player).access_rule = lambda state, item_id=item_id: has_item(state, player, "ARAM " + aram_items[item_id])
if "ARAM " + str(aram_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win ARAM with " + str(aram_items[item_id]), player).access_rule = lambda state, id=item_id: has_item(state, player, "ARAM " + aram_items[id])
if game_mode == "GameMode(Arena)":
for item_id in arena_items:
if str(arena_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win Arena with " + str(arena_items[item_id]), player).access_rule = lambda state, item_id=item_id: has_item(state, player, "ARENA " + arena_items[item_id])
if "ARENA " + str(arena_items[item_id]) in items or len(items) == 0:
multiworld.get_location("Win Arena with " + str(arena_items[item_id]), player).access_rule = lambda state, id=item_id: has_item(state, player, "ARENA " + arena_items[id])

# Win condition.
multiworld.completion_condition[player] = lambda state: state.has_all({"Bronze Rank", "Silver Rank", "Gold Rank", "Platinum Rank", "Emerald Rank", "Diamond Rank"}, player)
9 changes: 8 additions & 1 deletion worlds/lol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ def fill_slot_data(self) -> dict:

def create_items(self):
self.set_item_table()
starting_locations = list(get_locations_by_category("Starting").keys())
starting_items = random.sample([item for item in self.game_item_table if not item.endswith("Rank")], 6)
i = 0
while i < 6:
self.multiworld.get_location(starting_locations[i], self.player).place_locked_item(self.create_item(starting_items[i]))
i = i + 1
item_pool: List[LOLItem] = []
for name in self.game_item_table:
item_pool += [self.create_item(name) for _ in range(0, 1)]
if name not in starting_items:
item_pool += [self.create_item(name) for _ in range(0, 1)]

self.multiworld.itempool += item_pool

Expand Down

0 comments on commit 7160cf3

Please sign in to comment.