summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/randart.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-05 06:23:30 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-05 06:23:30 +0000
commit28b3dd9db78b3d98762e5be3ff80256aea60759a (patch)
tree57b9dd919d5e292d7bebe35c6fc57c19a5ba0fa9 /crawl-ref/source/randart.cc
parentdf45205d9a9bc427963f2343935ca3b424ee8a5c (diff)
downloadcrawl-ref-28b3dd9db78b3d98762e5be3ff80256aea60759a.tar.gz
crawl-ref-28b3dd9db78b3d98762e5be3ff80256aea60759a.zip
Fixed some randart auto-inscription bugs.
For jewellery randarts, the properties of the randart's basetype are included in the auto-inscription. Auto-inscribe unidentified randarts if the the player has learned some of its properties via equiping it. If an unidentified randart is autoinscribed, is subsequently identified, and the identification reveals more of its properties, then remove the old atuo-inscription string before adding the new one. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3000 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/randart.cc')
-rw-r--r--crawl-ref/source/randart.cc125
1 files changed, 123 insertions, 2 deletions
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 20d2de175b..933495d422 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -883,11 +883,12 @@ static long calc_seed( const item_def &item )
void randart_desc_properties( const item_def &item,
randart_properties_t &proprt,
- randart_known_props_t &known )
+ randart_known_props_t &known,
+ bool force_fake_props)
{
randart_wpn_properties( item, proprt, known);
- if ( item_ident( item, ISFLAG_KNOW_PROPERTIES ) )
+ if ( !force_fake_props && item_ident( item, ISFLAG_KNOW_PROPERTIES ) )
return;
if (item.base_type != OBJ_JEWELLERY)
@@ -896,6 +897,11 @@ void randart_desc_properties( const item_def &item,
randart_prop_type fake_rap = RAP_NUM_PROPERTIES;
int fake_plus = 1;
+ // The base jewelery type is one whose property is revealed by
+ // wearing it, but whose property isn't revealed by having
+ // ISFLAG_KNOW_PLUSES set. For a randart with a base type of, for
+ // example, a ring of strength, wearing it sets
+ // ISFLAG_KNOW_PLUSES, which reveals the ring's strength plus.
switch (item.sub_type)
{
case RING_INVISIBILITY:
@@ -921,7 +927,122 @@ void randart_desc_properties( const item_def &item,
}
if (fake_rap != RAP_NUM_PROPERTIES)
+ {
proprt[fake_rap] += fake_plus;
+
+ if (item_ident( item, ISFLAG_KNOW_PROPERTIES )
+ || item_ident( item, ISFLAG_KNOW_TYPE ))
+ {
+ known[fake_rap] = true;
+ }
+
+ return;
+ }
+
+ if (!force_fake_props)
+ return;
+
+ // For auto-inscribing randart jewellry, force_fake_props folds as
+ // much info about the base type as possible into the randarts
+ // property struct.
+
+ randart_prop_type fake_rap2 = RAP_NUM_PROPERTIES;
+ int fake_plus2 = 1;
+
+ switch (item.sub_type)
+ {
+ case RING_PROTECTION:
+ fake_rap = RAP_AC;
+ fake_plus = item.plus;
+ break;
+
+ case RING_PROTECTION_FROM_FIRE:
+ fake_rap = RAP_FIRE;
+ break;
+
+ case RING_POISON_RESISTANCE:
+ fake_rap = RAP_POISON;
+ break;
+
+ case RING_PROTECTION_FROM_COLD:
+ fake_rap = RAP_COLD;
+ break;
+
+ case RING_STRENGTH:
+ fake_rap = RAP_STRENGTH;
+ break;
+
+ case RING_SLAYING:
+ fake_rap = RAP_ACCURACY;
+ fake_plus = item.plus;
+ fake_rap2 = RAP_DAMAGE;
+ fake_plus2 = item.plus2;
+ break;
+
+ case RING_SEE_INVISIBLE:
+ fake_rap = RAP_EYESIGHT;
+ break;
+
+ case RING_HUNGER:
+ fake_rap = RAP_METABOLISM;
+ break;
+
+ case RING_EVASION:
+ fake_rap = RAP_EVASION;
+ fake_plus = item.plus;
+ break;
+
+ case RING_DEXTERITY:
+ fake_rap = RAP_DEXTERITY;
+ fake_plus = item.plus;
+ break;
+
+ case RING_INTELLIGENCE:
+ fake_rap = RAP_INTELLIGENCE;
+ fake_plus = item.plus;
+ break;
+
+ case RING_LIFE_PROTECTION:
+ fake_rap = RAP_NEGATIVE_ENERGY;
+ break;
+
+ case RING_PROTECTION_FROM_MAGIC:
+ fake_rap = RAP_MAGIC;
+ break;
+
+ case RING_FIRE:
+ fake_rap = RAP_FIRE;
+ fake_rap2 = RAP_COLD;
+ fake_plus2 = -1;
+ break;
+
+ case RING_ICE:
+ fake_rap = RAP_COLD;
+ fake_rap2 = RAP_FIRE;
+ fake_plus2 = -1;
+ break;
+
+ case AMU_INACCURACY:
+ fake_rap = RAP_ACCURACY;
+ fake_plus = -5;
+ break;
+ }
+
+ if (fake_rap != RAP_NUM_PROPERTIES)
+ proprt[fake_rap] += fake_plus;
+
+ if (fake_rap2 != RAP_NUM_PROPERTIES)
+ proprt[fake_rap2] += fake_plus2;
+
+ if (item_ident( item, ISFLAG_KNOW_PROPERTIES )
+ || item_ident( item, ISFLAG_KNOW_TYPE ))
+ {
+ if (fake_rap != RAP_NUM_PROPERTIES && proprt[fake_rap] != 0)
+ known[fake_rap] = true;
+
+ if (fake_rap2 != RAP_NUM_PROPERTIES && proprt[fake_rap2] != 0)
+ known[fake_rap2] = true;
+ }
}
static int randart_add_one_property( const item_def &item,