diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-12 10:54:14 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-12 10:54:14 -0400 |
| commit | 7426eb86fb2e7313607493becab262fe3115ce7b (patch) | |
| tree | 1667b2af7435bf462dd637070210931a9bef7d93 /apworld/rules.py | |
| parent | 1e899b2135e6e86ee2c9cae994611d63832e4c0a (diff) | |
| download | lingo2-archipelago-7426eb86fb2e7313607493becab262fe3115ce7b.tar.gz lingo2-archipelago-7426eb86fb2e7313607493becab262fe3115ce7b.tar.bz2 lingo2-archipelago-7426eb86fb2e7313607493becab262fe3115ce7b.zip | |
[Apworld] Handle complete_at > 1
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]: |
