1 from plomrogue.errors import PlayError
2 from plomrogue.mapping import YX
10 def __init__(self, thing, args=()):
19 class Task_WAIT(Task):
27 class Task_MOVE(Task):
29 argtypes = 'string:direction'
31 def get_move_target(self):
32 return self.thing.game.map_geometry.move(self.thing.position,
36 test_pos = self.get_move_target()
38 raise PlayError('would move out of map')
39 elif test_pos in [t.position for t in self.thing.game.things]:
40 raise PlayError('would collide with other things')
41 elif self.thing.game.map[test_pos] != '.':
42 raise PlayError('would move into illegal territory')
45 self.thing.position = self.get_move_target()
49 class Task_WRITE(Task):
51 argtypes = 'string:char'
57 self.thing.game.map[self.thing.position] = self.args[0]
61 class Task_FLATTEN_SURROUNDINGS(Task):
68 self.thing.game.map[self.thing.position] = '.'
69 for yx in self.thing.game.map_geometry.get_neighbors(self.thing.position).values():
71 self.thing.game.map[yx] = '.'