Second potion available to make
This commit is contained in:
parent
f8a7f46fa0
commit
0b04ddb7d3
7 changed files with 270 additions and 47 deletions
|
|
@ -13,6 +13,8 @@ from typeclasses.objects import Object
|
|||
from typeclasses.scripts import Script
|
||||
from typeclasses.drinkables import Container
|
||||
from utils.scoring import Scores
|
||||
from utils.word_list import choices
|
||||
|
||||
|
||||
class CmdEmpty(Command):
|
||||
"""
|
||||
|
|
@ -239,16 +241,19 @@ class Cauldron(Object):
|
|||
maker.msg(f"The {self.name} is empty. First, |gadd|n ingredients.")
|
||||
return
|
||||
|
||||
seq, brew_func = self.can_create_laughter()
|
||||
if seq:
|
||||
maker.score(Scores.make_potion)
|
||||
maker.announce_action(good)
|
||||
for idx, msg in enumerate(seq):
|
||||
delay(idx * 3 + 2, maker.announce_action, msg)
|
||||
self.do_empty()
|
||||
brew_func()
|
||||
else:
|
||||
maker.announce_action(bad)
|
||||
for seq, brew_func in [
|
||||
self.can_create_laughter(),
|
||||
self.can_create_drugtrip()
|
||||
]:
|
||||
if seq:
|
||||
maker.score(Scores.make_potion)
|
||||
maker.announce_action(good)
|
||||
for idx, msg in enumerate(seq):
|
||||
delay(idx * 3 + 2, maker.announce_action, msg)
|
||||
self.do_empty()
|
||||
return brew_func()
|
||||
|
||||
maker.announce_action(bad)
|
||||
|
||||
def has_potion(self):
|
||||
"""
|
||||
|
|
@ -310,6 +315,35 @@ class Cauldron(Object):
|
|||
potion.location = self
|
||||
potion.db.spell = LaughterSpell
|
||||
|
||||
def can_create_drugtrip(self):
|
||||
"""
|
||||
Return true if the cauldron can make the drug trip potion.
|
||||
"""
|
||||
mushrooms = self.search("dreamshade mushroom", location=self, quiet=True)
|
||||
berries = self.search("moonberries", location=self, quiet=True)
|
||||
dust = self.search("pixie dust", location=self, quiet=True)
|
||||
water = self.search("still water", location=self, quiet=True)
|
||||
|
||||
if len(mushrooms) > 0 and len(berries) > 0 and len(dust) > 0 and len(water) > 1:
|
||||
return ([
|
||||
"$You() $conj(stir) the cauldron with a wooden spoon, watching the liquid change to a deep purple, releasing a fragrant aroma.",
|
||||
"The imp climbs down from its perch and mutters, \"Risus ignis, laetitiae flamma, in corde nostro, gaudium humourous.\"",
|
||||
"Sparks of vibrant octarine pop over the elixir, making it ready to |gbottle|n."
|
||||
], self.create_drugtrip)
|
||||
else:
|
||||
return (None, None)
|
||||
|
||||
def create_drugtrip(self):
|
||||
"""
|
||||
Spawn a Potion with the spell function for the cauldron's contents.
|
||||
"""
|
||||
potion = spawn({
|
||||
"typeclass": "typeclasses.alchemy.Potion",
|
||||
"key": "potion",
|
||||
"desc": "Small glass vial containing a glowing blue liquid, labeled: |mSomnium Illusorium|n"
|
||||
})[0]
|
||||
potion.location = self
|
||||
potion.db.spell = DrugtripSpell
|
||||
|
||||
class Vial(Container):
|
||||
"""
|
||||
|
|
@ -371,27 +405,71 @@ class LaughterSpell(Script):
|
|||
self.send_random_message()
|
||||
|
||||
def send_random_message(self):
|
||||
rand = randint(1, 10)
|
||||
self.obj.announce_action(
|
||||
choice([
|
||||
"$You() $conj(erupt) into laughter, a deep, rolling sound that fills the room and makes everyone turn to see what’s so funny.",
|
||||
"$You() $conj(let) out a series of high-pitched giggles, each one bubbling up like a fizzy drink, light and infectious.",
|
||||
"$You() $conj(burst) into cackling laughter, the sharp, gleeful sound that echo off the walls.",
|
||||
"$You() $conj(find) yourself wheezing with laughter, gasping for air as the hilarity overwhelms you, tears streaming down your cheeks.",
|
||||
"$You() $conj(break) into a fit of snorting giggles; you try to surpress them to no avail.",
|
||||
"$You() $conj(let) out a tinkling laugh, a melodic sound that dances through the air, bringing a sense of whimsy to the moment.",
|
||||
"$You() $conj(roar) with laughter, a booming sound that resonates with joy.",
|
||||
"$You() $conj(chuckle) softly, a warm and genuine sound that reflects your delight.",
|
||||
"$You() $conj(giggle) uncontrollably, making it hard for $pron(you) to catch $pron(your) breath.",
|
||||
"$You() $conj(let) a stifled chuckle, unsure what became so humorous.",
|
||||
]))
|
||||
|
||||
if rand == 1:
|
||||
msg = "$You() $conj(erupt) into laughter, a deep, rolling sound that fills the room and makes everyone turn to see what’s so funny."
|
||||
elif rand == 2:
|
||||
msg = "$You() $conj(let) out a series of high-pitched giggles, each one bubbling up like a fizzy drink, light and infectious."
|
||||
elif rand == 3:
|
||||
msg = "$You() $conj(burst) into cackling laughter, the sharp, gleeful sound that echo off the walls."
|
||||
elif rand == 4:
|
||||
msg = "$You() $conj(find) yourself wheezing with laughter, gasping for air as the hilarity overwhelms you, tears streaming down your cheeks."
|
||||
elif rand == 5:
|
||||
msg = "$You() $conj(break) into a fit of snorting giggles; you try to surpress them to no avail."
|
||||
elif rand == 6:
|
||||
msg = "$You() $conj(let) out a tinkling laugh, a melodic sound that dances through the air, bringing a sense of whimsy to the moment."
|
||||
elif rand == 7:
|
||||
msg = "$You() $conj(roar) with laughter, a booming sound that resonates with joy."
|
||||
elif rand == 8:
|
||||
msg = "$You() $conj(chuckle) softly, a warm and genuine sound that reflects your delight."
|
||||
elif rand == 9:
|
||||
msg = "$You() $conj(giggle) uncontrollably, making it hard for $pron(you) to catch $pron(your) breath."
|
||||
else:
|
||||
msg = "$You() $conj(let) a stifled chuckle, unsure what became so humorous."
|
||||
class DrugtripSpell(Script):
|
||||
"""
|
||||
This class defines the script itself
|
||||
"""
|
||||
def at_script_creation(self):
|
||||
self.key = "drug-trip-spell"
|
||||
self.desc = "Adds various timed events to a character."
|
||||
self.interval = 120 # seconds
|
||||
self.repeats = 4 # repeat only a certain number of times
|
||||
self.start_delay = True # wait self.interval until first call
|
||||
|
||||
self.obj.announce_action(msg)
|
||||
def at_repeat(self):
|
||||
"""
|
||||
This gets called every self.interval seconds. We make
|
||||
a random check here so as to only return 33% of the time.
|
||||
"""
|
||||
if random() < 0.56:
|
||||
self.send_random_message()
|
||||
|
||||
def send_random_message(self):
|
||||
"""
|
||||
Send a random message to the 'victim' of this spell,
|
||||
and another message to the other people in the room.
|
||||
"""
|
||||
you_msg, other_msg = choice([
|
||||
("You feel your bones turn into hollow reeds. A warm breeze blows through your ribs, playing a hauntingly beautiful flute melody that tastes like honey.",
|
||||
"You see the $you() stand perfectly still, emitting a loud, melodic whistling sound from $pron(your,sp) nostrils that may attract a confused songbird."),
|
||||
|
||||
("You are standing on the ceiling of the sky. The fluffy clouds are surprisingly firm, like soft islands, you must hop across to avoid falling. \"Be quiet,\" you whisper to yourself, \"Don't wake the cloud people.\"",
|
||||
"You see the $you() frantically \"climbing\" a nearby tree, though $pron(you,sp) is doing it upside down and backward with terrifying, twitchy agility. \"Be quiet,\" $pron(you,sp) say, \"Don't wake the cloud people.\""),
|
||||
|
||||
("Your shadow stretches and detaches itself, grows a mouth, and begins whispering to you, \"The trees once had names, but $pron(you,sp)'ve forgotten them. Now $pron(you,sp) desperately want to steal your name, so never use your real name to the woods.\"",
|
||||
"You see the $you() engaged in a heated, whispered argument with the ground at $pron(your,sp) feet, eventually pointing a finger and ordering $pron(your,sp) own shadow to \"stay.\""),
|
||||
|
||||
("You feel yourself stretch and grow, breaking out of the area you knew to reach for the sky. You are a gargantuan giant! Every step feels like it should crush a mountain; you move slowly to avoid destroying the trees.",
|
||||
"You see the $you() moving in extreme slow-motion, lifting $pron(your,sp) feet two feet high for every step and looking down at something on the ground with intense pity."),
|
||||
|
||||
("With loud squawk, you see your hands turn into a pair of bickering, multicolored pheasants! $pron(You,Sp) painfully start to fly away in opposite directions.",
|
||||
"You see the $you() shove $pron(your,sp) hands deep into $pron(your,sp) armpits, hunched over and making muffled, frantic clucking noises while $pron(your,sp) elbows flap wildly."),
|
||||
|
||||
("Thousands of tiny, glowing yellow spiders start weaving a suit of |wGlimmer-Silk|n onto your body. You feel the itch of a thousand needles. Ah, but this silk suit will be wonderful when they are done.",
|
||||
"You see the $you() begin frantically stripping off $pron(your,sp) clothes, shouting that $pron(your,sp) clothes are \"smothering the velvet.\""),
|
||||
|
||||
("The ground turns into a liquid mosaic of memories. Walking feels like treading water in a pool of your own childhood dreams.",
|
||||
"You see the $you() drop and begin \"swimming\" across the floor, performing a remarkably proficient breaststroke."),
|
||||
|
||||
("Your mind is clear, as you realize you've been playing a character in some play this whole time...wearing green tights and a tunic. You also know the |waudience|n has been watching you from behind the trees, and you feel the need to give them a performance of a lifetime. ",
|
||||
"You see the $you() break into a booming, theatrical monologue, \"If we shadows have offended, think but this, and all is mended! That you have but slumbered here while these visions did appear. And this weak and idle theme, no more yielding but a dream! Gentles, do not reprehend: if you pardon, we will mend!\" $pron(You,sp) then takes a big bow."),
|
||||
])
|
||||
self.obj.msg(you_msg)
|
||||
self.obj.announce_action(other_msg, self.obj)
|
||||
delay(10, self.obj.msg,
|
||||
choices("""Your << world ^ reality ^ clarity >> returns, and you feel << back to ^ >> normal. ;; You << snap back ^ re-fade back >> to your << old ^ original >> << self ^ mind >>."""
|
||||
))
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ creation commands.
|
|||
"""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from re import match, compile, sub
|
||||
from re import match, compile, sub, IGNORECASE
|
||||
|
||||
import requests
|
||||
|
||||
|
|
@ -58,6 +58,29 @@ READ_LETTER = """You read a letter with an oddly familiar penmanship:
|
|||
(Type 'help start' for details on playing this game)"""
|
||||
|
||||
|
||||
def preserve_case(replacement):
|
||||
"""Returns a closure that mirrors the casing of the matched text.
|
||||
|
||||
This allows us to match and substitute 'foo' for 'bar', but also
|
||||
'Foo' for 'Bar' (as well as 'FOO' for 'BAR).
|
||||
|
||||
But that is only it, as Python's regular expression seems to be
|
||||
deficient in this regards, so we only cover those cases.
|
||||
"""
|
||||
def _replace(match):
|
||||
word = match.group()
|
||||
if word.istitle():
|
||||
return replacement.capitalize()
|
||||
elif word.islower():
|
||||
return replacement.lower()
|
||||
elif word.isupper():
|
||||
return replacement.upper()
|
||||
else:
|
||||
return replacement
|
||||
|
||||
return _replace
|
||||
|
||||
|
||||
class Character(Object, GenderCharacter, ContribRPCharacter):
|
||||
"""
|
||||
The Character just re-implements some of the Object's methods and hooks
|
||||
|
|
@ -509,12 +532,12 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
|
|||
# and $pron(you,sp) will render "you" or "he"
|
||||
newmsg = sub(r"\$pron\(([^\)]*?),([^\)]*?)\)",
|
||||
f"$pron(\\1,\\2 {self.db.gender})",
|
||||
message)
|
||||
|
||||
message, flags=IGNORECASE)
|
||||
logger.info(f"Start with {newmsg}")
|
||||
# While $pron(you) will render "you" and "he":
|
||||
newmsg = sub(r"\$pron\(([^,\)]*?)\)",
|
||||
f"$pron(\\1, {self.db.gender})",
|
||||
newmsg)
|
||||
newmsg, flags=IGNORECASE)
|
||||
|
||||
choose = choices(newmsg)
|
||||
logger.info(choose)
|
||||
|
|
|
|||
|
|
@ -205,8 +205,9 @@ class Bottle(Container):
|
|||
fill_amount = 8
|
||||
empty_msgs = [
|
||||
'Your {2} is empty. Perhaps you can |gfill|n it?',
|
||||
'It appears that you need to fill your {2}.'
|
||||
'It appears that you need to |gfill|n your {2}.'
|
||||
]
|
||||
|
||||
def at_object_creation(self):
|
||||
"""
|
||||
called at creation
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ class WeeBeastie(Friendly, Familiar, Listener, AI):
|
|||
else:
|
||||
delay(4, self.location.msg_contents,
|
||||
choices(f"""
|
||||
A << furry ^ >> white << animal ^ creature ^ beastie >> asleep on one of the chairs, << lifts an eyelid to look at the {character.get_name()} before returning to its nap ^ wakes to watch the {character.get_name()}."""))
|
||||
The << furry ^ >> white << animal ^ creature ^ beastie >> asleep on one of the chairs, << lifts an eyelid to look at the {character.get_name()} before returning to its nap ^ wakes to watch the {character.get_name()}. >>"""))
|
||||
|
||||
def other_sit(self, character):
|
||||
if character.key == "Dabbler":
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ class CreateHorns(Script):
|
|||
horn = spawn({
|
||||
"typeclass": "typeclasses.sailing.CallingHorn",
|
||||
"key": "horn",
|
||||
"desc": "While physical, this curved horn seems made from sea mist, and has an amorphous quality. Wonder what would happen if you |gblow|n this horn? And where?",
|
||||
"desc": "While physical, this curved horn seems to be made from sea mist, as it has an amorphous quality. Wonder what would happen if you |gblow|n this horn?",
|
||||
})[0]
|
||||
horn.location = hut
|
||||
hut.msg_contents("The misty smell of brine wafts in through a window. The mists congeal to form a horn, hanging on a hook near the window.")
|
||||
|
|
|
|||
|
|
@ -566,6 +566,12 @@ expectit "You take a torch from the bucket."
|
|||
send "inv\n"
|
||||
expectit "Made from marsh grass"
|
||||
|
||||
send "look horn\n"
|
||||
expectit "this curved horn"
|
||||
|
||||
send "get horn\n"
|
||||
expectit "You pick up a horn"
|
||||
|
||||
send "leave\n"
|
||||
expect "Mellow Marsh"
|
||||
|
||||
|
|
@ -1029,6 +1035,7 @@ expectit "Grove of the Matriarchs"
|
|||
send "climb boulder\n"
|
||||
expectit "Boulder Top"
|
||||
|
||||
# Elixir Risorium ... Laughing Potion ...
|
||||
send "look mshrooms\n"
|
||||
|
||||
expectit "A vibrant patch of mushrooms bursts forth like a painter's palette, each cap shimmering with iridescent hues of violet, emerald, and gold"
|
||||
|
|
@ -1104,6 +1111,120 @@ expectit "Total:"
|
|||
send "give potion to gnome\n"
|
||||
expectit "You give a potion"
|
||||
|
||||
send "leave\n"
|
||||
expectit "Grotto"
|
||||
|
||||
send "fill bottle\n"
|
||||
expectit "fresh spring water"
|
||||
|
||||
send "east\n"
|
||||
expectit "Grove"
|
||||
|
||||
send "east\n"
|
||||
expectit "Frog Meadow"
|
||||
|
||||
send "lair\n"
|
||||
expectit "Lair"
|
||||
|
||||
send "look mushrooms\n"
|
||||
expectit "Slender blue tendrils"
|
||||
|
||||
send "get mushrooms\n"
|
||||
expectit "sack of mushrooms"
|
||||
|
||||
send "leave\n"
|
||||
expectit "Frog Meadow"
|
||||
|
||||
send "south\n"
|
||||
expectit "Mellow Marsh"
|
||||
|
||||
send "get glitter\n"
|
||||
expectit "sack of pixie dust"
|
||||
|
||||
send "north\n"
|
||||
expectit "Frog Meadow"
|
||||
|
||||
send "west\n"
|
||||
expectit "Grove"
|
||||
|
||||
send "south\n"
|
||||
expectit "Lazy Dock"
|
||||
|
||||
send "blow horn\n"
|
||||
# expectit "You blow your horn"
|
||||
expectit "The giant leaf slows as it arrives next to the dock."
|
||||
|
||||
send "boat\n"
|
||||
expectit "The giant leaf gently bobs in the surf of this island, allowing you to disembark."
|
||||
|
||||
send "disembark\n"
|
||||
expectit "Lonely Island"
|
||||
|
||||
send "pick moonberry\n"
|
||||
expectit "You collect a handful of moonberries"
|
||||
|
||||
# While we are here, we should solve the puzzle...but...
|
||||
send "boat\n"
|
||||
expectit "The giant leaf slows as it arrives and docks allowing you to disembark"
|
||||
|
||||
send "disembark\n"
|
||||
expectit "Lazy Dock"
|
||||
|
||||
send "north\n"
|
||||
expectit "Grove"
|
||||
|
||||
send "west\n"
|
||||
expectit "Grotto"
|
||||
|
||||
send "red door\n"
|
||||
expectit "Cozy House"
|
||||
|
||||
send "pull sconce\n"
|
||||
expectit "You hear a click"
|
||||
|
||||
send "down stairs\n"
|
||||
expectit "Secret Room"
|
||||
|
||||
send "empty\n"
|
||||
expectit "empty"
|
||||
|
||||
send "add mushrooms\n"
|
||||
expectit "You add sack of mushrooms to black cauldron."
|
||||
|
||||
send "add moonberries\n"
|
||||
expectit "You add handful of moonberries to black cauldron."
|
||||
|
||||
send "add pixie dust\n"
|
||||
expectit "You add handful of moonberries to black cauldron."
|
||||
|
||||
send "add bottle\n"
|
||||
expectit "You pour the fizzy water from your bottle into the black cauldron."
|
||||
|
||||
send "create\n"
|
||||
expectit "making it ready"
|
||||
|
||||
send "bottle\n"
|
||||
expectit "You fill a small vial"
|
||||
|
||||
send "inventory\n"
|
||||
expectit "vial"
|
||||
|
||||
send "empty\n"
|
||||
# Since almost anything can be written, we look for a period
|
||||
expectit "."
|
||||
|
||||
send "empty\n"
|
||||
expectit "The black cauldron is already empty."
|
||||
|
||||
send "up\n"
|
||||
expectit "Cozy House"
|
||||
|
||||
send "score\n"
|
||||
expectit "Total:"
|
||||
|
||||
send "give potion to gnome\n"
|
||||
expectit "You give a potion"
|
||||
|
||||
# Close the log file
|
||||
log_file
|
||||
|
||||
|
|
|
|||
|
|
@ -859,13 +859,13 @@ py me.search("squirrel").backstory("squirrel")
|
|||
#
|
||||
@desc mushrooms = Slender blue tendrils of a fungus encircle the base of the mattress. You note that these look like the |wDreamshade mushrooms|n mentioned in the |wAlchemy Lab|n.
|
||||
#
|
||||
@set mushrooms/make_name = "sack of mushrooms"
|
||||
@set mushrooms/make_name = "dreamshade mushroom"
|
||||
#
|
||||
@set mushrooms/make_verb = "$conj(collect) and $conj(fill) a"
|
||||
@set mushrooms/make_verb = "$conj(pluck) and $conj(pocket) a "
|
||||
#
|
||||
@set mushrooms/make_class = "typeclasses.consumables.Edible"
|
||||
#
|
||||
@set mushrooms/make_desc = "Small collection of slender, blue mushrooms."
|
||||
@set mushrooms/make_desc = "A slender, blue mushroom. Glowing?"
|
||||
#
|
||||
@set mushrooms/make_amount = 1
|
||||
#
|
||||
|
|
@ -1580,13 +1580,13 @@ py me.search("heron").backstory("heron")
|
|||
#
|
||||
@desc pixie dust = As you look at reeds and marsh grass, you notice the shiny glitter is actually dander from pixies... pixie dust. With a little effort, you could gather a small sack of it.
|
||||
#
|
||||
@set pixie dust/make_name = "sack of pixie dust"
|
||||
@set pixie dust/make_class = "typeclasses.consumables.Herb"
|
||||
#
|
||||
@set pixie dust/make_verb = "$conj(collect) and $conj(fill) a"
|
||||
@set pixie dust/make_name = "wad of pixie dust"
|
||||
#
|
||||
@set pixie dust/make_class = "typeclasses.objects.Object"
|
||||
@set pixie dust/make_verb = "$conj(collect) a sticky"
|
||||
#
|
||||
@set pixie dust/make_desc = "Small bag of the good, shiny stuff."
|
||||
@set pixie dust/make_desc = "wad of the good, shiny stuff."
|
||||
#
|
||||
@set pixie dust/make_amount = 1
|
||||
#
|
||||
|
|
@ -1723,7 +1723,7 @@ py me.search("heron").backstory("heron")
|
|||
|
||||
|
||||
# [[file:../../../projects/mud.org::*Inside Trampoli’s Hut][Inside Trampoli’s Hut:4]]
|
||||
@detail herbs = Clusters plants, a mixture of flowers and herbal leaves, all bound with twine and reeds, hang from spots around the room, fragranting the air.
|
||||
@detail herbs = Clusters of plants, a mixture of flowers and herbal leaves, all bound with twine and reeds, hang from spots around the room, fragranting the air.
|
||||
# Inside Trampoli’s Hut:4 ends here
|
||||
|
||||
# [[file:../../../projects/mud.org::*Inside Trampoli’s Hut][Inside Trampoli’s Hut:5]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue