diff options
Diffstat (limited to 'apworld/player_logic.py')
| -rw-r--r-- | apworld/player_logic.py | 23 |
1 files changed, 23 insertions, 0 deletions
| diff --git a/apworld/player_logic.py b/apworld/player_logic.py index ce6ae24..4aa481d 100644 --- a/apworld/player_logic.py +++ b/apworld/player_logic.py | |||
| @@ -144,6 +144,29 @@ class AccessRequirements: | |||
| 144 | if resimplify: | 144 | if resimplify: |
| 145 | self.simplify() | 145 | self.simplify() |
| 146 | 146 | ||
| 147 | def get_referenced_rooms(self): | ||
| 148 | result = set(self.rooms) | ||
| 149 | |||
| 150 | for disjunction in self.or_logic: | ||
| 151 | for sub_req in disjunction: | ||
| 152 | result = result.union(sub_req.get_referenced_rooms()) | ||
| 153 | |||
| 154 | for sub_req in self.possibilities: | ||
| 155 | result = result.union(sub_req.get_referenced_rooms()) | ||
| 156 | |||
| 157 | return result | ||
| 158 | |||
| 159 | def remove_room(self, room: str): | ||
| 160 | if room in self.rooms: | ||
| 161 | self.rooms.remove(room) | ||
| 162 | |||
| 163 | for disjunction in self.or_logic: | ||
| 164 | for sub_req in disjunction: | ||
| 165 | sub_req.remove_room(room) | ||
| 166 | |||
| 167 | for sub_req in self.possibilities: | ||
| 168 | sub_req.remove_room(room) | ||
| 169 | |||
| 147 | def __repr__(self): | 170 | def __repr__(self): |
| 148 | parts = [] | 171 | parts = [] |
| 149 | if len(self.items) > 0: | 172 | if len(self.items) > 0: |
