From 8760aefa6b0c601891cb580f638a31696ec90107 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 14 Jun 2008 18:19:16 +0000 Subject: * Add a prompt when attacking monsters with an inappropriate weapon or when attempting to use (controlled) berserk while wielding an inappropriate weapon. (FR 1956656) * Make monsters stop patrolling/travelling if they change levels (or are banished). * Disable the friendly pickup toggle for characters unable to use them. Currently, only worshippers of TSO and Beogh are capable of gaining allies that are permanent (not summoned), permanently friendly (not charmed) and intelligent enough to pick up stuff (no zombies). I don't know if you keep your friends if you leave TSO. If so, the toggle should be enabled while that is the case (i.e. if you're still worshipping a good god) * Re-order the wizmode commands in the help screen. They're now not listed strictly alphabetically anymore, but rather sorted into different categories that should make actually finding commands easier. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5819 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a8f4d8f79d..51a66351bb 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -749,6 +749,33 @@ int get_player_wielded_weapon() return (player_weapon_wielded()? get_player_wielded_item() : -1); } +// Returns false if the player is wielding a weapon inappropriate for Berserk. +bool berserk_check_wielded_weapon() +{ + if (you.equip[EQ_WEAPON] == -1) + return (true); + + const item_def weapon = you.inv[you.equip[EQ_WEAPON]]; + if (is_valid_item(weapon) && weapon.base_type != OBJ_STAVES + && (weapon.base_type != OBJ_WEAPONS || is_range_weapon(weapon)) + || you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]) + { + std::string prompt = "Do you really want to go berserk while " + "wielding " + weapon.name(DESC_NOCAP_YOUR) + + "? "; + + if (!yesno(prompt.c_str(), true, 'n')) + { + canned_msg(MSG_OK); + return (false); + } + + you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; + } + + return (true); +} + // Looks in equipment "slot" to see if there is an equipped "sub_type". // Returns number of matches (in the case of rings, both are checked) int player_equip( equipment_type slot, int sub_type, bool calc_unid ) -- cgit v1.2.3-54-g00ecf