Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a better error message for the incompatibility between Scarce/Minimal and high heart win conditions #2182

Open
wants to merge 2 commits into
base: Dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import copy
import json
import logging
import math
import os
import random
from collections import OrderedDict, defaultdict
Expand Down Expand Up @@ -55,6 +56,24 @@ def __init__(self, world_id: int, settings: Settings, resolve_randomized_setting
self.settings: Settings = settings
self.distribution: WorldDistribution = settings.distribution.world_dists[world_id]

# errors for setting incompatibilities not yet caught by the GUI, see also https://github.com/OoTRandomizer/OoT-Randomizer/issues/1827
required_hearts = 0
if settings.lacs_condition == 'hearts':
required_hearts = max(required_hearts, settings.lacs_hearts)
if settings.bridge == 'hearts':
required_hearts = max(required_hearts, settings.bridge_hearts)
if settings.shuffle_ganon_bosskey == 'hearts':
required_hearts = max(required_hearts, settings.ganon_bosskey_hearts)
available_hearts = {
'ludicrous': 20,
'plentiful': 20,
'balanced': 20,
'scarce': settings.starting_hearts + 9 - math.ceil((settings.starting_hearts - 3) / 2),
'minimal': settings.starting_hearts,
}[settings.item_pool_value]
if required_hearts > available_hearts:
raise ValueError(f"Not enough heart pieces/containers in item pool for win conditions ({available_hearts} available but {required_hearts} required). Decrease the number of required hearts or increase the item pool.")

# rename a few attributes...
self.keysanity: bool = settings.shuffle_smallkeys in ('keysanity', 'remove', 'any_dungeon', 'overworld', 'regional')
self.shuffle_silver_rupees = settings.shuffle_silver_rupees != 'vanilla'
Expand Down
Loading