Files
dockipelago/worlds/ff12_open_world/RuleLogic.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

50 lines
1.7 KiB
Python

from BaseClasses import CollectionState, Callable
from typing import List
from typing import List
from .Items import item_data_table
from BaseClasses import CollectionState
def state_has_at_least(possible: List[bool], count: int) -> bool:
# Returns true if at least count of the possible are true
return possible.count(True) >= count
def item_is_category(item_name : str, category : str) -> bool:
if item_name not in item_data_table:
return False
return item_data_table[item_name].category == category
def state_has_category(state : CollectionState, player : int, category: str, count: int = 1) -> bool:
category_possible = [item_is_category(item, category) for item in state.prog_items[player]]
return state_has_at_least(category_possible, count)
def get_chara_count(state: CollectionState, player: int) -> int:
count = 0
if state.has("Vaan", player):
count += 1
if state.has("Balthier", player):
count += 1
if state.has("Fran", player):
count += 1
if state.has("Basch", player):
count += 1
if state.has("Ashe", player):
count += 1
if state.has("Penelo", player):
count += 1
if state.has("Guest", player):
count += 1
return count
def state_has_characters(state: CollectionState, difficulty: int, player: int) -> bool:
chara_count = get_chara_count(state, player)
if difficulty >= 7:
return chara_count >= 6 and state.has("Second Board", player)
if difficulty >= 5:
return chara_count >= 5 and state.has("Second Board", player)
if difficulty >= 4:
return chara_count >= 4
if difficulty >= 3:
return chara_count >= 3
return True