Skip to content

Commit

Permalink
Message tweak for faulty amulet of life saving
Browse files Browse the repository at this point in the history
Remove the second reference to "your medallion" from "Your medallion
begins to glow! But... the chain on your medallion breaks..." as being
redundant.

While here, I also strengthened the checks in faulty_lifesaver() - null
object case didn't return, so it would have caused a segfault after
printing an impossible, and I felt like it needed an explicit check that
the object is actually an amulet of life saving, since that might (but
isn't likely to) change in the future.
  • Loading branch information
copperwater committed Apr 19, 2024
1 parent 18e492c commit ef9729a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/end.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ done(int how)
Your("medallion %s!", !Blind ? "begins to glow" : "feels warm");
/* It's cursed? Well, that's just too bad. */
if (faulty_lifesaver(uamul)) {
pline("But... the chain on your medallion breaks and it falls to the %s!",
pline("But... the chain breaks and it falls to the %s!",
surface(u.ux, u.uy));
You_hear(Hallucination ? "someone playing Yakety Sax!"
: "the sound of a distant trombone...");
Expand Down
9 changes: 9 additions & 0 deletions src/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2899,6 +2899,15 @@ faulty_lifesaver(struct obj* obj)
{
if (!obj) {
impossible("faulty_lifesaver with null object");
return FALSE;
}
if (obj->otyp != AMULET_OF_LIFE_SAVING) {
/* amulets of LS being the only thing that provides Lifesaved could
* theoretically change at some point; if so this condition will need to
* be adjusted */
impossible("faulty_lifesaver with non-amulet-of-life-saving %d",
obj->otyp);
return FALSE;
}
if (objects[obj->otyp].oc_oprop != LIFESAVED) {
impossible("faulty_lifesaver with non-life-saving object");
Expand Down

0 comments on commit ef9729a

Please sign in to comment.