From ecdff56d9ff3bba10dc8d45994c3374e02e9454d Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 14 Jan 2008 16:48:41 +0000 Subject: Fix 1871029: really lose beogh_water_walk() upon penance -> Beogh worshipper now will fall into water and drown Fix 1871027: no autosacrifice of restricted items (!p or rune/orb) Fix 1870495: make RAP_ANGRY actually call go_berserk() from time to time Fix 1849181: fix mimic description to match item (undetected mimic) or mimic database entry (detected mimic) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3272 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 23 ++++++++++++---- crawl-ref/source/direct.cc | 2 +- crawl-ref/source/player.cc | 30 +++++++++++++++++++- crawl-ref/source/religion.cc | 65 +++++++++++++++++++++++++------------------- crawl-ref/source/tile1.cc | 3 +- 5 files changed, 85 insertions(+), 38 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 0015d51be2..0f89e244b6 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -47,6 +47,7 @@ #include "macro.h" #include "menu.h" #include "message.h" +#include "monstuff.h" #include "mon-util.h" #include "player.h" #include "randart.h" @@ -1919,8 +1920,17 @@ static std::string describe_draconian(const monsters *mon) //--------------------------------------------------------------- void describe_monsters(monsters& mons) { + // for undetected mimics describe mimicked item instead + if (mons_is_mimic(mons.type) && !(mons.flags & MF_KNOWN_MIMIC)) + { + item_def item; + const monsters *mon = &mons; + get_mimic_item( mon, item ); + describe_item(item); + return; + } + std::ostringstream description; - description << mons.name(DESC_CAP_A) << "$$"; // Note: Nearly all of the "long" descriptions have moved to @@ -1938,7 +1948,11 @@ void describe_monsters(monsters& mons) // than what we have today. // // -peterb 4/14/07 - description << getLongDescription(mons.name(DESC_PLAIN)); + + if (mons_is_mimic(mons.type) && mons.type != MONS_GOLD_MIMIC) + description << getLongDescription("mimic"); + else + description << getLongDescription(mons.name(DESC_PLAIN)); std::string symbol = ""; symbol += get_monster_data(mons.type)->showchar; @@ -1950,10 +1964,7 @@ void describe_monsters(monsters& mons) symbol_prefix += "_prefix"; description << getLongDescription(symbol_prefix); - // Now that the player has examined it, he knows it's a mimic. - if (mons_is_mimic(mons.type)) - mons.flags |= MF_KNOWN_MIMIC; - + switch (mons.type) { case MONS_ZOMBIE_SMALL: case MONS_ZOMBIE_LARGE: diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 5e77792713..8a0774ba25 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -2108,7 +2108,7 @@ static void describe_cell(int mx, int my) { // If a mimic is on this square, we pretend it's the first item -- bwr if (mimic_item) - mpr("There is something else lying underneath.",MSGCH_FLOOR_ITEMS); + mpr("There is something else lying underneath.", MSGCH_FLOOR_ITEMS); else { if (mitm[ targ_item ].base_type == OBJ_GOLD) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 8e0810c440..fe969627d8 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5752,6 +5752,33 @@ bool player::cannot_fight() const return (false); } +// If you have a randart equipped that has the RAP_ANGRY property +// there's a 1/20 chance of it becoming activated whenever you +// attack a monster. (Same as the berserk mutation at level 1.) +// The probabilites for actually going berserk are cumulative! +static bool equipment_make_berserk() +{ + for (int eq = EQ_WEAPON; eq < NUM_EQUIP; eq++) + { + const item_def *item = you.slot_item((equipment_type) eq); + if (!item) + continue; + + if (!is_random_artefact(*item)) + continue; + + if (one_chance_in(20) + && randart_wpn_property(*item, + static_cast(RAP_ANGRY))) + { + return (true); + } + } + + // nothing found + return (false); +} + void player::attacking(actor *other) { if (other && other->atype() == ACT_MONSTER) @@ -5764,7 +5791,8 @@ void player::attacking(actor *other) } if (mutation[MUT_BERSERK] && - (random2(100) < (mutation[MUT_BERSERK] * 10) - 5)) + (random2(100) < (mutation[MUT_BERSERK] * 10) - 5) + || equipment_make_berserk()) { go_berserk(false); } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 982f0460d0..192e22bd8d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -418,6 +418,21 @@ void dec_penance(int val) dec_penance(you.religion, val); } // end dec_penance() +bool beogh_water_walk() +{ + return + you.religion == GOD_BEOGH && + !player_under_penance() && + you.piety >= piety_breakpoint(4); +} + +static bool need_water_walking() +{ + return + !player_is_airborne() && you.species != SP_MERFOLK && + grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER; +} + void inc_penance(god_type god, int val) { if (you.penance[god] == 0 && val > 0) @@ -440,6 +455,12 @@ void inc_penance(god_type god, int val) you.penance[god] = 200; else you.penance[god] += val; + + if ( god == GOD_BEOGH && need_water_walking() && !beogh_water_walk()) + { + fall_into_a_pool( you.x_pos, you.y_pos, true, + grd[you.x_pos][you.y_pos] ); + } } // end inc_penance() void inc_penance(int val) @@ -1787,21 +1808,6 @@ void gain_piety(int pgn) do_god_gift(false); } -bool beogh_water_walk() -{ - return - you.religion == GOD_BEOGH && - !player_under_penance() && - you.piety >= piety_breakpoint(4); -} - -static bool need_water_walking() -{ - return - !player_is_airborne() && you.species != SP_MERFOLK && - grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER; -} - static bool is_evil_weapon(const item_def& weap) { if (weap.base_type != OBJ_WEAPONS) @@ -3319,6 +3325,9 @@ void offer_items() int num_sacced = 0; int i = igrd[you.x_pos][you.y_pos]; + if (i == NON_ITEM) // nothing to sacrifice + return; + const int old_leading = leading_sacrifice_group(); while (i != NON_ITEM) @@ -3333,6 +3342,19 @@ void offer_items() continue; } + if ( is_risky_sacrifice(item) || + item.inscription.find("=p") != std::string::npos) + { + const std::string msg = + "Really sacrifice " + item.name(DESC_NOCAP_A) + "?"; + + if (!yesno(msg.c_str())) + { + i = next; + continue; + } + } + bool gained_piety = false; #if DEBUG_DIAGNOSTICS || DEBUG_SACRIFICE @@ -3342,19 +3364,6 @@ void offer_items() switch (you.religion) { case GOD_NEMELEX_XOBEH: - if ( is_risky_sacrifice(item) || - item.inscription.find("=p") != std::string::npos) - { - const std::string msg = - "Really sacrifice " + item.name(DESC_NOCAP_A) + "?"; - - if (!yesno(msg.c_str())) - { - i = next; - continue; - } - } - if (you.attribute[ATTR_CARD_COUNTDOWN] && random2(800) < value) { you.attribute[ATTR_CARD_COUNTDOWN]--; diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc index 7e5f51a304..8a02dd448e 100644 --- a/crawl-ref/source/tile1.cc +++ b/crawl-ref/source/tile1.cc @@ -3592,8 +3592,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground) int flag = t & (~TILE_FLAG_MASK); int mon_wep = menv[idx].inv[MSLOT_WEAPON]; - if (menv[idx].type >= MONS_GOLD_MIMIC && - menv[idx].type <= MONS_POTION_MIMIC) + if (mons_is_mimic(menv[idx].type)) { const monsters *mon = &menv[idx]; if (!mons_is_known_mimic(mon)) -- cgit v1.2.3-54-g00ecf