Files
Grinch-AP/worlds/oot/Regions.py
espeon65536 aee0df5359 Ocarina of Time 7.0 (#1277)
## What is this fixing or adding?
- Adds the majority of OoTR 7.0 features:
  - Pot shuffle, Freestanding item shuffle, Crate shuffle, Beehive shuffle
  - Key rings mode
  - Dungeon shortcuts to speed up dungeons
  - "Regional" shuffle for dungeon items
  - New options for shop pricing in shopsanity
  - Expanded Ganon's Boss Key shuffle options
  - Pre-planted beans
  - Improved Chest Appearance Matches Contents mode
  - Blue Fire Arrows
  - Bonk self-damage
  - Finer control over MQ dungeons and spawn position randomization
- Several bugfixes as a result of the update:
  - Items recognized by the server and valid starting items are now in a 1-to-1 correspondence. In particular, starting with keys is now supported.
  - Entrance randomization success rate improved. Hopefully it is now at 100%. 

Co-authored-by: Zach Parks <zach@alliware.com>
2022-12-11 04:11:40 +01:00

80 lines
2.3 KiB
Python

from enum import unique, Enum
from BaseClasses import Region
from .Hints import HintArea
# copied from OoT-Randomizer/Region.py
@unique
class RegionType(Enum):
Overworld = 1
Interior = 2
Dungeon = 3
Grotto = 4
@property
def is_indoors(self):
"""Shorthand for checking if Interior or Dungeon"""
return self in (RegionType.Interior, RegionType.Dungeon, RegionType.Grotto)
# Pretends to be an enum, but when the values are raw ints, it's much faster
class TimeOfDay(object):
NONE = 0
DAY = 1
DAMPE = 2
ALL = DAY | DAMPE
class OOTRegion(Region):
game: str = "Ocarina of Time"
def __init__(self, name: str, type, hint, player: int):
super(OOTRegion, self).__init__(name, type, hint, player)
self._oot_hint = None
self.alt_hint = None
self.price = None
self.time_passes = False
self.provides_time = TimeOfDay.NONE
self.scene = None
self.dungeon = None
self.pretty_name = None
self.font_color = None
self.is_boss_room = False
def get_scene(self):
if self.scene:
return self.scene
elif self.dungeon:
return self.dungeon.name
else:
return None
def can_reach(self, state):
if state.stale[self.player]:
stored_age = state.age[self.player]
state._oot_update_age_reachable_regions(self.player)
state.age[self.player] = stored_age
if state.age[self.player] == 'child':
return self in state.child_reachable_regions[self.player]
elif state.age[self.player] == 'adult':
return self in state.adult_reachable_regions[self.player]
else: # we don't care about age
return self in state.child_reachable_regions[self.player] or self in state.adult_reachable_regions[self.player]
def set_hint_data(self, hint):
if self.dungeon:
self._oot_hint = HintArea.for_dungeon(self.dungeon)
else:
self._oot_hint = HintArea[hint]
self.hint_text = str(self._oot_hint)
# This is too generic of a name to risk not breaking in the future.
# This lets us possibly switch it out later if AP starts using it.
@property
def hint(self):
return self._oot_hint