From: cohrs Date: Thu, 25 Sep 2003 16:56:56 +0000 (+0000) Subject: killer messages X-Git-Tag: MOVE2GIT~1757 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4375fc784699203b8b10c9f5dcfd3e2b5b42c9e4;p=nethack killer messages Incorporate various killer message grammar fixes suggested by . Mostly these deal with using the proper killer_format and prefix ("the" or no "the") for unique and type_is_pname monsters, or death to to eating their corpses. One case is handled by a general fix to name_to_mon to allow it to deal with "Croesus' corpse". The pre-3.4.1 topten behavior for "starved to death" messages is also restored. --- diff --git a/src/eat.c b/src/eat.c index 448f72a16..aeb793915 100644 --- a/src/eat.c +++ b/src/eat.c @@ -221,7 +221,8 @@ choke(food) /* To a full belly all food is bad. (It.) */ killer = food_xname(food, FALSE); if (food->otyp == CORPSE && (mons[food->corpsenm].geno & G_UNIQ)) { - killer = the(killer); + if (!type_is_pname(&mons[food->corpsenm])) + killer = the(killer); killer_format = KILLED_BY; } } diff --git a/src/mhitu.c b/src/mhitu.c index d50eed448..20ea756f9 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1151,8 +1151,17 @@ dopois: && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { Stoned = 5; - killer_format = KILLED_BY_AN; delayed_killer = mtmp->data->mname; + if (mtmp->data->geno & G_UNIQ) { + if (!type_is_pname(mtmp->data)) { + static char buf[BUFSZ]; + + /* "the" buffer may be reallocated */ + Strcpy(buf, the(delayed_killer)); + delayed_killer = buf; + } + killer_format = KILLED_BY; + } else killer_format = KILLED_BY_AN; return(1); /* You("turn to stone..."); */ /* done_in_by(mtmp); */ diff --git a/src/mon.c b/src/mon.c index 8e66b4d4e..9283fb56e 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1995,11 +1995,12 @@ int typ, fatal; return; } /* suppress killer prefix if it already has one */ - if (!strncmpi(pname, "the ", 4) || - !strncmpi(pname, "an ", 3) || - !strncmpi(pname, "a ", 2) || - /* ... or if it seems to be a proper name */ - isupper(*pname)) { + if ((i = name_to_mon(pname)) >= LOW_PM && mons[i].geno & G_UNIQ) { + kprefix = KILLED_BY; + if (!type_is_pname(&mons[i])) pname = the(pname); + } else if (!strncmpi(pname, "the ", 4) || + !strncmpi(pname, "an ", 3) || + !strncmpi(pname, "a ", 2)) { /*[ does this need a plural check too? ]*/ kprefix = KILLED_BY; } diff --git a/src/mondata.c b/src/mondata.c index 5de5331b1..88cfd4c4d 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -468,6 +468,10 @@ const char *in_str; (str[m_i_len] == ' ' || !strcmpi(&str[m_i_len], "s") || !strncmpi(&str[m_i_len], "s ", 2) || + !strcmpi(&str[m_i_len], "'") || + !strncmpi(&str[m_i_len], "' ", 2) || + !strcmpi(&str[m_i_len], "'s") || + !strncmpi(&str[m_i_len], "'s ", 3) || !strcmpi(&str[m_i_len], "es") || !strncmpi(&str[m_i_len], "es ", 3))) { mntmp = i; diff --git a/src/timeout.c b/src/timeout.c index 0730c42a3..bdd6211ba 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -246,16 +246,11 @@ nh_timeout() if ((m_idx = name_to_mon(killer)) >= LOW_PM) { if (type_is_pname(&mons[m_idx])) { killer_format = KILLED_BY; - } -#if 0 /* at present, there aren't any monster - poisoners with titles rather than names */ - else if (mons[m_idx].geno & G_UNIQ) { - char buf[BUFSZ]; - Sprintf(buf, "the %s", killer); - Strcpy(u.usick_cause, buf); + } else if (mons[m_idx].geno & G_UNIQ) { + killer = the(killer); + Strcpy(u.usick_cause, killer); killer_format = KILLED_BY; } -#endif } u.usick_type = 0; done(POISONING); diff --git a/src/topten.c b/src/topten.c index 2cbdcb614..19a04884a 100644 --- a/src/topten.c +++ b/src/topten.c @@ -595,7 +595,7 @@ boolean so; if (!strncmp(t1->death, "quit", 4)) { Strcat(linebuf, "quit"); second_line = FALSE; - } else if (!strncmp(t1->death, "starv", 5)) { + } else if (!strncmp(t1->death, "died of st", 10)) { Strcat(linebuf, "starved to death"); second_line = FALSE; } else if (!strncmp(t1->death, "choked", 6)) {