X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/do_todos?a=blobdiff_plain;f=plomrogue%2Ftasks.py;h=4cf8700b1f5b93473fabb70c3acedf471167667d;hb=1101707a5518de54204fb2f856bdc540ae622991;hp=fced65036f94fa122afd07b9d634a76931c6535a;hpb=a87fff596af07090497fc16c429c4df739f0c3d9;p=plomrogue2 diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index fced650..4cf8700 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -187,6 +187,13 @@ class Task_DROP(Task): class Task_DOOR(Task): + def check(self): + action_radius = list(self.thing.game.map_geometry. + get_neighbors_yxyx(self.thing.position).values()) + if len([t for t in self.thing.game.things if + t.type_ == 'Door' and t.position in action_radius]) == 0: + raise PlayError('not standing next to a door to open/close') + def do(self): action_radius = list(self.thing.game.map_geometry. get_neighbors_yxyx(self.thing.position).values())