From 3e94f45dd094954e6e756acf7404dd370e4aca92 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Thu, 19 Jun 2025 11:00:23 -0700 Subject: [PATCH] Add pre-messages to shaking cocktails --- commands/wizards.py | 2 +- typeclasses/drinkables.py | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/commands/wizards.py b/commands/wizards.py index d27c118..01f0af4 100755 --- a/commands/wizards.py +++ b/commands/wizards.py @@ -71,7 +71,7 @@ class CmdMakeCocktail(MuxCommand): dest = self.caller if self.rhs: dest = self.caller.search(self.rhs) - Cocktail.make(dest, self.lhs) + Cocktail.make(dest, self.caller, self.lhs) class CmdGM(MuxCommand): diff --git a/typeclasses/drinkables.py b/typeclasses/drinkables.py index 3af7657..5e02172 100755 --- a/typeclasses/drinkables.py +++ b/typeclasses/drinkables.py @@ -127,6 +127,7 @@ COCKTAILS = [ "title": "Moonlit Mirage", "type": "cocktail", "desc": "A shimmering, colorful drink, garnished with glitter and a twist of tart, almost sour fruit.", + "pre": "The bartender grabs a pixie flying by and shakes the glitter from its wings into the glass.", "flavors": ["lemon", "tartness", "sweetness"], "effects": [ "You notice the swirling glitter make a pattern.", @@ -147,6 +148,7 @@ COCKTAILS = [ "title": "Glimmering Gossamer", "type": "cocktail", "desc": "A delicate blend of elderflower liqueur and sparkling wine, adorned with a butterfly-shaped ice cube.", + "pre": "The bartender uses a butterfly net to catch an ice cube and then places it in the glass.", "flavors": ["elderflower"], "effects": ["The butterfly shaped ice cube just started fluttering, and flew away."] }, @@ -154,6 +156,7 @@ COCKTAILS = [ "title": "Whimsical Willow", "type": "cocktail", "desc": "A herbal infusion of gin, rosemary, and elderberry, served with a sprig of fresh mint and a splash of tonic.", + "pre": "As the bartender hands over the cocktail, the garnish of a sprig of mint grows a long twisting vine that he casually clips off.", "flavors": ["fresh mint", "rosemary", "elderberry"], "effects": [ "Hrm ... did the bartender always have flowers in his hair?", @@ -164,17 +167,19 @@ COCKTAILS = [ "title": "Charmed Chalice", "type": "cocktail", "desc": "A mysterious potion that glows softly, made with enchanted spirits and a hint of honey, served in a chalice that changes shape.", - "flavors": ["honey"], + "pre": "Ghostly apparitions appear in the air, as the bartender grabs one, twists it, to add a drop of ectoplasm to the drink.", + "flavors": ["honey", "uhm...ectoplasm"], "effects": [ "Your cocktail glass just changed into a flute for sparkling wine.", "Your glass has changed shape into a small vase. Good thing the drink is still in it.", - "Your glass has changes shape into a glass bowl, still holding the contents of your drink.", + "Your glass changes shape into a glass bowl, still holding the contents of your drink.", ] }, { "title": "Enchanted Elixir", "type": "cocktail", "desc": "A deep blue drink with hints of blueberry and a touch of magic, served with a glowing ice sphere.", + "pre": "The bartender opens a box that bathes the bar in light. He takes a glowing sphere of ice and garnishes the cocktail before passing it over.", "flavors": ["blueberry", "blue"], "effects": [ "The ice sphere in the glass pulses with light and energy.", @@ -188,6 +193,7 @@ COCKTAILS = [ "title": "Sylvan Serenade", "type": "cocktail", "desc": "A melodic blend of apple cider and spiced rum, garnished with a cinnamon stick and a slice of star fruit.", + "pre": "The bartender plays a flute as the jars and ingredients line up and pour themselves into a cocktail shaker.", "flavors": ["apple", "cider", "spices", "cinnamon"], "effects": [ "You hear the song of a distant choir.", @@ -198,6 +204,7 @@ COCKTAILS = [ "title": "Brambleberry Bliss", "type": "cocktail", "desc": "A sweet and tart mix of brambleberries and gin, served over crushed ice with a sprinkle of edible flowers.", + "pre": "The bartender garnishes the cocktail with a flower pulled from a pot on the bar. The plant immediately wilts and drops away.", "flavors": ["brambleberries", "berry", "floral"], "effects": [ "The flowers floating in the glass whispers to you, \"I'm always getting into trouble. I guess that's because I'm a wild flower.\"", @@ -210,6 +217,7 @@ COCKTAILS = [ "title": "Twilight Tonic", "type": "cocktail", "desc": "A dark, mysterious drink made with blackcurrant and tonic water, served with a slice of lime and a hint of mint.", + "pre": "After the cocktail is complete, the branches above the bar part, and light from the moon shines directly on the glass causing bubbles to form.", "flavors": ["lime", "blackcurrant", "mint"], "effects": [ "A shadow falls on your face making you look seductively mysterious.", @@ -220,6 +228,7 @@ COCKTAILS = [ "title": "Bee Knees", "type": "mead", "desc": "Slightly fizzy, slightly sweet, served with a wedge of honeycomb.", + "pre": "After filling the glass, the bartender takes a bee out of jar, gently squeezes it until vomits a drop of honey to the concoction.", "flavors": ["honey", "vanilla"], "effects": [ "You feel like a dwarf in a tunnel digging a hole. Diggy, diggy hole!", @@ -254,6 +263,7 @@ COCKTAILS = [ }, { "title": "ale", + "aliases": ["beer"], "type": "beer", "desc": "A malty, only slightly carbonated, opaque beverage with overt herbal notes.", "flavors": ["rosemary", "bog myrtle", "yarrow"], @@ -266,6 +276,7 @@ COCKTAILS = [ "title": "red wine", "type": "wine", "desc": "A rich glass a blood red color with notes of raspberries and toffee.", + "pre": "After popping a cork from a bottle, the bartender then empties the bottle into the glass.", "flavors": ["earthiness", "toffee", "raspberries"], "effects": [ "Ah, what was the name of the land in the Mud World where you first had this vintage?", @@ -307,7 +318,7 @@ class Cocktail(Object): fill_amount = 4 sip_amount = 1 - def make(owner, name=None): + def make(owner, shaker, name=None): """ Create for 'owner', a drink that matches 'name'. If name doesn't match, get a random one. @@ -315,12 +326,17 @@ class Cocktail(Object): if name: rx = r".*" + name + r".*" details = [c for c in COCKTAILS - if re.match(rx, c.get("title"), re.IGNORECASE)] + if re.match(rx, c.get("title"), re.IGNORECASE) or + name in c.get("aliases", [])] if len(details) > 0: details = details[0] else: details = random.choice(COCKTAILS) + if not details or details == []: + shaker.msg(f"No match for '{name}'.") + return + drink = spawn({ "typeclass": "typeclasses.drinkables.Cocktail", "key": details.get("title"), @@ -333,13 +349,14 @@ class Cocktail(Object): drink.db.amount = Cocktail.fill_amount drink.location = owner - drink.location.msg(f"You now have a {drink.name}.") + pre_msg = details.get("pre") + " " or "" + drink.location.msg(pre_msg + routput("The << bartender ^ barkeep ^ elf >> << passes ^ slides ^ gives ^ hands >> you a |y{0}|n.", drink.name)) theroom = drink.location.location char = owner.db._sdesc or owner.get_display_name(theroom) - logger.info(drink.db.cocktail_type) - msg = routput("The << bartender ^ barkeep ^ elf >> << passes ^ slides ^ gives ^ hands >> a {0} to {1}.", - drink.db.cocktail_type, char) + msg = pre_msg + \ + routput("The << bartender ^ barkeep ^ elf >> << passes ^ slides ^ gives ^ hands >> a {0} to {1}.", + drink.db.cocktail_type, char) theroom.msg_contents(msg, exclude=owner) def do_drink(self, drinker):