Add ganon triforce hunt (#117)

* Add ganon triforce hunt

* Add self to license

* Correction of help message for Local Ganon Triforce Hunt.

* if 'triforcehunt in world.goal[player]:
This commit is contained in:
CaitSith2
2020-06-26 07:18:53 -07:00
committed by GitHub
parent 46038830c3
commit 545bb8023c
11 changed files with 44 additions and 20 deletions

View File

@@ -124,7 +124,7 @@ difficulties = {
def generate_itempool(world, player):
if world.difficulty[player] not in ['normal', 'hard', 'expert']:
raise NotImplementedError(f"Diffulty {world.difficulty[player]}")
if world.goal[player] not in {'ganon', 'pedestal', 'dungeons', 'triforcehunt', 'localtriforcehunt', 'crystals'}:
if world.goal[player] not in {'ganon', 'pedestal', 'dungeons', 'triforcehunt', 'localtriforcehunt', 'ganontriforcehunt', 'localganontriforcehunt', 'crystals'}:
raise NotImplementedError(f"Goal {world.goal[player]}")
if world.mode[player] not in {'open', 'standard', 'inverted'}:
raise NotImplementedError(f"Mode {world.mode[player]}")
@@ -142,9 +142,8 @@ def generate_itempool(world, player):
region = world.get_region('Light World', player)
loc = Location(player, "Murahdahla", parent=region)
loc.access_rule = lambda state: state.item_count('Triforce Piece', player) + state.item_count('Power Star',
player) >= \
state.world.treasure_hunt_count[player]
loc.access_rule = lambda state: state.has_triforce_pieces(state.world.treasure_hunt_count[player], player)
region.locations.append(loc)
world.dynamic_locations.append(loc)
@@ -261,7 +260,7 @@ def generate_itempool(world, player):
random.shuffle(nonprogressionitems)
triforce_pieces = world.triforce_pieces_available[player]
if world.goal[player] in {'triforcehunt', 'localtriforcehunt'} and triforce_pieces > 30:
if 'triforcehunt' in world.goal[player] and triforce_pieces > 30:
progressionitems += [ItemFactory("Triforce Piece", player)] * (triforce_pieces - 30)
nonprogressionitems = nonprogressionitems[(triforce_pieces-30):]
@@ -510,7 +509,7 @@ def get_pool_core(world, player: int):
pool.extend(diff.timedohko)
extraitems -= len(diff.timedohko)
clock_mode = 'countdown-ohko'
if goal in {'triforcehunt', 'localtriforcehunt'}:
if 'triforcehunt' in goal:
while len(diff.triforcehunt) > world.triforce_pieces_available[player]:
diff.triforcehunt.pop()
pool.extend(diff.triforcehunt)
@@ -643,8 +642,7 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s
treasure_hunt_count = max(min(customitemarray[67], 99), 1) #To display, count must be between 1 and 99.
treasure_hunt_icon = 'Triforce Piece'
# Ensure game is always possible to complete here, force sufficient pieces if the player is unwilling.
if (customitemarray[66] < treasure_hunt_count) and (goal in {'triforcehunt', 'localtriforcehunt'}) and (
customitemarray[68] == 0):
if (customitemarray[66] < treasure_hunt_count) and ('triforcehunt' in goal) and (customitemarray[68] == 0):
extrapieces = treasure_hunt_count - customitemarray[66]
pool.extend(['Triforce Piece'] * extrapieces)
itemtotal = itemtotal + extrapieces