Make coalescence message be smart about status

- honor blindness and hallucination
- honor ability to see one of the mergees
- provide audible feedback if appropriate
- merging inside pack gets special-cased so player knows something
  different/unusual is happening
This commit is contained in:
Derek S. Ray
2015-04-21 21:47:33 -04:00
parent c9bb75eaf3
commit 0bef94cfde
5 changed files with 37 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 extern.h $NHDT-Date: 1428806395 2015/04/12 02:39:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.455 $ */
/* NetHack 3.5 extern.h $NHDT-Date: 1429666893 2015/04/22 01:41:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.467 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1723,6 +1723,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 void FDECL(pudding_merge_message, (struct obj*, struct obj*));
/* ### polyself.c ### */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 do.c $NHDT-Date: 1426991040 2015/03/22 02:24:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
/* NetHack 3.5 do.c $NHDT-Date: 1429666911 2015/04/22 01:41:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.130 $ */
/* NetHack 3.5 do.c $Date: 2014/11/18 03:10:39 $ $Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -217,7 +217,7 @@ const char *verb;
} else if (obj->globby) {
/* Globby things like puddings might stick together */
while (obj && (otmp = obj_nexto_xy(obj->otyp, x, y, obj->o_id)) != (struct obj*)0) {
pline("The %s coalesce.", makeplural(obj_typename(obj->otyp)));
pudding_merge_message(obj, otmp);
obj_meld(&obj, &otmp);
}
return (obj == NULL);

View File

@@ -301,7 +301,7 @@ struct obj **potmp, **pobj;
* free the other object automatically so we can just
* return out from here. */
if (Is_pudding(obj)) {
pline("The %s coalesce.", makeplural(obj_typename(obj->otyp)));
pudding_merge_message(otmp, obj);
obj_absorb(potmp, pobj);
return(1);
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mon.c $NHDT-Date: 1429584308 2015/04/21 02:45:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */
/* NetHack 3.5 mon.c $NHDT-Date: 1429666918 2015/04/22 01:41:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.165 $ */
/* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -281,7 +281,7 @@ unsigned corpseflags;
x, y, TRUE, FALSE);
while ((obj && (otmp = obj_nexto(obj)) != (struct obj*)0)) {
pline("The %s coalesce.", makeplural(obj_typename(obj->otyp)));
pudding_merge_message(obj, otmp);
obj = obj_meld(&obj, &otmp);
}
free_mname(mtmp);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 pline.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 pline.c $NHDT-Date: 1429666920 2015/04/22 01:42:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
/* NetHack 3.5 pline.c $Date: 2013/02/09 01:33:37 $ $Revision: 1.30 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -489,4 +489,33 @@ self_invis_message()
"can't see yourself");
}
void
pudding_merge_message(otmp, otmp2)
struct obj* otmp;
struct obj* otmp2;
{
boolean visible = cansee(otmp->ox, otmp->oy) || cansee(otmp2->ox, otmp2->oy);
boolean onfloor = otmp->where == OBJ_FLOOR || otmp2->where == OBJ_FLOOR;
boolean inpack = carried(otmp) || carried(otmp2);
/* the player will know something happened inside his own inventory */
if ((!Blind && visible) || inpack) {
if (Hallucination) {
if (onfloor) {
You_see("parts of the floor melting!");
} else if (inpack) {
Your("pack reaches out and grabs something!");
}
/* even though we can see where they should be,
* they'll be out of our view (minvent or container)
* so don't actually show anything */
} else if (onfloor || inpack) {
pline("The %s coalesce%s.", makeplural(obj_typename(otmp->otyp)),
inpack ? " inside your pack" : "");
}
} else {
You_hear("a faint sloshing sound.");
}
}
/*pline.c*/