From 32baec7bb123feb47d6d5cedc5509e71f51b84bf Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 26 Jul 2005 04:55:57 +0000 Subject: [PATCH] steed corpse Fix the problem From a bug report. Presumeably the corpse exclusion at was intended to be for killing your way out of an engulfer, but there wasn't any comment to that effect. The exclusion still applies if you were inside the monster when it died; ridden steed is the only other way I can think of to have a monster die at your location, so it should be the only case which gets affected. Neither steed nor engulfer is allowed to generate a random item when upon death; you already know what was carried in those cases. The bulk of the diff is from reorganizing the relevant `if' and subsequent indentation changes. --- doc/fixes34.4 | 1 + src/mon.c | 84 ++++++++++++++++++++++++--------------------------- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 4389dadb2..449b58c24 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -137,6 +137,7 @@ fix up grammar and punctuation in variants of shopkeeper's price message regression, bug fixed in 3.4.1 reintroduced in 3.4.3: Sunsword continued to emit light after monster who was wielding got killed weaken "farming" strategy +don't suppress corpse if you kill your own steed Platform- and/or Interface-Specific Fixes diff --git a/src/mon.c b/src/mon.c index bcdc8be06..635ca9078 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1800,19 +1800,17 @@ register struct monst *mtmp; /* the player has killed the monster mtmp */ void xkilled(mtmp, dest) - register struct monst *mtmp; +struct monst *mtmp; /* * Dest=1, normal; dest=0, don't print message; dest=2, don't drop corpse * either; dest=3, message but no corpse */ - int dest; +int dest; { - register int tmp, x = mtmp->mx, y = mtmp->my; - register struct permonst *mdat; - int mndx; - register struct obj *otmp; - register struct trap *t; - boolean redisp = FALSE; + int tmp, mndx, x = mtmp->mx, y = mtmp->my; + struct permonst *mdat; + struct obj *otmp; + struct trap *t; boolean wasinside = u.uswallow && (u.ustuck == mtmp); boolean burycorpse = FALSE; @@ -1881,52 +1879,48 @@ xkilled(mtmp, dest) #ifdef MAIL if(mdat == &mons[PM_MAIL_DAEMON]) { stackobj(mksobj_at(SCR_MAIL, x, y, FALSE, FALSE)); - redisp = TRUE; } #endif - if((!accessible(x, y) && !is_pool(x, y)) || - (x == u.ux && y == u.uy)) { - /* might be mimic in wall or corpse in lava or on player's spot */ - redisp = TRUE; - if(wasinside) spoteffects(TRUE); - } else if(x != u.ux || y != u.uy) { - /* might be here after swallowed */ - if (!rn2(6) && !(mvitals[mndx].mvflags & G_NOCORPSE) && + if (accessible(x, y) || is_pool(x, y)) { + struct obj *cadaver; + int otyp; + + /* illogical but traditional "treasure drop" */ + if (!rn2(6) && !(mvitals[mndx].mvflags & G_NOCORPSE) && + /* no extra item from swallower or steed */ + (x != u.ux || y != u.uy) && #ifdef KOPS + /* no extra item from kops--too easy to abuse */ mdat->mlet != S_KOP && #endif + /* reduced chance of item from cloned monster */ (!mtmp->mcloned || !rn2(mvitals[mndx].died / 5 + 1))) { - int typ; - - otmp = mkobj_at(RANDOM_CLASS, x, y, TRUE); - /* Don't create large objects from small monsters */ - typ = otmp->otyp; - if (mdat->msize < MZ_HUMAN && typ != FOOD_RATION - && typ != LEASH - && typ != FIGURINE - && (otmp->owt > 3 || - objects[typ].oc_big /*oc_bimanual/oc_bulky*/ || - is_spear(otmp) || is_pole(otmp) || - typ == MORNING_STAR)) { - delobj(otmp); - } else redisp = TRUE; + otmp = mkobj_at(RANDOM_CLASS, x, y, TRUE); + /* don't create large objects from small monsters */ + otyp = otmp->otyp; + if (mdat->msize < MZ_HUMAN && otyp != FOOD_RATION && + otyp != LEASH && otyp != FIGURINE && + (otmp->owt > 3 || + objects[otyp].oc_big /*oc_bimanual/oc_bulky*/ || + is_spear(otmp) || is_pole(otmp) || + otyp == MORNING_STAR)) { + delobj(otmp); } - /* Whether or not it always makes a corpse is, in theory, - * different from whether or not the corpse is "special"; - * if we want both, we have to specify it explicitly. - */ - if (corpse_chance(mtmp, (struct monst *)0, FALSE)) { - struct obj *cadaver = make_corpse(mtmp, burycorpse ? - CORPSTAT_BURIED : CORPSTAT_NONE); - if (burycorpse && cadaver && cansee(x,y) && - !mtmp->minvis && - cadaver->where == OBJ_BURIED && (dest & 1)) { - pline("%s corpse ends up buried.", - s_suffix(Monnam(mtmp))); - } + } + /* corpse--none if hero was inside the monster */ + if (!wasinside && corpse_chance(mtmp, (struct monst *)0, FALSE)) { + cadaver = make_corpse(mtmp, burycorpse ? + CORPSTAT_BURIED : CORPSTAT_NONE); + if (burycorpse && cadaver && cansee(x,y) && !mtmp->minvis && + cadaver->where == OBJ_BURIED && (dest & 1)) { + pline("%s corpse ends up buried.", s_suffix(Monnam(mtmp))); } + } } - if(redisp) newsym(x,y); + if (wasinside) spoteffects(TRUE); /* poor man's expels() */ + /* monster is gone, corpse or other object might now be visible */ + newsym(x, y); + cleanup: /* punish bad behaviour */ if(is_human(mdat) && (!always_hostile(mdat) && mtmp->malign <= 0) && -- 2.40.0