From de11c27378236139089c48ecfb0b66457cc0d67c Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 16 Mar 2007 21:03:11 +0000 Subject: 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 --- crawl-ref/source/spl-cast.cc | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'crawl-ref/source/spl-cast.cc') 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)); -- cgit v1.2.3-54-g00ecf