mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00

* Timespinner: added RisingTides and DadPercent flags * Implemented logic for DadPercent and RisingTides * Fixed TODO's * Logic fixes * Fixed + removed LogicMixins * Fixes * More Fixes * Added UnchainedKeys flag * Fixed available items in pool with UnchainedKeys * Fixed typing callable * Fixed generation failures * More refactorings * Implemented traps * Fixed more typo * Fixed copy paste bug * Fixed teleporter logic * Fixed traps from pool * Fixed pyramid gates bug that causes a crash on connecting * Fixed seed reproduceability * Fixed logic eye for eye spy Now consider warp beacons as starter progression items * Attempt to add tracker icons using table * Replaced table layout with css grid * Fixed tracker + added Timespinner was apworld capatible * Updated archipelago items description * updated URL * Cleared up text * Fixed based on self review of PR * Fixed unit tests * Fixed seed reproduceability when the traps yaml option is not provided * Fixed logic for flooded basement * Implemented Beserkers review result I am not sure why, i guess this is just to make adding future games less conflicting? Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> * Added two new options (thanks to WeffJebster) * Apply suggestions from code review Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Addition review results --------- Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
111 lines
5.0 KiB
Python
111 lines
5.0 KiB
Python
from typing import Union
|
|
from BaseClasses import MultiWorld, CollectionState
|
|
from .Options import is_option_enabled
|
|
from .PreCalculatedWeights import PreCalculatedWeights
|
|
|
|
|
|
class TimespinnerLogic:
|
|
player: int
|
|
|
|
flag_unchained_keys: bool
|
|
flag_eye_spy: bool
|
|
flag_specific_keycards: bool
|
|
pyramid_keys_unlock: Union[str, None]
|
|
present_keys_unlock: Union[str, None]
|
|
past_keys_unlock: Union[str, None]
|
|
time_keys_unlock: Union[str, None]
|
|
|
|
def __init__(self, world: MultiWorld, player: int, precalculated_weights: PreCalculatedWeights):
|
|
self.player = player
|
|
|
|
self.flag_specific_keycards = is_option_enabled(world, player, "SpecificKeycards")
|
|
self.flag_eye_spy = is_option_enabled(world, player, "EyeSpy")
|
|
self.flag_unchained_keys = is_option_enabled(world, player, "UnchainedKeys")
|
|
|
|
if precalculated_weights:
|
|
if self.flag_unchained_keys:
|
|
self.pyramid_keys_unlock = None
|
|
self.present_keys_unlock = precalculated_weights.present_key_unlock
|
|
self.past_keys_unlock = precalculated_weights.past_key_unlock
|
|
self.time_keys_unlock = precalculated_weights.time_key_unlock
|
|
else:
|
|
self.pyramid_keys_unlock = precalculated_weights.pyramid_keys_unlock
|
|
self.present_keys_unlock = None
|
|
self.past_keys_unlock = None
|
|
self.time_keys_unlock = None
|
|
|
|
def has_timestop(self, state: CollectionState) -> bool:
|
|
return state.has_any({'Timespinner Wheel', 'Succubus Hairpin', 'Lightwall', 'Celestial Sash'}, self.player)
|
|
|
|
def has_doublejump(self, state: CollectionState) -> bool:
|
|
return state.has_any({'Succubus Hairpin', 'Lightwall', 'Celestial Sash'}, self.player)
|
|
|
|
def has_forwarddash_doublejump(self, state: CollectionState) -> bool:
|
|
return self.has_upwarddash(state) \
|
|
or (state.has('Talaria Attachment', self.player) and self.has_doublejump(state))
|
|
|
|
def has_doublejump_of_npc(self, state: CollectionState) -> bool:
|
|
return self.has_upwarddash(state) \
|
|
or (state.has('Timespinner Wheel', self.player) and self.has_doublejump(state))
|
|
|
|
def has_fastjump_on_npc(self, state: CollectionState) -> bool:
|
|
return state.has_all({'Timespinner Wheel', 'Talaria Attachment'}, self.player)
|
|
|
|
def has_multiple_small_jumps_of_npc(self, state: CollectionState) -> bool:
|
|
return state.has('Timespinner Wheel', self.player) or self.has_upwarddash(state)
|
|
|
|
def has_upwarddash(self, state: CollectionState) -> bool:
|
|
return state.has_any({'Lightwall', 'Celestial Sash'}, self.player)
|
|
|
|
def has_fire(self, state: CollectionState) -> bool:
|
|
return state.has_any({'Fire Orb', 'Infernal Flames', 'Pyro Ring', 'Djinn Inferno'}, self.player)
|
|
|
|
def has_pink(self, state: CollectionState) -> bool:
|
|
return state.has_any({'Plasma Orb', 'Plasma Geyser', 'Royal Ring'}, self.player)
|
|
|
|
def has_keycard_A(self, state: CollectionState) -> bool:
|
|
return state.has('Security Keycard A', self.player)
|
|
|
|
def has_keycard_B(self, state: CollectionState) -> bool:
|
|
if self.flag_specific_keycards:
|
|
return state.has('Security Keycard B', self.player)
|
|
else:
|
|
return state.has_any({'Security Keycard A', 'Security Keycard B'}, self.player)
|
|
|
|
def has_keycard_C(self, state: CollectionState) -> bool:
|
|
if self.flag_specific_keycards:
|
|
return state.has('Security Keycard C', self.player)
|
|
else:
|
|
return state.has_any({'Security Keycard A', 'Security Keycard B', 'Security Keycard C'}, self.player)
|
|
|
|
def has_keycard_D(self, state: CollectionState) -> bool:
|
|
if self.flag_specific_keycards:
|
|
return state.has('Security Keycard D', self.player)
|
|
else:
|
|
return state.has_any({'Security Keycard A', 'Security Keycard B', 'Security Keycard C', 'Security Keycard D'}, self.player)
|
|
|
|
def can_break_walls(self, state: CollectionState) -> bool:
|
|
if self.flag_eye_spy:
|
|
return state.has('Oculus Ring', self.player)
|
|
else:
|
|
return True
|
|
|
|
def can_kill_all_3_bosses(self, state: CollectionState) -> bool:
|
|
return state.has_all({'Killed Maw', 'Killed Twins', 'Killed Aelana'}, self.player)
|
|
|
|
def has_teleport(self, state: CollectionState) -> bool:
|
|
return self.flag_unchained_keys or state.has('Twin Pyramid Key', self.player)
|
|
|
|
def can_teleport_to(self, state: CollectionState, era: str, gate: str) -> bool:
|
|
if not self.flag_unchained_keys:
|
|
return self.pyramid_keys_unlock == gate
|
|
|
|
if era == "Present":
|
|
return self.present_keys_unlock == gate and state.has("Modern Warp Beacon", self.player)
|
|
elif era == "Past":
|
|
return self.past_keys_unlock == gate and state.has("Timeworn Warp Beacon", self.player)
|
|
elif era == "Time":
|
|
return self.time_keys_unlock == gate and state.has("Mysterious Warp Beacon", self.player)
|
|
else:
|
|
raise Exception("Invallid Era: {}".format(era))
|