From f0370f5f86bd6a79cfbc01e3d1cb706e6dc63298 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 18 May 2015 18:25:44 -0700 Subject: [PATCH] you feel {a,an unexpected} draft Move the message given when a monster digs through a closed door or a secret corridor into a separate routine. In theory, nethack should determine whether there is a path between the new opening and the hero's location in order to decide whether a draft can be felt. (I don't think anyone is likely to implement that--I'm certainly not. Checking whether the hero is in a room with no breaches in its walls could at least catch being inside a vault.) While at it, add some USA-centric puns about feeling the prospect of imminent military conscription instead of air current if it happens while hallucinating. --- include/extern.h | 3 ++- src/dig.c | 54 +++++++++++++++++++++++++++++++++++++++++++++--- src/zap.c | 4 ++-- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/include/extern.h b/include/extern.h index 65be6a55e..78120c82a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1429755449 2015/04/23 02:17:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.477 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1431998729 2015/05/19 01:25:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.492 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -276,6 +276,7 @@ E boolean FDECL(dighole, (BOOLEAN_P,BOOLEAN_P,coord *)); E int FDECL(use_pick_axe, (struct obj *)); E int FDECL(use_pick_axe2, (struct obj *)); E boolean FDECL(mdig_tunnel, (struct monst *)); +E void FDECL(draft_message, (BOOLEAN_P)); E void FDECL(watch_dig, (struct monst *,XCHAR_P,XCHAR_P,BOOLEAN_P)); E void NDECL(zap_dig); E struct obj *FDECL(bury_an_obj, (struct obj *, boolean *)); diff --git a/src/dig.c b/src/dig.c index b3a1bd8dd..0c6e54dba 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dig.c $NHDT-Date: 1431563241 2015/05/14 00:27:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.91 $ */ +/* NetHack 3.6 dig.c $NHDT-Date: 1431998736 2015/05/19 01:25:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */ /* NetHack 3.6 dig.c $Date: 2012/02/16 03:01:37 $ $Revision: 1.67 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1267,7 +1267,7 @@ register struct monst *mtmp; } } else { if (!rn2(3) && flags.verbose) /* not too often.. */ - You_feel("an unexpected draft."); + draft_message(TRUE); /* "You feel an unexpected draft." */ here->doormask = D_BROKEN; } newsym(mtmp->mx, mtmp->my); @@ -1276,7 +1276,7 @@ register struct monst *mtmp; here->typ = CORR; unblock_point(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my); - You_feel("a draft."); + draft_message(FALSE); /* "You feel a draft." */ return FALSE; } else if (!IS_ROCK(here->typ) && !IS_TREE(here->typ)) /* no dig */ return FALSE; @@ -1322,6 +1322,54 @@ register struct monst *mtmp; return FALSE; } +#define STRIDENT 4 /* from pray.c */ + +/* draft refers to air currents, but can be a pun on "draft" as conscription + for military service (probably not a good pun if it has to be explained) */ +void +draft_message(unexpected) +boolean unexpected; +{ + /* + * [Bug or TODO? Have caller pass coordinates and use the travel + * mechanism to determine whether there is a path between + * destroyed door (or exposed secret corridor) and hero's location. + * When there is no such path, no draft should be felt.] + */ + + if (unexpected) { + if (!Hallucination) + You_feel("an unexpected draft."); + else + /* U.S. classification system uses 1-A for eligible to serve + and 4-F for ineligible due to physical or mental defect; + some intermediate values exist but are rarely seen */ + You_feel("like you are %s.", + (ACURR(A_STR) < 6 || ACURR(A_DEX) < 6 + || ACURR(A_CON) < 6 || ACURR(A_CHA) < 6 + || ACURR(A_INT) < 6 || ACURR(A_WIS) < 6) ? "4-F" + : "1-A"); + } else { + if (!Hallucination) { + You_feel("a draft."); + } else { + /* "marching" is deliberately ambiguous; it might mean drills + after entering military service or mean engaging in protests */ + static const char *draft_reaction[] = { + "enlisting", "marching", "protesting", "fleeing", + }; + int dridx; + + /* Lawful: 0..1, Neutral: 1..2, Chaotic: 2..3 */ + dridx = rn1(2, 1 - sgn(u.ualign.type)); + if (u.ualign.record < STRIDENT) + /* L: +(0..2), N: +(-1..1), C: +(-2..0); all: 0..3 */ + dridx += rn1(3, sgn(u.ualign.type) - 1); + You_feel("like %s.", draft_reaction[dridx]); + } + } +} + /* digging via wand zap or spell cast */ void zap_dig() diff --git a/src/zap.c b/src/zap.c index c95a0baaf..a81d77d7c 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1431192757 2015/05/09 17:32:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.222 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1431998738 2015/05/19 01:25:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.223 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4318,7 +4318,7 @@ short exploding_wand_typ; pline("%s %s reveals a secret door.", yourzap ? "Your" : "The", zapverb); else if (Is_rogue_level(&u.uz)) - You_feel("a draft."); /* new open doorway */ + draft_message(FALSE); /* "You feel a draft." (open doorway) */ } /* regular door absorbs remaining zap range, possibly gets destroyed */