117 lines
4.3 KiB
Python
Executable file
117 lines
4.3 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
from typeclasses.objects import Object
|
|
from commands.consumables import CmdSetTeapot, CmdSetCup
|
|
from utils.word_list import routput, choices
|
|
|
|
import random
|
|
|
|
TEA_TYPES = {
|
|
'black': 'a rich, bold and <<malty ^ fragrant ^ almost spicy>> black tea',
|
|
'green': 'a green tea with <<grassy ^ floral ^ vanilla ^ vegetal>> notes',
|
|
'oolong': 'a complex and <<earthy ^ floral>> oolong',
|
|
'matcha': 'a frothy and aromatic matcha of the most vibrant green',
|
|
'white': 'a subtle tea with notes of <<rose ^ berries ^ chamomile flowers>>',
|
|
'pu-erh': 'an earthy, almost mushroom flavored, pu-erh tea',
|
|
'puerh': 'an earthy, almost mushroom flavored, pu-erh tea',
|
|
'barley': 'a nutty herbal infusion of barley with just a hint of smokiness',
|
|
'chaga': 'an earthy, mushroomy chaga infusion',
|
|
'hibiscus': 'a dark red, tart herbal infusion of roselle flowers',
|
|
'chai': 'a spicy chai tea, tempered with milk and sweetness',
|
|
'herbal': 'an herbal infusion of <<chamomile ^ mint ^ chicory root ^ lavender>>',
|
|
'earl': 'a flowery Earl Grey tea',
|
|
'chamomile': 'a relaxing, yet subtle infusion of chamomile flowers that makes you want to go to sleep',
|
|
'mint': 'a blend of peppermint and spearmint to create the ultimate minty herbal infusion',
|
|
'chrysanthemum': 'a lovely, floral infusion of chrysanthemum flowers',
|
|
'dandelion': 'a roasted herbal infusion of dandelions that tastes a bit like coffee',
|
|
'rooibos': 'an almost <<sweet and ^ >> <<woody ^ nutty ^ vanilla-y>> rooibos herbal infusion',
|
|
# Why limit to teas ... sure, this tea pot could make coffee ...
|
|
}
|
|
|
|
FILL_TEA_MSGS = [
|
|
'You fill your <<teacup ^ cup>> with {1}.',
|
|
'You pour <<some ^ >> {0} tea into your <<teacup ^ cup>>.',
|
|
]
|
|
|
|
DRINK_TEA_MSGS = [
|
|
'You take a sip of {0} tea.',
|
|
'You take a sip of {0} tea <<in ^ from>> your <<teacup ^ cup>>.',
|
|
'You <<sip ^ sample ^ drink>> from your <<teacup ^ cup>>.',
|
|
'You savor {1} in your <<teacup ^ cup>>.',
|
|
]
|
|
|
|
EMPTY_TEA_MSGS = [
|
|
'Your <<teacup ^ cup>> is empty. Perhaps you can |gmake|n some |gtea|n?',
|
|
"Your cup certainly doesn't runneth over, as it be quite empty.",
|
|
'Alas, you find your cup devoid of any sort of watery infusion.',
|
|
'You notice your cup is empty.',
|
|
'It appears that you need to refill your tea cup.'
|
|
]
|
|
|
|
|
|
class TeaCup(Object):
|
|
fill_amount = 4
|
|
sip_amount = 1
|
|
|
|
def at_object_creation(self):
|
|
self.cmdset.add_default(CmdSetCup)
|
|
|
|
def do_drink(self, drinker):
|
|
amount = self.db.amount or 0
|
|
tea_type = self.db.tea_type or "tea"
|
|
tea_details = self.db.tea_details
|
|
|
|
if amount > 0:
|
|
self.db.amount = self.db.amount - self.sip_amount
|
|
drinker.msg(choices(DRINK_TEA_MSGS, tea_type, tea_details))
|
|
else:
|
|
drinker.msg(choices(EMPTY_TEA_MSGS, tea_type, tea_details))
|
|
|
|
def do_fill(self, drinker, tea_type, tea_details):
|
|
self.db.tea_type = tea_type
|
|
self.db.tea_details = tea_details
|
|
self.db.amount = self.fill_amount
|
|
|
|
drinker.msg(choices(FILL_TEA_MSGS, tea_type, tea_details))
|
|
|
|
|
|
class Teapot(Object):
|
|
def at_object_creation(self):
|
|
"""
|
|
called at creation
|
|
"""
|
|
self.cmdset.add_default(CmdSetTeapot, persistent=True)
|
|
|
|
def do_make_tea(self, drinker, words):
|
|
"""
|
|
Make tea.
|
|
|
|
If 'args', try to make a particular type of tea, otherwise,
|
|
pick one at random.
|
|
"""
|
|
tea_choice = []
|
|
if not words.empty():
|
|
tea_choice = [tea for tea in TEA_TYPES.keys() if words.contains(tea)]
|
|
|
|
if len(tea_choice) > 0:
|
|
self.db.tea_type = tea_choice[0]
|
|
else:
|
|
self.db.tea_type = random.choice(list(TEA_TYPES.keys()))
|
|
desc = routput(TEA_TYPES[self.db.tea_type])
|
|
|
|
self.db.desc = f"A large, brown teapot full of {desc}."
|
|
drinker.msg(f"You make a teapot of {desc}.")
|
|
drinker.announce_action(f"makes a teapot of {desc}.")
|
|
|
|
def do_fill(self, drinker):
|
|
teatype = self.db.tea_type
|
|
if not teatype:
|
|
drinker.msg("You need to |gmake tea|n first.")
|
|
return
|
|
|
|
teacup = drinker.has("teacup")
|
|
if teacup:
|
|
teacup.do_fill(drinker, teatype, TEA_TYPES[teatype])
|
|
else:
|
|
drinker.msg("You need to |gget teacup|n first.")
|