From f3b1762e5a7ce54cb41729e3d4cedf482c4a42e9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 26 Mar 2009 23:24:34 +0000 Subject: * Fix Xom's interest wrapping around from 0 to 255. (!!!) * In xom_acts, if Xom was bored (and now did something bad) reroll interest. * Greatly decrease amusement derived from the player entering a new level. (However, entering a new level via escape hatch or shaft is REALLY amusing, more so the deeper the shaft.) * Xom may be amused if you are caught in a net and there are hostile monsters around. * Fix draconian tiles not showing up correctly for Detect Creatures. * Improve card descriptions output for Triple Draw/Stack Five. * In inventory, add '&' hotkey for useless (== inedible) chunks. Still needs documentation. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9557 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 8 ++++-- crawl-ref/source/debug.cc | 9 +++---- crawl-ref/source/decks.cc | 7 ++++-- crawl-ref/source/fight.cc | 2 +- crawl-ref/source/invent.cc | 44 ++++++++++++++++++++++++-------- crawl-ref/source/it_use3.cc | 11 ++++---- crawl-ref/source/misc.cc | 29 ++++++++++++--------- crawl-ref/source/spl-book.cc | 2 +- crawl-ref/source/spl-mis.cc | 2 +- crawl-ref/source/tilepick.cc | 18 +++++++------ crawl-ref/source/traps.cc | 15 ++++++++--- crawl-ref/source/traps.h | 2 +- crawl-ref/source/xom.cc | 60 +++++++++++++++++++++----------------------- crawl-ref/source/xom.h | 6 ++--- 14 files changed, 128 insertions(+), 87 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index f9fff73040..68977eecb5 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3872,8 +3872,12 @@ void bolt::affect_player() // in item_use.cc. if (item->sub_type == MI_THROWING_NET) { - player_caught_in_net(); - was_affected = true; + if (player_caught_in_net()) + { + if (beam_source != NON_MONSTER) + xom_is_stimulated(64); + was_affected = true; + } } else if (item->special == SPMSL_CURARE) { diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index a17888f2c4..4736162af4 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -2429,14 +2429,11 @@ void wizard_gain_piety() if (one_chance_in(10)) you.gift_timeout = 0; else - you.gift_timeout = random2(256); // reroll interest + you.gift_timeout = random2(40) + random2(40); // reroll interest const std::string new_xom_favour = describe_xom_favour(); - if (old_xom_favour != new_xom_favour) - { - const std::string msg = "Your title is now: " + new_xom_favour; - god_speaks(you.religion, msg.c_str()); - } + const std::string msg = "Your title is now: " + new_xom_favour; + god_speaks(you.religion, msg.c_str()); return; } diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 8d9d1fc039..85aed45828 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -940,9 +940,12 @@ static void _describe_cards(std::vector cards) if (desc.empty()) desc = "No description found."; - data << name << "$$" << desc << "$$"; + name = uppercase_first(name); + data << "" << name << "" << EOL << desc << EOL EOL; } - print_description(data.str()); + formatted_string fs = formatted_string::parse_string(data.str()); + clrscr(); + fs.display(); if (getch() == 0) getch(); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 26c4ce3644..f19d487dbb 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3432,7 +3432,7 @@ int melee_attack::player_to_hit(bool random_factor) your_to_hit -= 5; const bool see_invis = player_see_invis(); - // if you can't see yourself, you're a little less accurate. + // If you can't see yourself, you're a little less accurate. if (you.invisible() && !see_invis) your_to_hit -= 5; diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 95ae61ecee..73be3dd37f 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -289,6 +289,15 @@ void InvEntry::add_class_hotkeys(const item_def &i) _get_class_hotkeys(type, glyphs); for (unsigned int k = 0; k < glyphs.size(); ++k) add_hotkey(glyphs[k]); + + // Hack to make rotten chunks answer to '&' as well. + // Check for uselessness rather than inedibility to cover the spells + // that use chunks. + if (i.base_type == OBJ_FOOD && i.sub_type == FOOD_CHUNK + && is_useless_item(i)) + { + add_hotkey('&'); + } } bool InvEntry::show_prices = false; @@ -503,20 +512,33 @@ bool InvEntry::get_tiles(std::vector& tileset) const { // Do we want to display the floor type or is that too distracting? const coord_def c = item->pos; - int ch = tileidx_feature(grd(c), c.x, c.y); - if (ch == TILE_FLOOR_NORMAL) - ch = env.tile_flv(c).floor; - else if (ch == TILE_WALL_NORMAL) - ch = env.tile_flv(c).wall; + int ch = -1; + if (c != coord_def()) + { + ch = tileidx_feature(grd(c), c.x, c.y); + if (ch == TILE_FLOOR_NORMAL) + ch = env.tile_flv(c).floor; + else if (ch == TILE_WALL_NORMAL) + ch = env.tile_flv(c).wall; - tileset.push_back(tile_def(ch, TEX_DUNGEON)); + tileset.push_back(tile_def(ch, TEX_DUNGEON)); + } tileset.push_back(tile_def(idx, TEX_DEFAULT)); - // Needs to be displayed so as to not give away mimics in shallow water. - if (ch == TILE_DNGN_SHALLOW_WATER) - tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER, TEX_DEFAULT)); - else if (ch == TILE_DNGN_SHALLOW_WATER_MURKY) - tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER_MURKY, TEX_DEFAULT)); + if (ch != -1) + { + // Needs to be displayed so as to not give away mimics in shallow water. + if (ch == TILE_DNGN_SHALLOW_WATER) + { + tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER, + TEX_DEFAULT)); + } + else if (ch == TILE_DNGN_SHALLOW_WATER_MURKY) + { + tileset.push_back(tile_def(TILE_MASK_SHALLOW_WATER_MURKY, + TEX_DEFAULT)); + } + } } int brand = tile_known_weapon_brand(*item); if (brand) diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 3de3c87738..c0c1c13fe1 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -834,13 +834,12 @@ void tome_of_power(int slot) msg::stream << "The book opens to a page covered in " << weird_writing() << '.' << std::endl; + set_ident_flags(you.inv[slot], ISFLAG_KNOW_TYPE); you.turn_is_over = true; if (!yesno("Read it?")) return; - set_ident_flags( you.inv[slot], ISFLAG_KNOW_TYPE ); - if (player_mutation_level(MUT_BLURRY_VISION) > 0 && x_chance_in_y(player_mutation_level(MUT_BLURRY_VISION), 4)) { @@ -875,7 +874,7 @@ void tome_of_power(int slot) if (one_chance_in(5)) { mpr("The book disappears in a mighty explosion!"); - dec_inv_item_quantity( slot, 1 ); + dec_inv_item_quantity(slot, 1); } immolation(15, IMMOLATION_TOME, you.pos(), false, &you); @@ -930,7 +929,9 @@ void skill_manual(int slot) // a manual in advance. you.turn_is_over = true; item_def& manual(you.inv[slot]); - set_ident_flags( manual, ISFLAG_KNOW_TYPE ); + const bool known = item_type_known(manual); + if (!known) + set_ident_flags( manual, ISFLAG_KNOW_TYPE ); const int skill = manual.plus; mprf("You read about %s.", skill_name(skill)); @@ -945,7 +946,7 @@ void skill_manual(int slot) else mpr("The manual looks somewhat more worn."); - xom_is_stimulated(14); + xom_is_stimulated(known ? 14 : 64); } static bool box_of_beasts() diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 0c78d07da5..36d1bd7b08 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1928,12 +1928,11 @@ static void _mark_portal_return_point(const coord_def &pos) // All changes to you.level_type, you.where_are_you and you.your_level // for descending stairs should happen here. -static void _player_change_level_downstairs( - dungeon_feature_type stair_find, - const level_id &place_override, - bool shaft, - int shaft_level, - const level_id &shaft_dest) +static void _player_change_level_downstairs(dungeon_feature_type stair_find, + const level_id &place_override, + bool shaft, + int shaft_level, + const level_id &shaft_dest) { if (_stair_force_destination(place_override)) return; @@ -1999,8 +1998,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, branch_type old_where = you.where_are_you; const bool shaft = (!force_stair - && get_trap_type(you.pos()) == TRAP_SHAFT - || force_stair == DNGN_TRAP_NATURAL); + && get_trap_type(you.pos()) == TRAP_SHAFT + || force_stair == DNGN_TRAP_NATURAL); level_id shaft_dest; int shaft_level = -1; @@ -2136,9 +2135,9 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, // Interlevel travel data. const bool collect_travel_data = can_travel_interlevel(); - const level_id old_level_id = level_id::current(); - LevelInfo &old_level_info = travel_cache.get_level_info(old_level_id); - const coord_def stair_pos = you.pos(); + const level_id old_level_id = level_id::current(); + LevelInfo &old_level_info = travel_cache.get_level_info(old_level_id); + const coord_def stair_pos = you.pos(); if (collect_travel_data) old_level_info.update(); @@ -2155,6 +2154,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, _mark_portal_return_point(you.pos()); } + const int shaft_depth = (shaft ? shaft_level - you.your_level : 1); _player_change_level_reset(); _player_change_level_downstairs(stair_find, destination_override, shaft, shaft_level, shaft_dest); @@ -2288,7 +2288,12 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, switch (you.level_type) { case LEVEL_DUNGEON: - xom_is_stimulated(49); + // Xom thinks it's funny if you enter a new level via shaft + // or escape hatch, for shafts it's funnier the deeper you fell. + if (shaft || grid_is_escape_hatch(stair_find)) + xom_is_stimulated(shaft_depth * 50); + else + xom_is_stimulated(14); break; case LEVEL_PORTAL_VAULT: diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 5d0a71b08e..03c0fc1977 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -2144,7 +2144,7 @@ static bool _get_weighted_discs(bool completely_random, god_type god, if (num_discs == 0) { #ifdef DEBUG - mpr("No valid disciplines with which to make a themed ranadart " + mpr("No valid disciplines with which to make a themed randart " "spellbook.", MSGCH_ERROR); #endif // Only happens if !completely_random and the player already knows diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc index 63d467ee87..88396d253b 100644 --- a/crawl-ref/source/spl-mis.cc +++ b/crawl-ref/source/spl-mis.cc @@ -373,7 +373,7 @@ void MiscastEffect::do_miscast() case SPTYP_TRANSLOCATION: _translocation(severity); break; case SPTYP_SUMMONING: _summoning(severity); break; case SPTYP_NECROMANCY: _necromancy(severity); break; - case SPTYP_TRANSMUTATION: _transmutation(severity); break; + case SPTYP_TRANSMUTATION: _transmutation(severity); break; case SPTYP_FIRE: _fire(severity); break; case SPTYP_ICE: _ice(severity); break; case SPTYP_EARTH: _earth(severity); break; diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 0eb05e8d5c..1dc3c418c5 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -121,7 +121,7 @@ int tileidx_monster_base(const monsters *mon, bool detected) int type = mon->type; - // show only base class for detected monsters + // Show only base class for detected monsters. if (detected) type = mons_genus(type); @@ -143,7 +143,7 @@ int tileidx_monster_base(const monsters *mon, bool detected) case MONS_GIANT_BAT: return TILEP_MONS_GIANT_BAT; case MONS_BUTTERFLY: - return TILEP_MONS_BUTTERFLY + ((mon->colour)%7); + return TILEP_MONS_BUTTERFLY + ((mon->colour) % 7); // centaurs ('c') case MONS_CENTAUR: @@ -155,6 +155,10 @@ int tileidx_monster_base(const monsters *mon, bool detected) case MONS_YAKTAUR_CAPTAIN: return TILEP_MONS_YAKTAUR_CAPTAIN + _bow_offset(mon); + // draconians ('d'): + case MONS_DRACONIAN: + return TILEP_DRACO_BASE; + // elves ('e') case MONS_ELF: return TILEP_MONS_ELF; @@ -740,15 +744,15 @@ int tileidx_monster_base(const monsters *mon, bool detected) case MONS_SCROLL_MIMIC: case MONS_POTION_MIMIC: { - // Use item tile - item_def item; - get_mimic_item( mon, item ); - return tileidx_item(item); + // Use item tile. + item_def item; + get_mimic_item( mon, item ); + return tileidx_item(item); } case MONS_DANCING_WEAPON: { - // Use item tile + // Use item tile. item_def item = mitm[mon->inv[MSLOT_WEAPON]]; return tileidx_item(item) | TILE_FLAG_ANIM_WEP; } diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index f156d6e0d3..ced11f2d1f 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -43,6 +43,7 @@ REVISION("$Rev$"); #include "transfor.h" #include "tutorial.h" #include "view.h" +#include "xom.h" bool trap_def::active() const { @@ -271,15 +272,15 @@ void monster_caught_in_net(monsters *mon, bolt &pbolt) } } -void player_caught_in_net() +bool player_caught_in_net() { if (you.body_size(PSIZE_BODY) >= SIZE_GIANT) - return; + return (false); if (you.flight_mode() == FL_FLY && (!you.confused() || one_chance_in(3))) { mpr("You dart out from under the net!"); - return; + return (false); } if (!you.attribute[ATTR_HELD]) @@ -297,7 +298,9 @@ void player_caught_in_net() } stop_delay(true); // even stair delays + return (true); } + return (false); } void check_net_will_hold_monster(monsters *mons) @@ -496,7 +499,8 @@ void trap_def::trigger(actor& triggerer, bool flat_footed) else { mpr("A large net falls onto you!"); - player_caught_in_net(); + if (player_caught_in_net() && player_in_a_dangerous_place()) + xom_is_stimulated(64); } item_def item = this->generate_trap_item(); @@ -573,6 +577,9 @@ void trap_def::trigger(actor& triggerer, bool flat_footed) { mpr((trig_knows) ? "You enter the Zot trap." : "Oh no! You have blundered into a Zot trap!"); + if (!trig_knows) + xom_is_stimulated(32); + MiscastEffect( &you, ZOT_TRAP_MISCAST, SPTYP_RANDOM, 3, "a Zot trap" ); } diff --git a/crawl-ref/source/traps.h b/crawl-ref/source/traps.h index 5f2385169a..709618915e 100644 --- a/crawl-ref/source/traps.h +++ b/crawl-ref/source/traps.h @@ -31,7 +31,7 @@ void handle_traps(trap_type trt, int i, bool trap_known); int get_trapping_net(const coord_def& where, bool trapped = true); void mark_net_trapping(const coord_def& where); void monster_caught_in_net(monsters *mon, bolt &pbolt); -void player_caught_in_net(); +bool player_caught_in_net(); void clear_trapping_net(); void check_net_will_hold_monster(monsters *mon); diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 1d8c25faea..20da3b29b1 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -134,6 +134,18 @@ static std::string _get_xom_speech(const std::string key) return (result); } +static bool _xom_is_bored() +{ + return (you.religion == GOD_XOM && you.gift_timeout == 0); +} + +static bool _xom_feels_nasty() +{ + // Xom will only directly kill you with a bad effect if you're under + // penance from him, or if he's bored. + return (you.penance[GOD_XOM] || _xom_is_bored()); +} + bool xom_is_nice() { if (you.penance[GOD_XOM]) @@ -161,14 +173,14 @@ static void _xom_is_stimulated(int maxinterestingness, int interestingness = random2(maxinterestingness); + interestingness = std::min(255, interestingness); + #if DEBUG_RELIGION || DEBUG_GIFTS || DEBUG_XOM mprf(MSGCH_DIAGNOSTICS, - "Xom: maxinterestingness = %d, interestingness = %d", - maxinterestingness, interestingness); + "Xom: gift_timeout: %d, maxinterestingness = %d, interestingness = %d", + you.gift_timeout, maxinterestingness, interestingness); #endif - interestingness = std::min(255, interestingness); - bool was_stimulated = false; if (interestingness > you.gift_timeout && interestingness >= 12) { @@ -195,18 +207,6 @@ void xom_is_stimulated(int maxinterestingness, xom_message_type message_type, force_message); } -static bool _xom_is_bored() -{ - return (you.religion == GOD_XOM && you.gift_timeout == 0); -} - -static bool _xom_feels_nasty() -{ - // Xom will only directly kill you with a bad effect if you're under - // penance from him, or if he's bored. - return (you.penance[GOD_XOM] || _xom_is_bored()); -} - void xom_tick() { // Xom semi-randomly drifts your piety. @@ -225,7 +225,7 @@ void xom_tick() } // ...but he gets bored... - if (coinflip()) + if (you.gift_timeout > 0 && coinflip()) you.gift_timeout--; new_xom_favour = describe_xom_favour(); @@ -245,13 +245,6 @@ void xom_tick() else { const int tension = get_tension(GOD_XOM); -/* - const int chance = (tension == 0 ? 1 : - tension <= 5 ? 2 : 3); - - if (x_chance_in_y(chance, 3)) - xom_acts(abs(you.piety - MAX_PIETY/2)); -*/ const int chance = (tension == 0 ? 1 : tension <= 5 ? 2 : tension <= 10 ? 3 : @@ -259,7 +252,7 @@ void xom_tick() : 5); if (x_chance_in_y(chance, 5)) - xom_acts(abs(you.piety - MAX_PIETY/2)); + xom_acts(abs(you.piety - MAX_PIETY/2), tension); } } } @@ -1183,7 +1176,7 @@ static bool _xom_is_good(int sever, int tension) done = _xom_do_potion(); else if (x_chance_in_y(3, sever)) { - if (tension || one_chance_in(3)) + if (tension > 0 || one_chance_in(3)) { _xom_makes_you_cast_random_spell(sever, tension); done = true; @@ -1204,7 +1197,7 @@ static bool _xom_is_good(int sever, int tension) done = _xom_send_allies(sever); else if (x_chance_in_y(8, sever)) done = _xom_polymorph_nearby_monster(true); - else if (x_chance_in_y(9, sever)) + else if (random2(tension) < 15 && x_chance_in_y(9, sever)) { _xom_give_item(sever); done = true; @@ -1244,7 +1237,7 @@ static bool _xom_is_good(int sever, int tension) // It's pointless to send in help if there's no danger. else if (tension > random2(15) && x_chance_in_y(14, sever)) done = _xom_send_major_ally(sever); - else if (x_chance_in_y(15, sever)) + else if (tension > 0 && x_chance_in_y(15, sever)) done = _xom_throw_divine_lightning(); return (done); @@ -2051,7 +2044,7 @@ static void _handle_accidental_death(const int orig_hp, you.teleport(true); } -void xom_acts(bool niceness, int sever) +void xom_acts(bool niceness, int sever, int tension) { #if DEBUG_DIAGNOSTICS || DEBUG_RELIGION || DEBUG_XOM mprf(MSGCH_DIAGNOSTICS, "xom_acts(%u, %d); piety: %u, interest: %u\n", @@ -2105,7 +2098,8 @@ void xom_acts(bool niceness, int sever) } } - const int tension = get_tension(which_god); + if (tension == -1) + tension = get_tension(which_god); #if DEBUG_RELIGION || DEBUG_XOM || DEBUG_TENSION mprf(MSGCH_DIAGNOSTICS, "Xom tension: %d", tension); @@ -2129,6 +2123,10 @@ void xom_acts(bool niceness, int sever) // Bad mojo. while (!_xom_is_bad(sever, tension)) ; + + // If we got here because Xom was bored, reset gift timeout. + if (_xom_is_bored()) + you.gift_timeout = random2(40) + random2(40); } _handle_accidental_death(orig_hp, orig_stats, orig_mutation); @@ -2195,7 +2193,7 @@ void xom_check_lost_item(const item_def& item) if (is_unique_rune(item)) xom_is_stimulated(255, "Xom snickers loudly.", true); else if (you.entry_cause == EC_SELF_EXPLICIT - && !(item.flags & ISFLAG_BEEN_IN_INV)) + && !(item.flags & ISFLAG_BEEN_IN_INV)) { // Player voluntarily entered Pan or the Abyss looking for // runes, yet never found them. diff --git a/crawl-ref/source/xom.h b/crawl-ref/source/xom.h index 0ecba36714..843a94bbbd 100644 --- a/crawl-ref/source/xom.h +++ b/crawl-ref/source/xom.h @@ -25,12 +25,12 @@ void xom_is_stimulated(int maxinterestingness, void xom_is_stimulated(int maxinterestingness, const std::string& message, bool force_message = false); bool xom_is_nice(); -void xom_acts(bool niceness, int sever); +void xom_acts(bool niceness, int sever, int tension = -1); const char *describe_xom_favour(); -inline void xom_acts(int sever) +inline void xom_acts(int sever, int tension = -1) { - xom_acts(xom_is_nice(), sever); + xom_acts(xom_is_nice(), sever, tension); } void xom_check_lost_item(const item_def& item); -- cgit v1.2.3-54-g00ecf