Add pre-messages to shaking cocktails

This commit is contained in:
Howard Abrams 2025-06-19 11:00:23 -07:00
parent b3ce68faca
commit 3e94f45dd0
2 changed files with 26 additions and 9 deletions

View file

@ -71,7 +71,7 @@ class CmdMakeCocktail(MuxCommand):
dest = self.caller dest = self.caller
if self.rhs: if self.rhs:
dest = self.caller.search(self.rhs) dest = self.caller.search(self.rhs)
Cocktail.make(dest, self.lhs) Cocktail.make(dest, self.caller, self.lhs)
class CmdGM(MuxCommand): class CmdGM(MuxCommand):

View file

@ -127,6 +127,7 @@ COCKTAILS = [
"title": "Moonlit Mirage", "title": "Moonlit Mirage",
"type": "cocktail", "type": "cocktail",
"desc": "A shimmering, colorful drink, garnished with glitter and a twist of tart, almost sour fruit.", "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"], "flavors": ["lemon", "tartness", "sweetness"],
"effects": [ "effects": [
"You notice the swirling glitter make a pattern.", "You notice the swirling glitter make a pattern.",
@ -147,6 +148,7 @@ COCKTAILS = [
"title": "Glimmering Gossamer", "title": "Glimmering Gossamer",
"type": "cocktail", "type": "cocktail",
"desc": "A delicate blend of elderflower liqueur and sparkling wine, adorned with a butterfly-shaped ice cube.", "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"], "flavors": ["elderflower"],
"effects": ["The butterfly shaped ice cube just started fluttering, and flew away."] "effects": ["The butterfly shaped ice cube just started fluttering, and flew away."]
}, },
@ -154,6 +156,7 @@ COCKTAILS = [
"title": "Whimsical Willow", "title": "Whimsical Willow",
"type": "cocktail", "type": "cocktail",
"desc": "A herbal infusion of gin, rosemary, and elderberry, served with a sprig of fresh mint and a splash of tonic.", "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"], "flavors": ["fresh mint", "rosemary", "elderberry"],
"effects": [ "effects": [
"Hrm ... did the bartender always have flowers in his hair?", "Hrm ... did the bartender always have flowers in his hair?",
@ -164,17 +167,19 @@ COCKTAILS = [
"title": "Charmed Chalice", "title": "Charmed Chalice",
"type": "cocktail", "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.", "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": [ "effects": [
"Your cocktail glass just changed into a flute for sparkling wine.", "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 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", "title": "Enchanted Elixir",
"type": "cocktail", "type": "cocktail",
"desc": "A deep blue drink with hints of blueberry and a touch of magic, served with a glowing ice sphere.", "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"], "flavors": ["blueberry", "blue"],
"effects": [ "effects": [
"The ice sphere in the glass pulses with light and energy.", "The ice sphere in the glass pulses with light and energy.",
@ -188,6 +193,7 @@ COCKTAILS = [
"title": "Sylvan Serenade", "title": "Sylvan Serenade",
"type": "cocktail", "type": "cocktail",
"desc": "A melodic blend of apple cider and spiced rum, garnished with a cinnamon stick and a slice of star fruit.", "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"], "flavors": ["apple", "cider", "spices", "cinnamon"],
"effects": [ "effects": [
"You hear the song of a distant choir.", "You hear the song of a distant choir.",
@ -198,6 +204,7 @@ COCKTAILS = [
"title": "Brambleberry Bliss", "title": "Brambleberry Bliss",
"type": "cocktail", "type": "cocktail",
"desc": "A sweet and tart mix of brambleberries and gin, served over crushed ice with a sprinkle of edible flowers.", "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"], "flavors": ["brambleberries", "berry", "floral"],
"effects": [ "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.\"", "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", "title": "Twilight Tonic",
"type": "cocktail", "type": "cocktail",
"desc": "A dark, mysterious drink made with blackcurrant and tonic water, served with a slice of lime and a hint of mint.", "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"], "flavors": ["lime", "blackcurrant", "mint"],
"effects": [ "effects": [
"A shadow falls on your face making you look seductively mysterious.", "A shadow falls on your face making you look seductively mysterious.",
@ -220,6 +228,7 @@ COCKTAILS = [
"title": "Bee Knees", "title": "Bee Knees",
"type": "mead", "type": "mead",
"desc": "Slightly fizzy, slightly sweet, served with a wedge of honeycomb.", "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"], "flavors": ["honey", "vanilla"],
"effects": [ "effects": [
"You feel like a dwarf in a tunnel digging a hole. Diggy, diggy hole!", "You feel like a dwarf in a tunnel digging a hole. Diggy, diggy hole!",
@ -254,6 +263,7 @@ COCKTAILS = [
}, },
{ {
"title": "ale", "title": "ale",
"aliases": ["beer"],
"type": "beer", "type": "beer",
"desc": "A malty, only slightly carbonated, opaque beverage with overt herbal notes.", "desc": "A malty, only slightly carbonated, opaque beverage with overt herbal notes.",
"flavors": ["rosemary", "bog myrtle", "yarrow"], "flavors": ["rosemary", "bog myrtle", "yarrow"],
@ -266,6 +276,7 @@ COCKTAILS = [
"title": "red wine", "title": "red wine",
"type": "wine", "type": "wine",
"desc": "A rich glass a blood red color with notes of raspberries and toffee.", "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"], "flavors": ["earthiness", "toffee", "raspberries"],
"effects": [ "effects": [
"Ah, what was the name of the land in the Mud World where you first had this vintage?", "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 fill_amount = 4
sip_amount = 1 sip_amount = 1
def make(owner, name=None): def make(owner, shaker, name=None):
""" """
Create for 'owner', a drink that matches 'name'. Create for 'owner', a drink that matches 'name'.
If name doesn't match, get a random one. If name doesn't match, get a random one.
@ -315,12 +326,17 @@ class Cocktail(Object):
if name: if name:
rx = r".*" + name + r".*" rx = r".*" + name + r".*"
details = [c for c in COCKTAILS 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: if len(details) > 0:
details = details[0] details = details[0]
else: else:
details = random.choice(COCKTAILS) details = random.choice(COCKTAILS)
if not details or details == []:
shaker.msg(f"No match for '{name}'.")
return
drink = spawn({ drink = spawn({
"typeclass": "typeclasses.drinkables.Cocktail", "typeclass": "typeclasses.drinkables.Cocktail",
"key": details.get("title"), "key": details.get("title"),
@ -333,13 +349,14 @@ class Cocktail(Object):
drink.db.amount = Cocktail.fill_amount drink.db.amount = Cocktail.fill_amount
drink.location = owner 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 theroom = drink.location.location
char = owner.db._sdesc or owner.get_display_name(theroom) char = owner.db._sdesc or owner.get_display_name(theroom)
logger.info(drink.db.cocktail_type) msg = pre_msg + \
msg = routput("The << bartender ^ barkeep ^ elf >> << passes ^ slides ^ gives ^ hands >> a {0} to {1}.", routput("The << bartender ^ barkeep ^ elf >> << passes ^ slides ^ gives ^ hands >> a {0} to {1}.",
drink.db.cocktail_type, char) drink.db.cocktail_type, char)
theroom.msg_contents(msg, exclude=owner) theroom.msg_contents(msg, exclude=owner)
def do_drink(self, drinker): def do_drink(self, drinker):