summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-16 21:03:11 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-16 21:03:11 +0000
commitde11c27378236139089c48ecfb0b66457cc0d67c (patch)
treec6efbca48a5f37d3b192009154e3d13cd347c159 /crawl-ref/source/spl-cast.cc
parent54bfc8f5f26243e68353eeedb959864e6565de4c (diff)
downloadcrawl-ref-de11c27378236139089c48ecfb0b66457cc0d67c.tar.gz
crawl-ref-de11c27378236139089c48ecfb0b66457cc0d67c.zip
Rings of fire and ice now type-ID when the player can notice this:
i.e., when a surge (or anti-surge) is created or amplified by them, at most one unIDed ring is worn, and no unIDed staves are wielded. (Checking for armour is unnecessary because armour type-IDs on wearing.) Note that this makes it easier to find out what randart rings of fire and ice do. Also changed a bunch of unsigned char return values to ints. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1051 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 76178e0a5f..ec0873abde 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -57,10 +57,61 @@
#define WILD_MAGIC_NASTINESS 150
+static bool surge_identify_boosters(int spell)
+{
+ const unsigned int typeflags = spell_type(spell);
+ if ( (typeflags & SPTYP_FIRE) || (typeflags & SPTYP_ICE) )
+ {
+ // Must not be wielding an unIDed staff.
+ // Note that robes of the Archmagi identify on wearing,
+ // so that's less of an issue.
+ const item_def* wpn = player_weapon();
+ if ( wpn == NULL ||
+ wpn->base_type != OBJ_STAVES ||
+ item_ident(*wpn, ISFLAG_KNOW_PROPERTIES) )
+ {
+ int num_unknown = 0;
+ for ( int i = EQ_LEFT_RING; i <= EQ_RIGHT_RING; ++i )
+ {
+ if (you.equip[i] != -1 &&
+ !item_ident(you.inv[you.equip[i]], ISFLAG_KNOW_PROPERTIES))
+ ++num_unknown;
+ }
+
+ // We can also identify cases with two unknown rings, both
+ // of fire (or both of ice)...let's skip it.
+ if ( num_unknown == 1 )
+ {
+ for ( int i = EQ_LEFT_RING; i <= EQ_RIGHT_RING; ++i )
+ {
+ if ( you.equip[i] != -1 )
+ {
+ item_def& ring = you.inv[you.equip[i]];
+ if (!item_ident(ring, ISFLAG_KNOW_PROPERTIES) &&
+ (ring.sub_type == RING_FIRE ||
+ ring.sub_type == RING_ICE))
+ {
+ set_ident_type( ring.base_type, ring.sub_type,
+ ID_KNOWN_TYPE );
+ set_ident_flags(ring, ISFLAG_KNOW_PROPERTIES);
+ mprf("You are wearing: %s",
+ item_name(ring, DESC_INVENTORY_EQUIP));
+ }
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
static void surge_power(int spell)
{
int enhanced = 0;
+ surge_identify_boosters(spell);
+
//jmf: simplified
enhanced += spell_enhancement(spell_type(spell));