English is hard. Fix $pron() to take 'op'

This commit is contained in:
Howard Abrams 2025-06-08 21:22:51 -07:00
parent 38120965dd
commit a0e746bcba
2 changed files with 13 additions and 8 deletions

View file

@ -303,8 +303,11 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
""" """
Replaces a location's 'msg_contents' with an emote. Replaces a location's 'msg_contents' with an emote.
""" """
# All this does is add the character's gender to the message: # All this does is add the character's gender to the message.
newmsg = sub(r"\$pron\((.*?)\)", f"$pron(\\1, {self.db.gender})", message) # So $pron(you,op) will render "you" or "him"
newmsg = sub(r"\$pron\((.*?),(.*?)\)", f"$pron(\\1,\\2 {self.db.gender})", message)
# While $pron(you) will render "you" and "he":
newmsg = sub(r"\$pron\(([^,]*?)\)", f"$pron(\\1, {self.db.gender})", newmsg)
choose = choices(newmsg) choose = choices(newmsg)
logger.info(choose) logger.info(choose)
self.location.msg_contents(f"{choose}", from_obj=self, exclude=exclude) self.location.msg_contents(f"{choose}", from_obj=self, exclude=exclude)

View file

@ -532,24 +532,26 @@ class BHB(Friendly):
case Reaction.INTERESTED: case Reaction.INTERESTED:
how_sniff = "curiously" how_sniff = "curiously"
how_eat = "quickly" how_eat = "quickly"
and_then = "waits to see what else you might have" and_then = "waits to see what else $you() might have"
case _: case _:
how_sniff = "eagerly" how_sniff = "eagerly"
how_eat = "excitedly" how_eat = "excitedly"
and_then = "gives you a big lick as if to say, Thank you" and_then = "gives $pron(you,op) a big lick as if to say, Thank you"
if is_scone(item): if is_scone(item):
msg = f"{noun} {how_sniff} sniffs your outstretched arm holding the scone. It {how_eat} eats it, and {and_then}." msg = f"{noun} {how_sniff} sniffs $your() outstretched arm holding a scone. It {how_eat} eats it, and {and_then}."
self.adjust_character(feeder, 100) self.adjust_character(feeder, 100)
feeder.has('scone').delete() feeder.has('scone').delete()
elif is_berry(item): elif is_berry(item):
msg = f"{noun} {how_sniff} sniffs your outstretched arm with a handful of berries. It {how_eat} eats them, and {and_then}." msg = f"{noun} {how_sniff} sniffs $your() outstretched arm with a handful of berries. It {how_eat} eats them, and {and_then}."
self.adjust_character(feeder, 40) self.adjust_character(feeder, 40)
feeder.has('berries').delete() feeder.has('berries').delete()
else: else:
msg = f"{noun} doesn't appear interested in anything you have." msg = f"{noun} doesn't appear interested in anything you have."
feeder.msg(msg) if msg:
feeder.announce_action(msg)
# feeder.msg(msg)
def thrown_stick(self, thrower): def thrown_stick(self, thrower):
""" """
@ -560,7 +562,7 @@ class BHB(Friendly):
case Reaction.SCARED: case Reaction.SCARED:
msg = "The beast runs away when $you() throw the stick." msg = "The beast runs away when $you() throw the stick."
case Reaction.CONCERNED: case Reaction.CONCERNED:
msg = "The beast walks over to the stick, sniffs it, and backs away." msg = "The beast walks over to the stick $you() threw, sniffs it, and backs away."
self.adjust_character(thrower, 5) self.adjust_character(thrower, 5)
case Reaction.INTERESTED: case Reaction.INTERESTED:
msg = choices(""" msg = choices("""