diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-14 18:19:16 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-14 18:19:16 +0000 |
commit | 8760aefa6b0c601891cb580f638a31696ec90107 (patch) | |
tree | 30d1f4c34cf1931d06d94c674341c3bba17f0299 /crawl-ref/source/fight.cc | |
parent | 866686d5df24c38a2838f6f06ef9186b2c392a1c (diff) | |
download | crawl-ref-8760aefa6b0c601891cb580f638a31696ec90107.tar.gz crawl-ref-8760aefa6b0c601891cb580f638a31696ec90107.zip |
* 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
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index d26d1ee36b..bce2727800 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -4001,17 +4001,37 @@ int melee_attack::mons_to_hit() /////////////////////////////////////////////////////////////////////////// -static void wielded_weapon_check(const item_def *weapon) +static bool wielded_weapon_check(const item_def *weapon) { - if (you.received_weapon_warning == false - && weapon && weapon->base_type != OBJ_STAVES - && (weapon->base_type != OBJ_WEAPONS || is_range_weapon(*weapon))) + bool result = true; + if (!you.received_weapon_warning + && weapon && weapon->base_type != OBJ_STAVES + && (weapon->base_type != OBJ_WEAPONS || is_range_weapon(*weapon)) + || you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]) { - mpr("You might want to wield a more suitable implement when " - "attacking monsters.", MSGCH_WARN); + if (item_cursed(*weapon)) + { + mpr("You might want to wield a more suitable implement when " + "attacking monsters.", MSGCH_WARN); + } + else + { + std::string prompt = "Really attack while wielding " + + weapon->name(DESC_NOCAP_YOUR) + "? "; + + result = yesno(prompt.c_str(), true, 'n'); + } + learned_something_new(TUT_WIELD_WEAPON); // for tutorial Rangers - you.received_weapon_warning = true; + + // Don't warn again if you decide to continue your attack. + if (result) + { + you.received_weapon_warning = true; + you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; + } } + return (result); } // Returns true if you hit the monster. @@ -4025,7 +4045,11 @@ bool you_attack(int monster_attacked, bool unarmed_attacks) interrupt_activity(AI_HIT_MONSTER, defender); // Check if the player is fighting with something unsuitable. - wielded_weapon_check(attk.weapon); + if (!wielded_weapon_check(attk.weapon)) + { + you.turn_is_over = false; + return (false); + } bool attack = attk.attack(); if (!attack) |