From 411ee585939f3d1e6dc1b48854518d6832080de6 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 29 Mar 2015 22:08:46 +0300 Subject: [PATCH] Add more explicit helpless reasons Instead of just "while helpless", the death reason will tell more explicitly why the player was helpless. For example: "while frozen by a monster's gaze" --- doc/fixes35.0 | 1 + include/decl.h | 1 + src/apply.c | 6 +++++- src/artifact.c | 1 + src/decl.c | 1 + src/detect.c | 1 + src/dig.c | 1 + src/do_wear.c | 2 ++ src/dothrow.c | 1 + src/eat.c | 4 ++++ src/end.c | 7 ++++++- src/hack.c | 3 +++ src/mcastu.c | 2 ++ src/mhitu.c | 1 + src/pickup.c | 2 ++ src/polyself.c | 1 + src/potion.c | 4 ++++ src/pray.c | 3 +++ src/priest.c | 1 + src/sounds.c | 1 + src/spell.c | 3 +++ src/steal.c | 1 + src/timeout.c | 4 ++++ src/trap.c | 1 + src/uhitm.c | 3 +++ 25 files changed, 54 insertions(+), 2 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 6d859ff4d..03cb10a96 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1107,6 +1107,7 @@ cursor positioning ignores uninteresting dungeon features allow reading many more items when you're hiding under something a zap downward should not hit that something, while a zap upward should +show more explicit reason why player was helpless at death Platform- and/or Interface-Specific New Features diff --git a/include/decl.h b/include/decl.h index 15191842e..417ca9d62 100644 --- a/include/decl.h +++ b/include/decl.h @@ -28,6 +28,7 @@ E char SAVEP[]; E NEARDATA int bases[MAXOCLASSES]; E NEARDATA int multi; +E const char *multi_reason; E NEARDATA int nroom; E NEARDATA int nsubroom; E NEARDATA int occtime; diff --git a/src/apply.c b/src/apply.c index 6f13d6623..386365f49 100644 --- a/src/apply.c +++ b/src/apply.c @@ -737,8 +737,10 @@ struct obj *obj; pline("Yow! The %s stares back!", mirror); else pline("Yikes! You've frozen yourself!"); - if (!Hallucination || !rn2(4)) + if (!Hallucination || !rn2(4)) { nomul(-rnd(MAXULEV + 6 - u.ulevel)); + multi_reason = "gazing into a mirror"; + } nomovemsg = 0; /* default, "you can move again" */ } } else if (youmonst.data->mlet == S_VAMPIRE) @@ -916,6 +918,7 @@ struct obj **optr; break; case 2: /* no explanation; it just happens... */ nomovemsg = ""; + multi_reason = NULL; nomul(-rnd(2)); break; } @@ -1509,6 +1512,7 @@ int magic; /* 0=Physical, otherwise skill level */ teleds(cc.x, cc.y, TRUE); sokoban_guilt(); nomul(-1); + multi_reason = "jumping around"; nomovemsg = ""; morehungry(rnd(25)); return 1; diff --git a/src/artifact.c b/src/artifact.c index c9baaf365..81bfd4cf0 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -983,6 +983,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */ resisted = TRUE; } else { nomul(-3); + multi_reason = "being scared stiff"; nomovemsg = ""; if (magr && magr == u.ustuck && sticks(youmonst.data)) { u.ustuck = (struct monst *)0; diff --git a/src/decl.c b/src/decl.c index 75203c056..2df304575 100644 --- a/src/decl.c +++ b/src/decl.c @@ -21,6 +21,7 @@ char *catmore = 0; /* default pager */ NEARDATA int bases[MAXOCLASSES] = DUMMY; NEARDATA int multi = 0; +const char *multi_reason = NULL; NEARDATA int nroom = 0; NEARDATA int nsubroom = 0; NEARDATA int occtime = 0; diff --git a/src/detect.c b/src/detect.c index ecc4d3878..2af53021e 100644 --- a/src/detect.c +++ b/src/detect.c @@ -890,6 +890,7 @@ struct obj *obj; } You("peer into %s...", the(xname(obj))); nomul(-rnd(10)); + multi_reason = "gazing into a crystal ball"; nomovemsg = ""; if (obj->spe <= 0) pline_The("vision is unclear."); diff --git a/src/dig.c b/src/dig.c index fa25f76a0..f50d8aa76 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1023,6 +1023,7 @@ struct obj *obj; /* you ought to be able to let go; tough luck */ /* (maybe `move_into_trap()' would be better) */ nomul(-d(2,2)); + multi_reason = "stuck in a spider web"; nomovemsg = "You pull free."; } else if (lev->typ == IRONBARS) { pline("Clang!"); diff --git a/src/do_wear.c b/src/do_wear.c index 39d3b6c3f..ef04ee360 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1407,6 +1407,7 @@ register struct obj *otmp; if(cursed(otmp)) return(0); if(delay) { nomul(delay); + multi_reason = "disrobing"; if (is_helmet(otmp)) { /* ick... */ nomovemsg = !strcmp(helm_simple_name(otmp), "hat") ? @@ -1664,6 +1665,7 @@ dowear() delay = -objects[otmp->otyp].oc_delay; if(delay){ nomul(delay); + multi_reason = "dressing up"; if(is_boots(otmp)) afternmv = Boots_on; if(is_helmet(otmp)) afternmv = Helmet_on; if(is_gloves(otmp)) afternmv = Gloves_on; diff --git a/src/dothrow.c b/src/dothrow.c index aedb4fc40..ab4b96497 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -693,6 +693,7 @@ hurtle(dx, dy, range, verbose) if(!range || (!dx && !dy) || u.ustuck) return; /* paranoia */ nomul(-range); + multi_reason = "moving through the air"; nomovemsg = ""; /* it just happens */ if (verbose) You("%s in the opposite direction.", range > 1 ? "hurtle" : "float"); diff --git a/src/eat.c b/src/eat.c index a5b413772..cc87f399e 100644 --- a/src/eat.c +++ b/src/eat.c @@ -962,6 +962,7 @@ register int pm; /* A pile of gold can't ride. */ if (u.usteed) dismount_steed(DISMOUNT_FELL); nomul(-tmp); + multi_reason = "pretending to be a pile of gold"; Sprintf(buf, Hallucination ? "You suddenly dread being peeled and mimic %s again!" : "You now prefer mimicking %s again.", @@ -1479,6 +1480,7 @@ struct obj *obj; pline_The("world spins and %s %s.", what, where); incr_itimeout(&HDeaf, duration); nomul(-duration); + multi_reason = "unconscious from rotten food"; nomovemsg = "You are conscious again."; afternmv = Hear_again; return(1); @@ -2677,6 +2679,7 @@ boolean incr; if (!Levitation) selftouch("Falling, you"); incr_itimeout(&HDeaf, duration); nomul(-duration); + multi_reason = "fainted from lack of food"; nomovemsg = "You regain consciousness."; afternmv = unfaint; newhs = FAINTED; @@ -2853,6 +2856,7 @@ vomit() /* A good idea from David Neves */ else make_sick(0L, (char *)0, TRUE, SICK_VOMITABLE); nomul(-2); + multi_reason = "vomiting"; nomovemsg = You_can_move_again; } diff --git a/src/end.c b/src/end.c index 7ada39767..35a5393bd 100644 --- a/src/end.c +++ b/src/end.c @@ -465,7 +465,12 @@ int how; Sprintf(eos(buf), " called %s", MNAME(mtmp)); } - if (multi) Strcat(buf, ", while helpless"); + if (multi) { + if (multi_reason) + Sprintf(eos(buf), ", while %s", multi_reason); + else + Strcat(buf, ", while helpless"); + } Strcpy(killer.name, buf); if (mptr->mlet == S_WRAITH) u.ugrave_arise = PM_WRAITH; diff --git a/src/hack.c b/src/hack.c index 98e615ac8..32ceb8e69 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1568,6 +1568,7 @@ domove() /* must come after we finished picking up, in spoteffects() */ if (cause_delay) { nomul(-2); + multi_reason = "dragging an iron ball"; nomovemsg = ""; } @@ -2434,6 +2435,7 @@ nomul(nval) u.uinvulnerable = FALSE; /* Kludge to avoid ctrl-C bug -dlc */ u.usleep = 0; multi = nval; + if (nval == 0) multi_reason = NULL; context.travel = context.travel1 = context.mv = context.run = 0; } @@ -2448,6 +2450,7 @@ const char *msg_override; if (*nomovemsg) pline1(nomovemsg); nomovemsg = 0; u.usleep = 0; + multi_reason = NULL; if (afternmv) (*afternmv)(); afternmv = 0; } diff --git a/src/mcastu.c b/src/mcastu.c index a677db12e..03c06f2ed 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -634,12 +634,14 @@ int spellnum; if (multi >= 0) You("stiffen briefly."); nomul(-1); + multi_reason = "paralyzed by a monster"; } else { if (multi >= 0) You("are frozen in place!"); dmg = 4 + (int)mtmp->m_lev; if (Half_spell_damage) dmg = (dmg + 1) / 2; nomul(-dmg); + multi_reason = "paralyzed by a monster"; } nomovemsg = 0; dmg = 0; diff --git a/src/mhitu.c b/src/mhitu.c index 6aa4225f7..9ec602895 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1053,6 +1053,7 @@ dopois: else You("are frozen by %s!", mon_nam(mtmp)); nomovemsg = You_can_move_again; nomul(-rnd(10)); + multi_reason = "paralyzed by a monster"; exercise(A_DEX, FALSE); } } diff --git a/src/pickup.c b/src/pickup.c index d2a76416c..bf5d06129 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2121,6 +2121,7 @@ int held; /* even if the trap fails, you've used up this turn */ if (multi >= 0) { /* in case we didn't become paralyzed */ nomul(-1); + multi_reason = "opening a container"; nomovemsg = ""; } return 1; @@ -2630,6 +2631,7 @@ struct obj *box; /* or bag */ /* even if the trap fails, you've used up this turn */ if (multi >= 0) { /* in case we didn't become paralyzed */ nomul(-1); + multi_reason = "tipping a container"; nomovemsg = ""; } } else if (box->otyp == BAG_OF_TRICKS || box->otyp == HORN_OF_PLENTY) { diff --git a/src/polyself.c b/src/polyself.c index 3effba8b2..023b1f44a 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1285,6 +1285,7 @@ dogaze() -d((int)mtmp->m_lev+1, (int)mtmp->data->mattk[0].damd) : -200); + multi_reason = "frozen by a monster's gaze"; nomovemsg = 0; return 1; } else diff --git a/src/potion.c b/src/potion.c index d9e5e9ca8..d32c65b65 100644 --- a/src/potion.c +++ b/src/potion.c @@ -375,6 +375,7 @@ ghost_from_bottle() if(flags.verbose) You("are frightened to death, and unable to move."); nomul(-3); + multi_reason = "being frightened to death"; nomovemsg = "You regain your composure."; } @@ -678,6 +679,7 @@ peffects(otmp) Your("%s are frozen to the %s!", makeplural(body_part(FOOT)), surface(u.ux, u.uy)); nomul(-(rn1(10, 25 - 12*bcsign(otmp)))); + multi_reason = "frozen by a potion"; nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } @@ -1467,6 +1469,7 @@ register struct obj *obj; if (!Free_action) { pline("%s seems to be holding you.", Something); nomul(-rnd(5)); + multi_reason = "frozen by a potion"; nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } else You("stiffen momentarily."); @@ -1476,6 +1479,7 @@ register struct obj *obj; if (!Free_action && !Sleep_resistance) { You_feel("rather tired."); nomul(-rnd(5)); + multi_reason = "sleeping off a magical draught"; nomovemsg = You_can_move_again; exercise(A_DEX, FALSE); } else You("yawn."); diff --git a/src/pray.c b/src/pray.c index ffdee9b49..bd95018c4 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1269,6 +1269,7 @@ dosacrifice() dmon->mpeaceful = TRUE; You("are terrified, and unable to move."); nomul(-3); + multi_reason = "being terrified of a demon"; nomovemsg = 0; } else pline_The("%s.", demonless_msg); } @@ -1655,6 +1656,7 @@ dopray() } } nomul(-3); + multi_reason = "praying"; nomovemsg = "You finish your prayer."; afternmv = prayer_done; @@ -1817,6 +1819,7 @@ doturn() } } nomul(-5); + multi_reason = "trying to turn the monsters"; nomovemsg = You_can_move_again; return(1); } diff --git a/src/priest.c b/src/priest.c index a28f2b8d4..0b520cfdf 100644 --- a/src/priest.c +++ b/src/priest.c @@ -475,6 +475,7 @@ int roomno; if (flags.verbose) You("are frightened to death, and unable to move."); nomul(-3); + multi_reason = "being terrified of a demon"; nomovemsg = "You regain your composure."; } } diff --git a/src/sounds.c b/src/sounds.c index d8d78b4cc..f1dec986f 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -710,6 +710,7 @@ register struct monst *mtmp; pline("%s rattles noisily.", Monnam(mtmp)); You("freeze for a moment."); nomul(-2); + multi_reason = "scared by rattling"; nomovemsg = 0; break; case MS_LAUGH: diff --git a/src/spell.c b/src/spell.c index 53b8626f0..5ce0a6015 100644 --- a/src/spell.c +++ b/src/spell.c @@ -329,6 +329,7 @@ learn(VOID_ARGS) context.spbook.book = 0; /* no longer studying */ context.spbook.o_id = 0; nomul(context.spbook.delay); /* remaining delay is uninterrupted */ + multi_reason = "reading a book"; nomovemsg = 0; context.spbook.delay = 0; return(0); @@ -506,6 +507,7 @@ register struct obj *spellbook; boolean gone = cursed_book(spellbook); nomul(context.spbook.delay); /* study time */ + multi_reason = "reading a book"; nomovemsg = 0; context.spbook.delay = 0; if(gone || !rn2(3)) { @@ -522,6 +524,7 @@ register struct obj *spellbook; spellbook->in_use = FALSE; } nomul(context.spbook.delay); + multi_reason = "reading a book"; nomovemsg = 0; context.spbook.delay = 0; return(1); diff --git a/src/steal.c b/src/steal.c index c73878310..f803ae4da 100644 --- a/src/steal.c +++ b/src/steal.c @@ -361,6 +361,7 @@ gotobj: named++; /* the following is to set multi for later on */ nomul(-armordelay); + multi_reason = "taking off clothes"; nomovemsg = 0; remove_worn_item(otmp, TRUE); otmp->cursed = curssv; diff --git a/src/timeout.c b/src/timeout.c index e47d863fb..e1ccaf96e 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -51,6 +51,7 @@ stoned_dialogue() case 3: /* limbs turned to stone */ stop_occupation(); nomul(-3); /* can't move anymore */ + multi_reason = "getting stoned"; nomovemsg = You_can_move_again; /* not unconscious */ break; default: @@ -377,6 +378,7 @@ nh_timeout() if (u.umoved && !Levitation) { slip_or_trip(); nomul(-2); + multi_reason = "fumbling"; nomovemsg = ""; /* The more you are carrying the more likely you * are to make noise when you fumble. Adjustments @@ -409,6 +411,7 @@ boolean wakeup_msg; { stop_occupation(); nomul(how_long); + multi_reason = "sleeping"; /* generally don't notice sounds while sleeping */ if (wakeup_msg && multi == how_long) { /* caller can follow with a direct call to Hear_again() if @@ -1271,6 +1274,7 @@ do_storms() if(!u.uinvulnerable) { stop_occupation(); nomul(-3); + multi_reason = "hiding from thunderstorm"; nomovemsg = 0; } } else diff --git a/src/trap.c b/src/trap.c index 47d8d99b2..775bca5cb 100644 --- a/src/trap.c +++ b/src/trap.c @@ -4447,6 +4447,7 @@ boolean disarm; if (!Free_action) { pline("Suddenly you are frozen in place!"); nomul(-d(5, 6)); + multi_reason = "frozen by a trap"; exercise(A_DEX, FALSE); nomovemsg = You_can_move_again; } else You("momentarily stiffen."); diff --git a/src/uhitm.c b/src/uhitm.c index 80f38addf..2bf963c94 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1871,6 +1871,7 @@ register struct attack *mattk; You("digest %s.", mon_nam(mdef)); if (Slow_digestion) tmp *= 2; nomul(-tmp); + multi_reason = "digesting something"; nomovemsg = msgbuf; } else pline1(msgbuf); if (pd == &mons[PM_GREEN_SLIME]) { @@ -2353,6 +2354,7 @@ boolean wep_was_destroyed; You("are frozen by %s gaze!", s_suffix(mon_nam(mon))); nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127); + multi_reason = "frozen by a monster's gaze"; nomovemsg = 0; } } else { @@ -2366,6 +2368,7 @@ boolean wep_was_destroyed; You("are frozen by %s!", mon_nam(mon)); nomovemsg = You_can_move_again; nomul(-tmp); + multi_reason = "frozen by a monster"; exercise(A_DEX, FALSE); } break; -- 2.40.0