summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/shopping.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-05 06:09:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-05 06:09:49 +0000
commitffc2688d711c6741e0ed21d09b9137ae7f173c2a (patch)
tree2bcb3c0af9dd86d969dd44ed78e3748118997572 /crawl-ref/source/shopping.cc
parent0c5066560faff5d49fe240c76c650d00bea2129d (diff)
downloadcrawl-ref-ffc2688d711c6741e0ed21d09b9137ae7f173c2a.tar.gz
crawl-ref-ffc2688d711c6741e0ed21d09b9137ae7f173c2a.zip
Non-weighted themed randart spellbooks, and prices for randart spellbooks.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7746 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r--crawl-ref/source/shopping.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 40cfd757df..7233e11905 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1610,7 +1610,28 @@ unsigned int item_value( item_def item, bool ident )
case OBJ_BOOKS:
valued = 150;
if (item_type_known(item))
+ {
+ int rarity = 0;
+ if (is_random_artefact(item))
+ {
+ // Consider spellbook as rare as its rarest spell.
+ // NOTE: This probably undervalues a book if it contains
+ // lots of rare spells.
+ for (int i = 0; i < SPELLBOOK_SIZE; i++)
+ {
+ spell_type spell = which_spell_in_book(item, i);
+ if (spell == SPELL_NO_SPELL)
+ continue;
+
+ if (rarity > spell_rarity(spell))
+ rarity = spell_rarity(spell);
+ }
+ }
+ else
+ rarity = book_rarity(item.sub_type);
+
valued += book_rarity(item.sub_type) * 50;
+ }
break;
case OBJ_STAVES: