Fix bug in hint system and petting friendly pets
This commit is contained in:
parent
22960880fc
commit
ce449c8570
4 changed files with 43 additions and 31 deletions
|
|
@ -53,7 +53,7 @@ class CmdHint(MuxCommand):
|
|||
data = self.hint_data()
|
||||
if data:
|
||||
room_hints = data[room_key]
|
||||
narrative = room_hints['narrative']
|
||||
narrative = room_hints.get('narrative')
|
||||
hints = room_hints['hints']
|
||||
|
||||
if not search_string or search_string == "":
|
||||
|
|
@ -64,7 +64,7 @@ class CmdHint(MuxCommand):
|
|||
|
||||
def display_hint(self, narrative, phrase, cleaned):
|
||||
if phrase:
|
||||
if cleaned:
|
||||
if cleaned or not narrative:
|
||||
self.caller.msg(routput(phrase))
|
||||
else:
|
||||
self.caller.msg(choices(narrative, routput(phrase)))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class CmdPet(Command):
|
|||
|
||||
pet [ <creature> ]
|
||||
|
||||
Just because you |wcan|n do this, doesn't mean the creature |wwants|n you to.
|
||||
Just because you |wcan|n do this, doesn't mean the creature
|
||||
|wwants|n you to.
|
||||
"""
|
||||
key = "pet"
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ class CmdPet(Command):
|
|||
"""
|
||||
self.obj.pet_response(self.caller)
|
||||
|
||||
|
||||
class CmdPetSet(CmdSet):
|
||||
"""
|
||||
Things associated with pets.
|
||||
|
|
|
|||
|
|
@ -348,22 +348,29 @@ class Friendly(Pet):
|
|||
Args:
|
||||
looker (Object): Object doing the looking.
|
||||
"""
|
||||
level = self.friendly_reaction(looker)
|
||||
# looking at the friendly pets makes them nervous... just a little:
|
||||
self.adjust_character(looker, -1)
|
||||
|
||||
if level == Reaction.SCARED:
|
||||
return self.db.desc + " " + choices(self.db.scared_msg or "It seems scared of you.")
|
||||
elif level == Reaction.CONCERNED:
|
||||
return self.db.desc + " " + choices(self.db.concerned_msg or "It seems concerned you are here.")
|
||||
elif level == Reaction.INTERESTED:
|
||||
return self.db.desc + " " + choices(self.db.interested_msg or "It seems interested in you.")
|
||||
elif level == Reaction.FRIENDLY:
|
||||
return self.db.desc + " " + choices(self.db.friendly_msg or "It seems happy to see you.")
|
||||
(level, loves) = self.highest_friendly_reaction()
|
||||
loved = loves[0]
|
||||
|
||||
if loved == looker:
|
||||
subs = ("you", "your")
|
||||
else:
|
||||
# If we have an ecstatic message, use it otherwise, grab the friendly:
|
||||
return self.db.desc + " " + choices(self.db.ecstatic_msg or self.db.friendly_msg or
|
||||
"It seems ecstatic to see you.")
|
||||
subs = (loved.db._sdesc, loved.db._sdesc + "'s")
|
||||
|
||||
if level.value > Reaction.ECSTATIC.value and self.db.ecstatic_msg:
|
||||
suffix = choices(self.db.ecstatic_msg, *subs)
|
||||
elif level.value > Reaction.FRIENDLY.value and self.db.friendly_msg:
|
||||
suffix = choices(self.db.friendly_msg, *subs)
|
||||
elif level.value > Reaction.INTERESTED.value and self.db.interested_msg:
|
||||
suffix = choices(self.db.interested_msg, *subs)
|
||||
elif level.value > Reaction.CONCERNED and self.db.concerned_msg:
|
||||
suffix = choices(self.db.concerned_msg, *subs)
|
||||
else:
|
||||
suffix = choices(self.db.scared_msg, *subs)
|
||||
|
||||
return self.db.desc + " " + loved.gendered_text(suffix)
|
||||
|
||||
def update_state(self, *args, **kwargs):
|
||||
"""
|
||||
|
|
@ -418,27 +425,35 @@ class Friendly(Pet):
|
|||
"""
|
||||
match self.friendly_reaction(petter):
|
||||
case Reaction.SCARED:
|
||||
msg = self.db.pet_scared_response
|
||||
msg = self.db.pet_scared_response \
|
||||
or f"The {self.name} doesn't let $you() pet it."
|
||||
self.adjust_character(petter, self.db.pet_scared_adjust or 0)
|
||||
case Reaction.CONCERNED:
|
||||
msg = self.db.pet_concerned_response
|
||||
self.adjust_character(petter, self.db.pet_concerned_adjust or 0)
|
||||
msg = self.db.pet_concerned_response or self.db.pet_scared_response \
|
||||
or f"The {self.name} doesn't let $you() pet it."
|
||||
self.adjust_character(petter, self.db.pet_concerned_adjust or 5)
|
||||
case Reaction.INTERESTED:
|
||||
msg = self.db.pet_interested_response
|
||||
self.adjust_character(petter, self.db.pet_interested_adjust or 1)
|
||||
msg = self.db.pet_interested_response \
|
||||
or self.db.pet_concerned_response or self.db.pet_scared_response \
|
||||
or f"The {self.name} doesn't let $you() pet it."
|
||||
self.adjust_character(petter, self.db.pet_interested_adjust or 8)
|
||||
case Reaction.FRIENDLY:
|
||||
msg = self.db.pet_friendly_response
|
||||
self.adjust_character(petter, self.db.pet_friendly_adjust or 8)
|
||||
msg = self.db.pet_friendly_response or self.db.pet_interested_response \
|
||||
or self.db.pet_concerned_response or self.db.pet_scared_response \
|
||||
or f"The {self.name} doesn't let $you() pet it."
|
||||
self.adjust_character(petter, self.db.pet_friendly_adjust or 10)
|
||||
case Reaction.ECSTATIC:
|
||||
msg = self.db.pet_ecstatic_response
|
||||
self.adjust_character(petter, self.db.pet_ecstatic_adjust or 10)
|
||||
msg = self.db.pet_ecstatic_response or self.db.pet_friendly_response \
|
||||
or self.db.pet_interested_response or self.db.pet_concerned_response \
|
||||
or self.db.pet_scared_response \
|
||||
or f"The {self.name} doesn't let $you() pet it."
|
||||
self.adjust_character(petter, self.db.pet_ecstatic_adjust or 15)
|
||||
if msg:
|
||||
petter.announce_action(msg, self.name)
|
||||
else:
|
||||
petter.announce_action(f"$You() $conj(pet) {self.name}.")
|
||||
|
||||
|
||||
|
||||
class BHB(Friendly):
|
||||
def return_appearance(self, looker):
|
||||
if self.db.is_awake:
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ grotto:
|
|||
riddle: Ask the |Yknocker|n for the riddle.
|
||||
|
||||
cozy_house:
|
||||
narrative: {0}
|
||||
wip: >-
|
||||
narrative: >-
|
||||
"<< Psst. ^ Heya. ^ Over here. ^ Hey buddy. >>"
|
||||
You << look down ^ look down ^ bend down >> and see a
|
||||
<< tiny ^ small ^ >> << brown ^ >> worm on a bookshelf. It says,
|
||||
|
|
@ -86,7 +85,6 @@ cozy_house:
|
|||
No, I did not feel like writing multiple novels for this game.
|
||||
|
||||
cramped_kitchen:
|
||||
narrative: {0}
|
||||
hints:
|
||||
default: >-
|
||||
Grab yourself some breakfast or an evening snack of |Yscones|n and |Ytea|n.
|
||||
|
|
@ -99,7 +97,6 @@ cramped_kitchen:
|
|||
teacup: The cabinet is full of cups, so |gget teacup|n.
|
||||
|
||||
bedroom:
|
||||
narrative: {0}
|
||||
hints:
|
||||
default: >-
|
||||
Don't steal the slippers, as they are decoration (as even
|
||||
|
|
@ -108,7 +105,6 @@ bedroom:
|
|||
wardrobe: If you |gopen|n the |gwardrobe|n, you will find a new exit.
|
||||
|
||||
prairie:
|
||||
narrative: {0}
|
||||
hints:
|
||||
default: >-
|
||||
This place should have a sign that reads, |wUnder Construction|n,
|
||||
|
|
@ -153,7 +149,6 @@ frog_meadow:
|
|||
bottle: You want to |gfill bottle|n to collect the water.
|
||||
|
||||
lair:
|
||||
narrative: {0}
|
||||
hints:
|
||||
default: >-
|
||||
This is the bedroom for the |wBig Hairy Beast|n, and little else.
|
||||
|
|
|
|||
Loading…
Reference in a new issue