From: Christian Heller Date: Wed, 9 Dec 2020 04:44:18 +0000 (+0100) Subject: Add attempt to wear bottle on head. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7B%20card_id%20%7D%7D/delete?a=commitdiff_plain;h=eadcddf7699d5df683d544531b441332d79b6661;p=plomrogue2 Add attempt to wear bottle on head. --- 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)