Expanded the magic pipe to include other monsters

This commit is contained in:
Howard Abrams 2025-07-27 12:28:20 -07:00
parent 0d2c966895
commit 61bec79397
5 changed files with 54 additions and 42 deletions

View file

@ -112,12 +112,15 @@ class CmdSmoke(MuxCommand):
Usage:
smoke [ options [= description]]
smoke [ option [= description]]
Where 'options' can be:
- ring : a traditional or multicolored smoke ring
- dragon : a dragon shape
- monster : a monstrous shape, where 'description'
is the name of the shape.
- arrow : where 'description' is where the smoke
points to.
If an 'option' is not given, then resorts to the attribute,
'smoke_msg'.
@ -130,8 +133,10 @@ class CmdSmoke(MuxCommand):
if self.lhs:
if self.lhs == 'ring':
self.obj.do_ring(self.caller, self.rhs)
elif self.lhs == 'dragon':
self.obj.do_dragon(self.caller, self.rhs)
elif self.lhs == 'arrow':
self.obj.do_arrow(self.caller, self.rhs)
elif self.lhs == 'monster':
self.obj.do_monster(self.caller, self.rhs)
else:
self.caller.msg(f"The option, '{self.lhs}' isn't available.")
else:

View file

@ -19,7 +19,7 @@ from commands.misc import (CmdSetPuddle,
CmdSetDice)
from commands.consumables import CmdSetMakeConsumable
from commands.wizards import CmdSetWand
from utils.word_list import routput, choices
from utils.word_list import routput, choices, paragraph
from .scripts import KnockScript
from .objects import Object
@ -241,39 +241,25 @@ class Dice(Object):
class Pipe(Object):
"""Simple abstraction for the following actions.
"""
Simple abstraction for lighting and smoking actions.
Note that each message has two versions, one for the smoker (you)
and one for everyone else in the room.
@set pipe/light_msg = "You pull out, pack and light a pipe."
@set pipe/light_msg_other = "{0} packs |p pipe and lights it."
Where the |p is a possessive gender, if set, e.g. his or her.
The random messages has available substitutions based on if the
message is for the smoker or for the audience in the room.
Specifically:
- {0} :: either "you" or your name
- {1} :: either "your" or your name with an apostrophe 's.
- {2} :: blank (for you) or "s" for everyone else, e.g. "blow{2}"
For instance:
@set pipe/random_msgs = "{0} blow{1} a <<large ^ small ^ >> smoke-ring followed by another that flies through the first. ;; {1} smoke collesce to form a <<dragon ^ large woodland beast ^ beholder ^ bugbear>> ... or
@set pipe/light_msg = "$You() $conj(pull) out, $conj(pack) and $conj(light) $pron(your) pipe."
@set pipe/smoke_msg = "$You() $conj(lean) back and $conj(<< puff ^ smoke>>) $pron(your) pipe."
Note that phrases separated by ^ characters and enclosed in << ...
>> will be randomly selected.
"""
def at_object_creation(self):
self.cmdset.add_default(CmdSetSmoke)
def do_light(self, lighter):
msg = choices(self.db.light_msg or "$You() $conj(pack) and $conj(light) $pron(your) pipe.")
msg = choices(self.db.light_msg or f"$You() $conj(pack) and $conj(light) $pron(your) {self.name}.")
lighter.announce_action(msg)
self.db.is_giving_light = True
def do_smoke(self, smoker):
msg = choices(self.db.smoke_msg or "$You() << $conj(lean) back and ^ >> << $conj(puff) ^ $conj(smoke) >> $pron(your) pipe.")
msg = choices(self.db.smoke_msg or f"$You() << $conj(lean) back and ^ >> << $conj(puff) ^ $conj(smoke) >> $pron(your) {self.name}.")
smoker.announce_action(msg)
def do_ring(self, smoker, details=None):
@ -281,7 +267,9 @@ class Pipe(Object):
self.db._last_detail = details
details = details or ""
msg = choices(f"$You() $conj(blow) a {details} << smoke ring ^ ring of smoke >>.")
msg = choices(f"""$You() $conj(blow) a {details} smoke ring.
;; The smoke from $your() forms a << beautiful ^ swirling ^ spiraling >> ring.
""")
smoker.announce_action(msg)
if randint(1, 10) < 5:
delay(randint(5, 15), self.do_ring_dissipate)
@ -294,25 +282,42 @@ class Pipe(Object):
""")
self.location.location.msg_contents(msg)
def do_dragon(self, smoker, details=None):
self.db._last_option = 'dragon'
def do_arrow(self, smoker, details=None):
self.db._last_option = 'arrow'
self.db._last_detail = details
details = details or ""
msg = choices(f"The smoke from $pron(your) pipe << coalesces ^ coheres >> << to form ^ into the shape of ^ and resembles ^ to look like >> a {details} dragon.")
msg = paragraph(choices(f"""
The smoke from $your() {self.name}
<< streaks ^ makes a line ^ makes an arrow ^ shoots out >>
<< pointing to ^ directly at >> {details}!
"""))
smoker.announce_action(msg)
if randint(1, 10) < 8:
delay(randint(5, 15), self.do_dragon_dissipate)
def do_monster(self, smoker, details=None):
self.db._last_option = 'monster'
def do_dragon_dissipate(self):
msg = choices("""
The smoke dragon << flies around ^ soars across the room ^ bellows >> before it << eventually ^ finally >> << dissipates ^ disperses >>. ;;
The smoke dragon changes << colors ^ to purple ^ to blue ^ to pink>> before << dissipating ^ dispersing >>.
""")
# Pre-message:
smoker.announce_action(paragraph(choices(
f"""
$You() $conj(blow) the smoke from $pron(your) {self.name} into a <<swirling mass ^ spiraling vortex ^ spiral ^ dense cloud>>.
;;
The smoke from $your() {self.name} << coalesces ^ coheres ^ swirls together >>.
""")))
details = details or choice(["dragon", "flumph", "froghemoth", "serpent"])
self.db._last_detail = details
article = "an" if match(r"^[aeiou]", details) else "a"
msg = routput(
f"""The smoke << forms ^ forms the shape of ^ begins to resemble ^ looks like ^ becomes >> {article} {details}!""")
delay(3, smoker.announce_action, msg)
delay(randint(5, 15), self.do_monster_dissipate, details)
def do_monster_dissipate(self, monster):
msg = choices(f"""The << smoke ^ >> {monster} << flies around ^ soars overhead ^ gently floats ^ waves ^ bellows >> before it << eventually ^ finally ^ >> << dissipates ^ disperses ^ looses its shape becoming a puff >>. ;;
The << smoke ^ >> << monster ^ {monster} >> changes << colors ^ to purple ^ to blue ^ to pink>> before << dissipating ^ dispersing >>.""")
self.location.location.msg_contents(msg)
class Wood(Object):
"An object to burn."
def at_object_creation(self):

View file

@ -42,7 +42,9 @@ def capitalize_line(line):
def squish(text):
"Remove series of spaces from the text."
return sub('[ \t]+', ' ', text).strip()
no_start = sub(r"\( +", "(", text)
no_after = sub(r" +\)", ")", no_start)
return sub('[ \t]+', ' ', no_after).strip()
def _routput_choose(text):
"""

View file

@ -60,7 +60,7 @@ def menunode_welcome(caller):
3. Character's "Pose"
4. Long Description
5. Character's Name
""" + "\nType |cReturn|n to begin creating your character."
""" + "|/Type |cReturn|n to begin creating your character."
help = paragraph("""
Type |gnext|n or |gskip|n (or even a blank answer), to keep any

View file

@ -3035,7 +3035,7 @@ py bt = self.search('imp'); bt.db.pose = 'sitting on an ornate perch'
#
@set moonberries/make_verb = "$conj(collect) a"
#
@set moonberries/make_class = "typeclasses.objects.Edible"
@set moonberries/make_class = "typeclasses.consumables.Edible"
#
@set moonberries/make_desc = "Blue berries with a white cresent shape."
#