Cast prestidigitation spells

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

View file

@ -39,15 +39,63 @@ class CmdFly(Command):
self.caller.do_fly(self.args.strip()) self.caller.do_fly(self.args.strip())
class CmdMagic(Command):
"""
Cast a generic 'magic' spell.
Usage:
wave [ effect(s) ]
Where 'effects' is a statement of what happens after the magic erupts.
Note that you can have multiple effects separated by two semicolons.
You can tailor the effects to your character with the following:
- |y$you()|n: Replaced by "you" and your name for others, like "old gnome"
- |y$your()|n: Replaced by "your" and your possessive name for others, like "old gnome's"
- |y$conj(verb)|n: Replaced by "verb" for you, and "verbs" for others.
- |y$pron(you)|n: Replaced by "you" for you, but "he" or "she" for others.
- |y$pron(your)|n: Replaced by "your" for you, but "his" or "her" for others.
While flexible, you would use this complex replacement in either
|gnicks|n or as part of a standard magical prefix, by setting the
property:
@set self/magic_msg = "$You() $conj(shake) $pron(your) necklace of bones!"
"""
key = "magic"
aliases = ["wave"]
locks = "cmd:holds()"
def func(self):
"""
Call the 'do_magic' method on the caller.
"""
wizard = self.caller
msgs = wizard.db.magic_msg
if msgs:
msgs = msgs.split(';;')
else:
msgs = [
"$You() $conj(wave) $pron(your) " + self.obj.key + ".",
"<< Sparks ^ Colored lights ^ Flashes ^ Flashes >> of |yoctarine|n << appear ^ emerge ^ materialize >> as << the ^ >> magic << coalesces into an amorphous show of power ^ blends into swirling patterns ^ weaves together>>."
]
if self.args:
msgs = msgs + self.args.strip().split(';;')
wizard.spell_sequence(None, msgs, wizard.db.magic_delay or 3)
class CmdSetWand(CmdSet): class CmdSetWand(CmdSet):
""" """
All wizard spells are tied to a 'wand' that might be flavored. All wizard spells are tied to a 'wand' that might be flavored.
""" """
key = "Wand"
def at_cmdset_creation(self): def at_cmdset_creation(self):
super().at_cmdset_creation() super().at_cmdset_creation()
self.add(CmdFly) self.add(CmdFly)
self.add(CmdMagic)
class CmdMakeCocktail(MuxCommand): class CmdMakeCocktail(MuxCommand):

View file

@ -318,11 +318,15 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
def spell_sequence(self, location, messages, time_delay=1): def spell_sequence(self, location, messages, time_delay=1):
""" """
Send one or more messages to 'location' with a delay. Send one or more messages to 'location' with a delay.
If the 'location' is None, then send it to the room the
character is in.
""" """
location.msg_contents("\n" + routput(messages[0]))
for idx, msg in enumerate(messages[1:]): for idx, msg in enumerate(messages[1:]):
delay(time_delay * (idx + 1), if location:
location.msg_contents, "\n" + routput(msg)) delay(time_delay * idx, location.msg_contents, "\n" + routput(msg))
else:
delay(time_delay * idx, self.announce_action, msg)
def do_fly(self, location): def do_fly(self, location):
""" """