summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-10 15:05:31 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-10 15:05:31 +0000
commit6e2e9d806ac731c0e421e7bfb4ab5497ea73730b (patch)
tree995001419eef650a033bdf544d61735a2cc10992 /crawl-ref/source/player.cc
parent9dc1f94fe89c3f426921ac5e32eb4cd79f8b73e2 (diff)
downloadcrawl-ref-6e2e9d806ac731c0e421e7bfb4ab5497ea73730b.tar.gz
crawl-ref-6e2e9d806ac731c0e421e7bfb4ab5497ea73730b.zip
Changed requirements for auto-identification of equipped
items, specifically jewellery and randarts. The goal of this change was to clear up the identification rules and apply them consistently. It was inspired by FR 1788698. * Like the ring of teleportation, =lev and "rage now only autoID if you do not wear/wield a randart with the same property. * Stat changes caused by randarts always give a message. * Other "obvious" changes give a message only if the randart has not been identified, to avoid message spam. (Obvious refers to attributes that would cause the item to be autoID'd if it were the appropriate sub type.) * Randarts do NOT autoID anymore just because you recognize the base type. On the whole, autoidentification becomes much rarer (thus both the scroll and the spell become more valuable). Yes, this might be too harsh. On the upside, the player is told about properties such as stat changes (including AC and EV) and all evokable abilities. We might even include information about items hindering or preventing spellcasting and teleportation, respectively, under the assumption that skilled spellcasters and chars with teleportitis or teleport control would notice. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2067 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc48
1 files changed, 47 insertions, 1 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 145a490d7f..7b2cab6c3a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3933,6 +3933,52 @@ int slaying_bonus(char which_affected)
return (ret);
} // end slaying_bonus()
+// Checks each equip slot for an evokable item (jewellery or randart).
+// Returns true if any of these has the same ability as the one handed in.
+bool items_give_ability(const int slot, char abil)
+{
+ for (int i = EQ_WEAPON; i < NUM_EQUIP; i++)
+ {
+ const int eq = you.equip[i];
+
+ if (eq == -1)
+ continue;
+
+ // skip item to compare with
+ if (eq == slot)
+ continue;
+
+ // only weapons give their effects when in our hands
+ if (i == EQ_WEAPON && you.inv[ eq ].base_type != OBJ_WEAPONS)
+ continue;
+
+ if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING)
+ {
+ if (abil == RAP_LEVITATE && you.inv[eq].sub_type == RING_LEVITATION)
+ return (true);
+ if (abil == RAP_CAN_TELEPORT && you.inv[eq].sub_type == RING_TELEPORTATION)
+ return (true);
+ if (abil == RAP_INVISIBLE && you.inv[eq].sub_type == RING_INVISIBILITY)
+ return (true);
+ }
+ else if (eq == EQ_AMULET)
+ {
+ if (abil == RAP_BERSERK && you.inv[eq].sub_type == AMU_RAGE)
+ return (true);
+ }
+
+ // other items are not evokable
+ if (!is_random_artefact( you.inv[ eq ] ))
+ continue;
+
+ if (randart_wpn_property(you.inv[ eq ], abil))
+ return (true);
+ }
+
+ // none of the equipped items possesses this ability
+ return (false);
+} // end scan_randarts()
+
/* Checks each equip slot for a randart, and adds up all of those with
a given property. Slow if any randarts are worn, so avoid where possible. */
int scan_randarts(char which_property, bool calc_unid)
@@ -4012,7 +4058,7 @@ void modify_stat(stat_type which_stat, char amount, bool suppress_msg)
break;
}
- if (!suppress_msg)
+ if (!suppress_msg && amount != 0)
mpr( msg.c_str(), (amount > 0) ? MSGCH_INTRINSIC_GAIN : MSGCH_WARN );
*ptr_stat += amount;