X-Git-Url: https://plomlompom.com/repos/?p=plomrogue2-experiments;a=blobdiff_plain;f=new%2Fplomrogue%2Ftasks.py;h=6d67c35b1b088b0bf5b617525530668d8c1acbac;hp=3bc0f56ebf50245ee974ba68bbb8644949245118;hb=97049163acc0844e1656df3f761c9ca612afdeb0;hpb=adbbe8b5526c6d9ae05ca646a5d6da2f347d93c8 diff --git a/new/plomrogue/tasks.py b/new/plomrogue/tasks.py index 3bc0f56..6d67c35 100644 --- a/new/plomrogue/tasks.py +++ b/new/plomrogue/tasks.py @@ -38,12 +38,13 @@ class Task_WAIT(Task): class Task_MOVE(Task): argtypes = 'string:direction' + def get_move_target(self): + return self.thing.world.game.map_geometry.move(self.thing.position, + self.args[0], + self.thing.world.game.map_size) + def check(self): - test_pos = (YX(0,0), - self.thing.world.maps[YX(0,0)]. - move(self.thing.position[1], self.args[0])) - if test_pos == (YX(0,0), None): - raise GameError('would move outside map bounds') + test_pos = self.get_move_target() if self.thing.world.maps[test_pos[0]][test_pos[1]] != '.': raise GameError('%s would move into illegal terrain' % self.thing.id_) for t in self.thing.world.things_at_pos(test_pos): @@ -51,8 +52,7 @@ class Task_MOVE(Task): raise GameError('%s would move into other thing' % self.thing.id_) def do(self): - self.thing.position = YX(0,0), self.thing.world.maps[YX(0,0)].\ - move(self.thing.position[1], self.args[0]) + self.thing.position = self.get_move_target()