summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--crawl-ref/source/player.cc32
-rw-r--r--crawl-ref/source/player.h74
-rw-r--r--crawl-ref/source/spl-cast.cc51
3 files changed, 80 insertions, 77 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index de0c29872b..500dec8e7b 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1127,7 +1127,7 @@ int player_res_poison(bool calc_unid)
return (rp);
} // end player_res_poison()
-unsigned char player_spec_death(void)
+int player_spec_death()
{
int sd = 0;
@@ -1154,14 +1154,14 @@ unsigned char player_spec_death(void)
return sd;
}
-unsigned char player_spec_holy(void)
+int player_spec_holy()
{
//if ( you.char_class == JOB_PRIEST || you.char_class == JOB_PALADIN )
// return 1;
return 0;
}
-unsigned char player_spec_fire(void)
+int player_spec_fire()
{
int sf = 0;
@@ -1177,7 +1177,7 @@ unsigned char player_spec_fire(void)
return sf;
}
-unsigned char player_spec_cold(void)
+int player_spec_cold()
{
int sc = 0;
@@ -1190,7 +1190,7 @@ unsigned char player_spec_cold(void)
return sc;
}
-unsigned char player_spec_earth(void)
+int player_spec_earth()
{
int se = 0;
@@ -1203,7 +1203,7 @@ unsigned char player_spec_earth(void)
return se;
}
-unsigned char player_spec_air(void)
+int player_spec_air()
{
int sa = 0;
@@ -1216,7 +1216,7 @@ unsigned char player_spec_air(void)
return sa;
}
-unsigned char player_spec_conj(void)
+int player_spec_conj()
{
int sc = 0;
@@ -1230,7 +1230,7 @@ unsigned char player_spec_conj(void)
return sc;
}
-unsigned char player_spec_ench(void)
+int player_spec_ench()
{
int se = 0;
@@ -1244,7 +1244,7 @@ unsigned char player_spec_ench(void)
return se;
}
-unsigned char player_spec_summ(void)
+int player_spec_summ()
{
int ss = 0;
@@ -1258,7 +1258,7 @@ unsigned char player_spec_summ(void)
return ss;
}
-unsigned char player_spec_poison(void)
+int player_spec_poison()
{
int sp = 0;
@@ -1275,9 +1275,9 @@ unsigned char player_spec_poison(void)
return sp;
}
-unsigned char player_energy(void)
+int player_energy()
{
- unsigned char pe = 0;
+ int pe = 0;
// Staves
pe += player_equip( EQ_STAFF, STAFF_ENERGY );
@@ -2023,9 +2023,9 @@ int player_shield_class(void) //jmf: changes for new spell
return (base_shield);
} // end player_shield_class()
-unsigned char player_see_invis(bool calc_unid)
+int player_see_invis(bool calc_unid)
{
- unsigned char si = 0;
+ int si = 0;
si += player_equip( EQ_RINGS, RING_SEE_INVISIBLE, calc_unid );
@@ -2062,9 +2062,9 @@ bool player_monster_visible( const monsters *mon )
return (true);
}
-unsigned char player_sust_abil(bool calc_unid)
+int player_sust_abil(bool calc_unid)
{
- unsigned char sa = 0;
+ int sa = 0;
sa += player_equip( EQ_RINGS, RING_SUSTAIN_ABILITIES, calc_unid );
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 2d68ade989..a476b2d40a 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -116,7 +116,7 @@ int player_AC(void);
/* ***********************************************************************
* called from: spell
* *********************************************************************** */
-unsigned char player_energy(void);
+int player_energy(void);
/* ***********************************************************************
@@ -202,64 +202,16 @@ bool player_res_asphyx();
int player_shield_class(void);
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_air(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_cold(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_conj(void);
-
-
-/* ***********************************************************************
- * called from: it_use3 - spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_death(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_earth(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_ench(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_fire(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_holy(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_poison(void);
-
-
-/* ***********************************************************************
- * called from: spell - spells0
- * *********************************************************************** */
-unsigned char player_spec_summ(void);
+int player_spec_air(void);
+int player_spec_cold(void);
+int player_spec_conj(void);
+int player_spec_death(void);
+int player_spec_earth(void);
+int player_spec_ench(void);
+int player_spec_fire(void);
+int player_spec_holy(void);
+int player_spec_poison(void);
+int player_spec_summ(void);
/* ***********************************************************************
@@ -278,7 +230,7 @@ int player_spell_levels(void);
/* ***********************************************************************
* called from: effects
* *********************************************************************** */
-unsigned char player_sust_abil(bool calc_unid = true);
+int player_sust_abil(bool calc_unid = true);
/* ***********************************************************************
@@ -304,7 +256,7 @@ int slaying_bonus(char which_affected);
* items - monstuff - mon-util - mstuff2 - spells1 - spells2 -
* spells3
* *********************************************************************** */
-unsigned char player_see_invis(bool calc_unid = true);
+int player_see_invis(bool calc_unid = true);
bool player_monster_visible( const monsters *mon );
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));