Merge branch 'master' into paxed-new_lev_comp
Conflicts: .gitignore doc/fixes35.0 include/obj.h include/patchlevel.h src/dig.c src/mklev.c src/rumors.c src/save.c src/topten.c src/trap.c sys/winnt/Makefile.msc util/makedefs.c win/win32/levstuff.mak
This commit is contained in:
55
src/trap.c
55
src/trap.c
@@ -621,7 +621,7 @@ int *fail_reason;
|
||||
"statue");
|
||||
pline("%s %s!", upstart(statuename), comes_to_life);
|
||||
} else if (Hallucination) { /* They don't know it's a statue */
|
||||
pline_The("%s suddenly seems more animated.", rndmonnam());
|
||||
pline_The("%s suddenly seems more animated.", rndmonnam(NULL));
|
||||
} else if (cause == ANIMATE_SHATTER) {
|
||||
if (cansee(x, y))
|
||||
Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
|
||||
@@ -3145,6 +3145,14 @@ struct obj *obj;
|
||||
erode_obj(obj, NULL, ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
|
||||
}
|
||||
|
||||
/* context for water_damage(), managed by water_damage_chain();
|
||||
when more than one stack of potions of acid explode while processing
|
||||
a chain of objects, use alternate phrasing after the first message */
|
||||
static struct h2o_ctx {
|
||||
int dkn_boom, unk_boom; /* track dknown, !dknown separately */
|
||||
boolean ctx_valid;
|
||||
} acid_ctx = { 0, 0, FALSE };
|
||||
|
||||
/* Get an object wet and damage it appropriately.
|
||||
* "ostr", if present, is used instead of the object name in some
|
||||
* messages.
|
||||
@@ -3158,6 +3166,7 @@ const char *ostr;
|
||||
boolean force;
|
||||
{
|
||||
boolean exploded = FALSE;
|
||||
if (!obj) return ER_NOTHING;
|
||||
|
||||
if (snuff_lit(obj))
|
||||
return ER_DAMAGED;
|
||||
@@ -3201,18 +3210,36 @@ boolean force;
|
||||
return ER_DAMAGED;
|
||||
} else if (obj->oclass == POTION_CLASS) {
|
||||
if (obj->otyp == POT_ACID) {
|
||||
char *bufp, buf[BUFSZ];
|
||||
boolean one = (obj->quan == 1L);
|
||||
boolean update = carried(obj);
|
||||
char *bufp;
|
||||
boolean one = (obj->quan == 1L),
|
||||
update = carried(obj),
|
||||
exploded = FALSE;
|
||||
|
||||
bufp = strcpy(buf, "potion");
|
||||
if (!one) bufp = makeplural(bufp);
|
||||
/* [should we damage player/monster?] */
|
||||
if (Blind && !carried(obj)) obj->dknown = 0;
|
||||
if (acid_ctx.ctx_valid)
|
||||
exploded = ((obj->dknown ? acid_ctx.dkn_boom
|
||||
: acid_ctx.unk_boom) > 0);
|
||||
/* First message is
|
||||
* "a [potion|<color> potion|potion of acid] explodes"
|
||||
* depending on obj->dknown (potion has been seen) and
|
||||
* objects[POT_ACID].oc_name_known (fully discovered),
|
||||
* or "some {plural version} explode" when relevant.
|
||||
* Second and subsequent messages for same chain and
|
||||
* matching dknown status are
|
||||
* "another [potion|<color> &c] explodes" or plural
|
||||
* variant.
|
||||
*/
|
||||
bufp = simpleonames(obj);
|
||||
pline("%s %s %s!", /* "A potion explodes!" */
|
||||
!exploded ? (one ? "A" : "Some") :
|
||||
(one ? "Another" : "More"),
|
||||
(one ? "Another" : "More"),
|
||||
bufp, vtense(bufp, "explode"));
|
||||
exploded = TRUE;
|
||||
if (acid_ctx.ctx_valid) {
|
||||
if (obj->dknown)
|
||||
acid_ctx.dkn_boom++;
|
||||
else
|
||||
acid_ctx.unk_boom++;
|
||||
}
|
||||
setnotworn(obj);
|
||||
delobj(obj);
|
||||
if (update)
|
||||
@@ -3244,10 +3271,20 @@ struct obj *obj;
|
||||
boolean here;
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
/* initialize acid context: so far, neither seen (dknown) potions of
|
||||
acid nor unseen have exploded during this water damage sequence */
|
||||
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
|
||||
acid_ctx.ctx_valid = TRUE;
|
||||
|
||||
for (; obj; obj = otmp) {
|
||||
otmp = here ? obj->nexthere : obj->nobj;
|
||||
water_damage(obj, NULL, FALSE);
|
||||
}
|
||||
|
||||
/* reset acid context */
|
||||
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
|
||||
acid_ctx.ctx_valid = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user