From 73e9225d88bdd2be0d1ffbb3b569326256273474 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 16 Feb 2006 06:44:24 +0000 Subject: [PATCH] scroll usage; also spell of ID (trunk only) Make a not-very-robust fix for the report from about being told a scoll disappears as you read it, then for the case of cursed remove curse being told that the scroll disintegrates. He missed similar case for scroll of fire erupting into flames after it had disappeared. This suppresses the "disappears" part of the scroll reading message for those two cases, but won't be very reliable if other scroll messages referring to the scroll itself get introduced in the future. [Several paths through scroll of fire won't report that it burns, and now it doesn't give the disappears message any more. I don't think that's worth worrying about; the scroll leaving inventory after burning up is implicit.] Also cut down on redundant feedback for several scrolls (genocide, charging, identify, stinking cloud) that start off by informing the player what they are. That's only needed when the the player doesn't already know the type of scroll. I've always felt it silly to be told that I've "found a scroll of genocide" when I'm intentionally reading a known scroll of genocide. All these types of scroll give a subsequent prompt which makes them recongizable if you somehow manage to choose the wrong object when picking the one to read. Lastly, make spell of identify behave like ordinary uncursed scroll of identify by default instead of ususally ID'ing multiple items. Now you'll need to be skilled or better in divination spells skill in order to get the blessed scroll effect out of it. And give some feedback if the spell is cast when not carrying any inventory; it was just silently moving on to the user's next command in that case. --- doc/fixes35.0 | 1 + include/extern.h | 2 +- src/cmd.c | 6 +-- src/read.c | 103 +++++++++++++++++++++++++++-------------------- src/sit.c | 4 +- src/spell.c | 2 +- 6 files changed, 68 insertions(+), 50 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 75d5a4875..831e9dace 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -122,6 +122,7 @@ put #define for potion occupant chance and cursed wand zap chance in one place candles should not be fireproof recognize most instances where hallucinatory monster name should be treated as a personal name (to avoid "the Barney") instead of a description +avoid giving misleading or redundant feedback when reading scrolls Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 274dc1be6..ffe69555b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -832,7 +832,7 @@ E struct obj *FDECL(getobj, (const char *,const char *)); E int FDECL(ggetobj, (const char *,int (*)(OBJ_P),int,BOOLEAN_P,unsigned *)); E void FDECL(fully_identify_obj, (struct obj *)); E int FDECL(identify, (struct obj *)); -E void FDECL(identify_pack, (int)); +E void FDECL(identify_pack, (int,BOOLEAN_P)); E int FDECL(askchain, (struct obj **,const char *,int,int (*)(OBJ_P), int (*)(OBJ_P),int,const char *)); E void FDECL(prinv, (const char *,struct obj *,long)); diff --git a/src/cmd.c b/src/cmd.c index f2beb6d9c..b68dcdebf 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)cmd.c 3.5 2005/11/19 */ +/* SCCS Id: @(#)cmd.c 3.5 2006/02/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -513,14 +513,14 @@ wiz_wish() /* Unlimited wishes for debug mode by Paul Polderman */ return 0; } -/* ^I command - identify hero's inventory */ +/* ^I command - reveal and optionally identify hero's inventory */ STATIC_PTR int wiz_identify() { if (wizard) { iflags.override_ID = (int)cmd_from_func(wiz_identify); if (display_inventory((char *)0, TRUE) == -1) - identify_pack(0); + identify_pack(0, FALSE); iflags.override_ID = 0; } else pline("Unavailable command '^I'."); return 0; diff --git a/src/read.c b/src/read.c index 008eea41c..5fab84ee6 100644 --- a/src/read.c +++ b/src/read.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)read.c 3.5 2005/10/07 */ +/* SCCS Id: @(#)read.c 3.5 2006/02/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -32,7 +32,7 @@ int doread() { register struct obj *scroll; - register boolean confused; + boolean confused, nodisappear; known = FALSE; if(check_capacity((char *)0)) return (0); @@ -116,19 +116,26 @@ doread() return(study_book(scroll)); } scroll->in_use = TRUE; /* scroll, not spellbook, now being read */ - if(scroll->otyp != SCR_BLANK_PAPER) { - if(Blind) - pline("As you %s the formula on it, the scroll disappears.", - is_silent(youmonst.data) ? "cogitate" : "pronounce"); - else - pline("As you read the scroll, it disappears."); - if(confused) { - if (Hallucination) - pline("Being so trippy, you screw up..."); + if (scroll->otyp != SCR_BLANK_PAPER) { + /* a few scroll feedback messages describe something happening + to the scroll itself, so avoid "it disappears" for those */ + nodisappear = (scroll->otyp == SCR_FIRE || + (scroll->otyp == SCR_REMOVE_CURSE && scroll->cursed)); + if (Blind) + pline(nodisappear ? "You %s the formula on the scroll." : + "As you %s the formula on it, the scroll disappears.", + is_silent(youmonst.data) ? "cogitate" : "pronounce"); else - pline("Being confused, you mis%s the magic words...", - is_silent(youmonst.data) ? "understand" : "pronounce"); - } + pline(nodisappear ? "You read the scroll." : + "As you read the scroll, it disappears."); + if (confused) { + if (Hallucination) + pline("Being so trippy, you screw up..."); + else + pline("Being confused, you %s the magic words...", + is_silent(youmonst.data) ? "misunderstand" : + "mispronounce"); + } } if(!seffects(scroll)) { if(!objects[scroll->otyp].oc_name_known) { @@ -647,12 +654,15 @@ seffects(sobj) struct obj *sobj; { int cval; - boolean confused = (Confusion != 0), + boolean confused = (Confusion != 0), already_known, old_erodeproof, new_erodeproof; struct obj *otmp; if (objects[sobj->otyp].oc_magic) exercise(A_WIS, TRUE); /* just for trying */ + already_known = (sobj->oclass == SPBOOK_CLASS || /* spell */ + objects[sobj->otyp].oc_name_known); + switch(sobj->otyp) { #ifdef MAIL case SCR_MAIL: @@ -1059,7 +1069,8 @@ struct obj *sobj; } break; case SCR_GENOCIDE: - You("have found a scroll of genocide!"); + if (!already_known) + You("have found a scroll of genocide!"); known = TRUE; if (sobj->blessed) do_class_genocide(); else do_genocide(!sobj->cursed | (2 * !!Confusion)); @@ -1090,26 +1101,33 @@ struct obj *sobj; if (food_detect(sobj)) return(1); /* nothing detected */ break; - case SPE_IDENTIFY: - cval = rn2(5); - goto id; case SCR_IDENTIFY: /* known = TRUE; */ - if(confused) - You("identify this as an identify scroll."); - else - pline("This is an identify scroll."); - if (sobj->blessed || (!sobj->cursed && !rn2(5))) { - cval = rn2(5); - /* Note: if rn2(5)==0, identify all items */ - if (cval == 1 && sobj->blessed && Luck > 0) ++cval; - } else cval = 1; - if(!objects[sobj->otyp].oc_name_known) more_experienced(0,10); + if (confused) + You("identify this as an identify scroll."); + else if (!already_known || + /* force feedback now if invent will become + empty after using up this scroll */ + (sobj->quan == 1L && inv_cnt() == 1)) + pline("This is an identify scroll."); + if (!already_known) more_experienced(0, 10); useup(sobj); makeknown(SCR_IDENTIFY); - id: - if(invent && !confused) { - identify_pack(cval); + /*FALLTHRU*/ + case SPE_IDENTIFY: + cval = 1; + if (sobj->blessed || (!sobj->cursed && !rn2(5))) { + cval = rn2(5); + /* note: if cval==0, identify all items */ + if (cval == 1 && sobj->blessed && Luck > 0) ++cval; + } + if (invent && !confused) { + identify_pack(cval, !already_known); + } else if (sobj->otyp == SPE_IDENTIFY) { + /* when casting a spell we know we're not confused, + so inventory must be empty (another message has + already been given above if reading a scroll) */ + pline("You're not carrying anything to be identified."); } return(1); case SCR_CHARGING: @@ -1128,7 +1146,8 @@ struct obj *sobj; break; } known = TRUE; - pline("This is a charging scroll."); + if (!already_known) + pline("This is a charging scroll."); otmp = getobj(all_count, "charge"); if (!otmp) break; recharge(otmp, sobj->cursed ? -1 : (sobj->blessed ? 1 : 0)); @@ -1183,12 +1202,8 @@ struct obj *sobj; exercise(A_WIS, FALSE); break; case SCR_FIRE: - /* - * Note: Modifications have been made as of 3.0 to allow for - * some damage under all potential cases. - */ cval = bcsign(sobj); - if(!objects[sobj->otyp].oc_name_known) more_experienced(0,10); + if (!already_known) more_experienced(0,10); useup(sobj); makeknown(SCR_FIRE); if(confused) { @@ -1206,9 +1221,9 @@ struct obj *sobj; } return(1); } - if (Underwater) - pline_The("water around you vaporizes violently!"); - else { + if (Underwater) { + pline_The("water around you vaporizes violently!"); + } else { pline_The("scroll erupts in a tower of flame!"); burn_away_slime(); } @@ -1344,9 +1359,11 @@ struct obj *sobj; { coord cc; - You("have found a scroll of stinking cloud!"); + if (!already_known) + You("have found a scroll of stinking cloud!"); known = TRUE; - pline("Where do you want to center the cloud?"); + pline("Where do you want to center the %scloud?", + already_known ? "stinking " : ""); cc.x = u.ux; cc.y = u.uy; if (getpos(&cc, TRUE, "the desired position") < 0) { diff --git a/src/sit.c b/src/sit.c index be415f1bc..1eea68bb5 100644 --- a/src/sit.c +++ b/src/sit.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)sit.c 3.5 2005/06/02 */ +/* SCCS Id: @(#)sit.c 3.5 2006/03/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -262,7 +262,7 @@ dosit() You("are granted an insight!"); if (invent) { /* rn2(5) agrees w/seffects() */ - identify_pack(rn2(5)); + identify_pack(rn2(5), FALSE); } break; case 13: diff --git a/src/spell.c b/src/spell.c index a9a961727..f58122c20 100644 --- a/src/spell.c +++ b/src/spell.c @@ -947,13 +947,13 @@ boolean atme; case SPE_CONFUSE_MONSTER: case SPE_DETECT_FOOD: case SPE_CAUSE_FEAR: + case SPE_IDENTIFY: /* high skill yields effect equivalent to blessed scroll */ if (role_skill >= P_SKILLED) pseudo->blessed = 1; /* fall through */ case SPE_CHARM_MONSTER: case SPE_MAGIC_MAPPING: case SPE_CREATE_MONSTER: - case SPE_IDENTIFY: (void) seffects(pseudo); break; -- 2.40.0