From eadcddf7699d5df683d544531b441332d79b6661 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 9 Dec 2020 05:44:18 +0100 Subject: [PATCH] Add attempt to wear bottle on head. --- plomrogue/tasks.py | 14 ++++++++++---- plomrogue/things.py | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 1e6737b..6a88649 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -234,8 +234,8 @@ class Task_WEAR(Task): raise PlayError('carrying nothing to wear') if self.thing.name in self.thing.game.hats: raise PlayError('already wearing a hat') - if self.thing.carrying.type_ != 'Hat': - raise PlayError('can only wear a hat') + if self.thing.carrying.type_ not in {'Hat', 'Bottle'}: + raise PlayError('can not wear the kind of thing you hold') def do(self): if self.thing.name in self.thing.game.hats: @@ -249,10 +249,16 @@ class Task_WEAR(Task): remixer.accept(t) break else: - self.thing.game.hats[self.thing.name] = self.thing.carrying.design + if self.thing.carrying.type_ == 'Bottle': + self.thing.send_msg('CHAT "Your attempt to wear a bottle on ' + 'your head fails."') + self.thing.carrying.sound('BOTTLE', 'SMASH') + elif self.thing.carrying.type_ == 'Hat': + self.thing.game.hats[self.thing.name] =\ + self.thing.carrying.design + self.thing.send_msg('CHAT "You put on a hat."') self.thing.game.remove_thing(self.thing.carrying) self.thing.carrying = None - self.thing.send_msg('CHAT "You put on a hat."') diff --git a/plomrogue/things.py b/plomrogue/things.py index ab54e30..ea0e71c 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -24,6 +24,7 @@ class Thing(ThingBase): protection = '.' commandable = False carried = False + carrying = False def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) -- 2.30.2