Unify piousness strings

This commit is contained in:
Pasi Kallinen
2016-04-23 12:00:02 +03:00
parent c5aa0ff368
commit 638aa6969c
3 changed files with 48 additions and 37 deletions

View File

@@ -1791,6 +1791,7 @@ E const char *FDECL(align_str, (ALIGNTYP_P));
E void FDECL(mstatusline, (struct monst *));
E void NDECL(ustatusline);
E void NDECL(self_invis_message);
E char *FDECL(piousness, (boolean, const char *));
E void FDECL(pudding_merge_message, (struct obj *, struct obj *));
/* ### polyself.c ### */

View File

@@ -1950,27 +1950,12 @@ int final;
you_are(hofe_titles[u.uevent.uhand_of_elbereth - 1], "");
}
/* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
if (u.ualign.record >= 20)
you_are("piously aligned", "");
else if (u.ualign.record > 13)
you_are("devoutly aligned", "");
else if (u.ualign.record > 8)
you_are("fervently aligned", "");
else if (u.ualign.record > 3)
you_are("stridently aligned", "");
else if (u.ualign.record == 3)
you_are("aligned", "");
else if (u.ualign.record > 0)
you_are("haltingly aligned", "");
else if (u.ualign.record == 0)
you_are("nominally aligned", "");
else if (u.ualign.record >= -3)
you_have("strayed", "");
else if (u.ualign.record >= -8)
you_have("sinned", "");
Sprintf(buf, "%s", piousness(TRUE, "aligned"));
if (u.ualign.record >= 0)
you_are(buf, "");
else
you_have("transgressed", "");
you_have(buf, "");
if (wizard) {
Sprintf(buf, " %d", u.ualign.record);
enl_msg("Your alignment ", "is", "was", buf, "");

View File

@@ -538,23 +538,8 @@ ustatusline()
Strcat(info, mon_nam(u.ustuck));
}
pline("Status of %s (%s%s): Level %d HP %d(%d) AC %d%s.", plname,
(u.ualign.record >= 20)
? "piously "
: (u.ualign.record > 13)
? "devoutly "
: (u.ualign.record > 8)
? "fervently "
: (u.ualign.record > 3)
? "stridently "
: (u.ualign.record == 3)
? ""
: (u.ualign.record >= 1)
? "haltingly "
: (u.ualign.record == 0)
? "nominally "
: "insufficiently ",
align_str(u.ualign.type),
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", plname,
piousness(FALSE, align_str(u.ualign.type)),
Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
}
@@ -568,6 +553,46 @@ self_invis_message()
: "can't see yourself");
}
char *
piousness(showneg, suffix)
boolean showneg;
const char *suffix;
{
static char buf[BUFSZ];
char *pio;
/* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
if (u.ualign.record >= 20)
pio = "piously";
else if (u.ualign.record > 13)
pio = "devoutly";
else if (u.ualign.record > 8)
pio = "fervently";
else if (u.ualign.record > 3)
pio = "stridently";
else if (u.ualign.record == 3)
pio = "";
else if (u.ualign.record > 0)
pio = "haltingly";
else if (u.ualign.record == 0)
pio = "nominally";
else if (!showneg)
pio = "insufficiently";
else if (u.ualign.record >= -3)
pio = "strayed";
else if (u.ualign.record >= -8)
pio = "sinned";
else
pio = "transgressed";
Sprintf(buf, "%s", pio);
if (suffix && (!showneg || u.ualign.record >= 0)) {
if (u.ualign.record != 3)
Strcat(buf, " ");
Strcat(buf, suffix);
}
return buf;
}
void
pudding_merge_message(otmp, otmp2)
struct obj *otmp;