diff options
Diffstat (limited to 'apworld/rules.py')
-rw-r--r-- | apworld/rules.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apworld/rules.py b/apworld/rules.py index 0bff056..6186637 100644 --- a/apworld/rules.py +++ b/apworld/rules.py | |||
@@ -32,6 +32,21 @@ def lingo2_can_satisfy_requirements(state: CollectionState, reqs: AccessRequirem | |||
32 | for subjunction in reqs.or_logic): | 32 | for subjunction in reqs.or_logic): |
33 | return False | 33 | return False |
34 | 34 | ||
35 | if reqs.complete_at is not None: | ||
36 | completed = 0 | ||
37 | checked = 0 | ||
38 | for possibility in reqs.possibilities: | ||
39 | checked += 1 | ||
40 | if lingo2_can_satisfy_requirements(state, possibility, world): | ||
41 | completed += 1 | ||
42 | if completed >= reqs.complete_at: | ||
43 | break | ||
44 | elif len(reqs.possibilities) - checked + completed < reqs.complete_at: | ||
45 | # There aren't enough remaining possibilities for the check to pass. | ||
46 | return False | ||
47 | if completed < reqs.complete_at: | ||
48 | return False | ||
49 | |||
35 | return True | 50 | return True |
36 | 51 | ||
37 | def make_location_lambda(reqs: AccessRequirements, world: "Lingo2World") -> Callable[[CollectionState], bool]: | 52 | def make_location_lambda(reqs: AccessRequirements, world: "Lingo2World") -> Callable[[CollectionState], bool]: |