summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-15 21:32:33 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-15 21:32:33 +0000
commit054c713cec71c3010b1ac3eb0848f2b601db982f (patch)
treeda7a575a718b842b7ea15bb8ffc59efdccc2ff95 /crawl-ref/source/itemprop.cc
parent54f595ca30391a4e95ae1f46706d9c7cc5a6b6a8 (diff)
downloadcrawl-ref-054c713cec71c3010b1ac3eb0848f2b601db982f.tar.gz
crawl-ref-054c713cec71c3010b1ac3eb0848f2b601db982f.zip
More stuff for the tutorial:
- Enhanced handling of spellbooks and artefacts. - Feature descriptions now cover altars. - Added monster descriptions (out of depth and brands). Also: - space-only inscription counts as no inscription - ring of teleportation autoID's if no teleport randart In my last commit I forgot to mention that the descriptions were suggested by Richard Gould, and I'd like to give credit where credit is due. :) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2005 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 65f87c3a50..46dea61357 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1918,6 +1918,82 @@ int property( const item_def &item, int prop_type )
return (0);
}
+bool gives_ability( const item_def &item )
+{
+ if (!item_type_known(item))
+ return false;
+
+ switch (item.base_type)
+ {
+ case OBJ_WEAPONS:
+ {
+ // unwielded weapon
+ item_def *weap = you.slot_item(EQ_WEAPON);
+ if (!weap || (*weap).slot != item.slot)
+ return false;
+ break;
+ }
+ case OBJ_JEWELLERY:
+ {
+ if (item.sub_type < NUM_RINGS)
+ {
+ // unworn ring
+ item_def *lring = you.slot_item(EQ_LEFT_RING);
+ item_def *rring = you.slot_item(EQ_RIGHT_RING);
+ if ((!lring || (*lring).slot != item.slot)
+ && (!rring || (*rring).slot != item.slot))
+ {
+ return false;
+ }
+
+ if (item.sub_type == RING_TELEPORTATION
+ || item.sub_type == RING_LEVITATION
+ || item.sub_type == RING_INVISIBILITY)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ // unworn amulet
+ item_def *amul = you.slot_item(EQ_AMULET);
+ if (!amul || (*amul).slot != item.slot)
+ return false;
+
+ if (item.sub_type == AMU_RAGE)
+ return true;
+ }
+ break;
+ }
+ case OBJ_ARMOUR:
+ {
+ const equipment_type eq = get_armour_slot(item);
+ if (eq == EQ_NONE)
+ return false;
+
+ // unworn armour
+ item_def *arm = you.slot_item(eq);
+ if (!arm || (*arm).slot != item.slot)
+ return false;
+ break;
+ }
+ default:
+ return false;
+ }
+
+ if (!is_random_artefact(item))
+ return false;
+
+ // check for evokable randart properties
+ for (int rap = RAP_INVISIBLE; rap <= RAP_MAPPING; rap++)
+ {
+ if (randart_wpn_property( item, rap ))
+ return true;
+ }
+
+ return false;
+}
+
int item_mass( const item_def &item )
{
int unit_mass = 0;