X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=plomrogue%2Ftasks.py;h=8fa3a178067bf4864f929638b79d5a8e4d8bb6d2;hb=d23e0cac52c9ccc215c7c2d8e62ea29c6f7620bf;hp=eca94003d6c8a5a52e3b6f15d13464f188c17d86;hpb=018bb0242ebd2b7e9fde170fae830376dea55e16;p=plomrogue2 diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index eca9400..8fa3a17 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -103,8 +103,20 @@ class Task_DROP(Task): def check(self): if not self.thing.carrying: raise PlayError('nothing to drop') + if self.thing.carrying.type_ == 'Bottle' and self.thing.carrying.full: + for t in [t for t in self.thing.game.things + if t.type_ == 'BottleDeposit' + and t.position == self.thing.position]: + raise PlayError('cannot drop full bottle into bottle deposit') def do(self): + if self.thing.carrying.type_ == 'Bottle' and not self.thing.carrying.full: + for t in [t for t in self.thing.game.things + if t.type_ == 'BottleDeposit' + and t.position == self.thing.position]: + t.accept() + self.thing.game.things.remove(self.thing.carrying) + break self.thing.carrying = None @@ -136,6 +148,7 @@ class Task_INTOXICATE(Task): def do(self): self.thing.carrying.full = False + self.thing.carrying.empty() for c_id in self.thing.game.sessions: if self.thing.game.sessions[c_id]['thing_id'] == self.thing.id_: self.thing.game.io.send('RANDOM_COLORS', c_id)