From ccb9171b5884a80787b98b1845f5a8e8e6275165 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 7 Jul 2008 14:23:40 +0000 Subject: Fix potions of decay created by mummy curse sometimes being inscribed. Change inscription prompt to work as intended by David, after all. :) Make manuals use a reading counter (plus2) that is initialized with 3 + random2(15). Once it reaches 0, the manual crumbles to dust. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6443 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/database/help.txt | 2 +- crawl-ref/source/debug.cc | 6 ++- crawl-ref/source/describe.cc | 96 +++++++++++++++++++++------------- crawl-ref/source/effects.cc | 5 +- crawl-ref/source/it_use3.cc | 5 +- crawl-ref/source/makeitem.cc | 9 ++-- crawl-ref/source/misc.cc | 33 ++++++------ crawl-ref/source/util/docs/README.tex | 2 +- crawl-ref/source/view.cc | 2 +- 9 files changed, 94 insertions(+), 66 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dat/database/help.txt b/crawl-ref/source/dat/database/help.txt index 69a4a889f5..01f36ee211 100644 --- a/crawl-ref/source/dat/database/help.txt +++ b/crawl-ref/source/dat/database/help.txt @@ -64,7 +64,7 @@ level-map Esc : Leave level map (also Space or any unused key). Dir. : Move the cursor. / Dir. : Move the cursor in larger steps (also Shift-Dir.). --/+ : Scroll level map up/down +-/+ : Scroll level map 20 grids up/down. . : Start travel (also Enter and , and ;). (Moves cursor to the last travel destination if still on @.) <</> : Cycle through up/down stairs. diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index aaf7cce8a4..4ce700daa2 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -1370,8 +1370,12 @@ void wizard_create_spec_object() { special_wanted = _debug_prompt_for_skill( "A manual for which skill? " ); + if (special_wanted != -1) - mitm[thing_created].plus = special_wanted; + { + mitm[thing_created].plus = special_wanted; + mitm[thing_created].plus2 = 3 + random2(15); + } else mpr( "Sorry, no books on that skill today." ); } diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 5adabd8e35..658191e1c8 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2059,8 +2059,9 @@ void inscribe_item(item_def &item, bool proper_prompt) } } - std::string prompt = (is_inscribed ? "Add what to inscription? " - : "Inscribe with what? "); + std::string prompt = (is_inscribed ? "Add to inscription? " + : "Inscribe item? "); + if (need_autoinscribe || is_inscribed) { prompt += "(You may also "; @@ -2068,7 +2069,7 @@ void inscribe_item(item_def &item, bool proper_prompt) { prompt += "(a)utoinscribe"; if (is_inscribed) - prompt += " or "; + prompt += ", or "; } if (is_inscribed) prompt += "(c)lear it"; @@ -2082,54 +2083,77 @@ void inscribe_item(item_def &item, bool proper_prompt) prompt = "" + prompt + ""; formatted_string::parse_string(prompt).display(); - if (Options.tutorial_left && wherey() <= get_number_of_lines() - 5) + if (Options.tutorial_left && wherey() <= get_number_of_lines() - 5) tutorial_inscription_info(need_autoinscribe, prompt); } - char buf[79]; - if (!cancelable_get_line(buf, sizeof buf)) + int keyin = tolower(c_getch()); + switch (keyin) { - // Strip spaces from the end. - for (int i = strlen(buf) - 1; i >= 0; i--) - { - if (isspace( buf[i] )) - buf[i] = 0; - else - break; - } + case 'a': + // Remove previous randart inscription + _trim_randart_inscrip(item); - if (need_autoinscribe && buf[1] == 0 - && (buf[0] == 'a' || buf[0] == 'A')) - { - // Remove previous randart inscription - _trim_randart_inscrip(item); + if (!item.inscription.empty()) + item.inscription += ", "; - if (!item.inscription.empty()) - item.inscription += ", "; + item.inscription += ainscrip; + break; + case 'c': + item.inscription.clear(); + break; + case 'y': + { + prompt = (is_inscribed ? "Add what to inscription? " + : "Inscribe with what? "); - item.inscription += ainscrip; - } - else if (is_inscribed && buf[1] == 0 - && (buf[0] == 'c' || buf[0] == 'C')) + if (proper_prompt) + mpr(prompt.c_str(), MSGCH_PROMPT); + else { - item.inscription.clear(); + prompt = EOL "" + prompt + ""; + formatted_string::parse_string(prompt).display(); } - else if (strlen(buf) > 0) + + char buf[79]; + if (!cancelable_get_line(buf, sizeof buf)) { - if (is_inscribed) - item.inscription += ", "; + // Strip spaces from the end. + for (int i = strlen(buf) - 1; i >= 0; i--) + { + if (isspace( buf[i] )) + buf[i] = 0; + else + break; + } - item.inscription += std::string(buf); - } + if (strlen(buf) > 0) + { + if (is_inscribed) + item.inscription += ", "; - if (proper_prompt) + item.inscription += std::string(buf); + } + } + else if (proper_prompt) { - mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); - you.wield_change = true; + canned_msg(MSG_OK); + return; } + break; } - else if (proper_prompt) - canned_msg(MSG_OK); + default: + if (proper_prompt) + canned_msg(MSG_OK); + return; + } + + if (proper_prompt) + { + mpr(item.name(DESC_INVENTORY).c_str(), MSGCH_EQUIPMENT); + you.wield_change = true; + } + } //--------------------------------------------------------------- // diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index db5f40a017..123b2131c3 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1493,9 +1493,8 @@ bool acquirement(object_class_type class_wanted, int agent, { // How sad (and stupid). if (!silenced(you.pos()) && !quiet) - { mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos()))); - } + item_was_destroyed(mitm[igrd(you.pos())], NON_MONSTER); *item_index = NON_ITEM; } @@ -1505,6 +1504,8 @@ bool acquirement(object_class_type class_wanted, int agent, for (int item_tries = 0; item_tries < 40; item_tries++) { int type_wanted = _find_acquirement_subtype(class_wanted, quant); + if (class_wanted == OBJ_BOOKS) + type_wanted = BOOK_MANUAL; // Clobber class_wanted for vampires. if (you.species == SP_VAMPIRE && class_wanted == OBJ_FOOD) diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index ef0ed9af09..19eb0173e7 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -942,15 +942,14 @@ void skill_manual(int slot) exercise(skill, 500); - if (one_chance_in(10)) + if (--manual.plus2 <= 0) { mpr("The manual crumbles into dust."); dec_inv_item_quantity( slot, 1 ); } else - { mpr("The manual looks somewhat more worn."); - } + xom_is_stimulated(14); } diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index d9a177a2e7..9897f63201 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2453,7 +2453,7 @@ static void _generate_book_item(item_def& item, int force_type, if (one_chance_in(10)) item.special += random2(8) * 10; - if ( force_type != OBJ_RANDOM ) + if (force_type != OBJ_RANDOM) item.sub_type = force_type; else { @@ -2500,6 +2500,8 @@ static void _generate_book_item(item_def& item, int force_type, if (item.plus == SK_UNUSED_1) item.plus = SK_UNARMED_COMBAT; } + // Set number of reads possible before it "crumbles to dust". + item.plus2 = 3 + random2(15); } } @@ -2895,8 +2897,7 @@ static bool _weapon_is_visibly_special(const item_def &item) return (true); if ((item.plus || item.plus2) - && (one_chance_in(3) - || get_equip_race(item) && one_chance_in(7))) + && (one_chance_in(3) || get_equip_race(item) && one_chance_in(7))) { return (true); } @@ -3458,9 +3459,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level, set_item_ego_type( item, OBJ_WEAPONS, SPWPN_HOLY_WRATH ); } else - { item.sub_type = WPN_LONG_SWORD; - } item.plus = 1 + random2(3); item.plus2 = 1 + random2(3); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index aa560a50d4..715a70edd3 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -969,8 +969,8 @@ void split_potions_into_decay( int obj, int amount, bool need_msg ) if (need_msg && get_ident_type(OBJ_POTIONS, POT_DECAY) == ID_KNOWN_TYPE) _potion_stack_changed_message(potion, amount, false); - // just in case - you.wield_change = true; + if (you.equip[EQ_WEAPON] == obj) + you.wield_change = true; you.redraw_quiver = true; if (is_blood_potion(potion)) @@ -996,7 +996,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg ) else you.inv[obj].quantity -= amount; - you.inv[m].quantity += amount; + you.inv[m].quantity += amount; return; } @@ -1015,20 +1015,21 @@ void split_potions_into_decay( int obj, int amount, bool need_msg ) if (freeslot >= 0 && freeslot < ENDOFPACK && !is_valid_item(you.inv[freeslot])) { - item_def &item = you.inv[freeslot]; - item.link = freeslot; - item.slot = index_to_letter(item.link); - item.base_type = OBJ_POTIONS; - item.sub_type = POT_DECAY; - item.quantity = amount; - item.x = -1; - item.y = -1; + item_def &item = you.inv[freeslot]; + item.link = freeslot; + item.slot = index_to_letter(item.link); + item.base_type = OBJ_POTIONS; + item.sub_type = POT_DECAY; + item.quantity = amount; + item.x = -1; + item.y = -1; // Keep description as it was. - item.plus = potion.plus; - item.plus2 = 0; - item.special = 0; - item.flags = 0; - item.colour = potion.colour; + item.plus = potion.plus; + item.plus2 = 0; + item.special = 0; + item.flags = 0; + item.colour = potion.colour; + item.inscription = ""; you.inv[obj].quantity -= amount; return; diff --git a/crawl-ref/source/util/docs/README.tex b/crawl-ref/source/util/docs/README.tex index 71e73430ea..fbe7b286c9 100644 --- a/crawl-ref/source/util/docs/README.tex +++ b/crawl-ref/source/util/docs/README.tex @@ -91,7 +91,7 @@ reading this file until later. You can browse the manual while playing tweaking these can improve your \crawl\ experience, you will probably prefer to skip this at first. \\ -\key{crawl\_macros.txt} explains macros and key bindings. You should probably +\key{macros\_guide.txt} explains macros and key bindings. You should probably ignore this at first, too. % (Unless you experience serious problems with some keys, in which case should % look at the keymaps section.) diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index c25c8d874f..c6c0ca1420 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -3159,7 +3159,7 @@ void show_map( coord_def &spec_place, bool travel_mode ) int screen_y = you.y_pos; - // if close to top of known map, put min_y on top + // If close to top of known map, put min_y on top // else if close to bottom of known map, put max_y on bottom. // // The num_lines comparisons are done to keep things neat, by -- cgit v1.2.3-54-g00ecf