monster swapping armor
While testing the Demonbane change, I saw | The Angel of Crom removes a robe and puts on a robe. which looks a bit silly. Change that to be | The Angel of Crom removes a robe and puts on another robe. when the two items have the same formatted description. (The second robe evidently has a better enchantment than the first one.)
This commit is contained in:
+26
-8
@@ -723,7 +723,7 @@ staticfn void
|
|||||||
m_dowear_type(
|
m_dowear_type(
|
||||||
struct monst *mon,
|
struct monst *mon,
|
||||||
long flag, /* wornmask value */
|
long flag, /* wornmask value */
|
||||||
boolean creation,
|
boolean creation, /* no wear messages when mon is being created */
|
||||||
boolean racialexception) /* small monsters that are allowed for player
|
boolean racialexception) /* small monsters that are allowed for player
|
||||||
* races (gnomes) can wear suits */
|
* races (gnomes) can wear suits */
|
||||||
{
|
{
|
||||||
@@ -847,14 +847,32 @@ m_dowear_type(
|
|||||||
|
|
||||||
if (!creation) {
|
if (!creation) {
|
||||||
if (sawmon) {
|
if (sawmon) {
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ], oldarm[BUFSZ], newarm[BUFSZ];
|
||||||
|
|
||||||
if (old)
|
/* "<Mon> [removes <oldarm> and ]puts on <newarm>."
|
||||||
Sprintf(buf, " removes %s and", distant_name(old, doname));
|
uses accessory verbs for armor but we can live with that */
|
||||||
else
|
if (old) {
|
||||||
buf[0] = '\0';
|
Strcpy(oldarm, distant_name(old, doname));
|
||||||
pline("%s%s puts on %s.", Monnam(mon), buf,
|
Snprintf(buf, sizeof buf, " removes %s and", oldarm);
|
||||||
distant_name(best, doname));
|
} else {
|
||||||
|
buf[0] = oldarm[0] = '\0';
|
||||||
|
}
|
||||||
|
Strcpy(newarm, distant_name(best, doname));
|
||||||
|
/* a monster will swap an item of the same type as the one it
|
||||||
|
is replacing when the enchantment is better;
|
||||||
|
if newarm and oldarm have identical descriptions, substitute
|
||||||
|
"another <newarm>" for "a|an <newarm>" */
|
||||||
|
if (!strcmpi(newarm, oldarm)) {
|
||||||
|
if (!strncmpi(newarm, "a ", 2)
|
||||||
|
&& strlen(newarm) + sizeof "another " - sizeof "a "
|
||||||
|
< sizeof newarm)
|
||||||
|
(void) strsubst(newarm, "a ", "another ");
|
||||||
|
else if (!strncmpi(newarm, "an ", 3)
|
||||||
|
&& strlen(newarm) + sizeof "another " - sizeof "an "
|
||||||
|
< sizeof newarm)
|
||||||
|
(void) strsubst(newarm, "an ", "another ");
|
||||||
|
}
|
||||||
|
pline("%s%s puts on %s.", Monnam(mon), buf, newarm);
|
||||||
if (autocurse)
|
if (autocurse)
|
||||||
pline("%s %s %s %s for a moment.", s_suffix(Monnam(mon)),
|
pline("%s %s %s %s for a moment.", s_suffix(Monnam(mon)),
|
||||||
simpleonames(best), otense(best, "glow"),
|
simpleonames(best), otense(best, "glow"),
|
||||||
|
|||||||
Reference in New Issue
Block a user