summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-10-24 23:55:03 +0200
committerAdam Borowski <kilobyte@angband.pl>2009-10-24 23:59:12 +0200
commit0773235a1b546eafbb369690adc9852d474ffd99 (patch)
treefcca306f57663c61fee965be6e751637117be1d3
parentf0f31671b06a7f64198b15ddd72e5b7a781ca30d (diff)
downloadcrawl-ref-0773235a1b546eafbb369690adc9852d474ffd99.tar.gz
crawl-ref-0773235a1b546eafbb369690adc9852d474ffd99.zip
Make it possible for demigods to get the hard books [BR 2883646] (sorear)
-rw-r--r--crawl-ref/source/effects.cc11
-rw-r--r--crawl-ref/source/makeitem.cc2
2 files changed, 9 insertions, 4 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 029d3a62b6..2446309443 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1634,7 +1634,7 @@ static int _spell_weight(spell_type spell)
// weights of all unknown spells in the book.
static int _book_weight(int book)
{
- ASSERT(book >= 0 && book <= MAX_NORMAL_BOOK);
+ ASSERT(book >= 0 && book <= MAX_FIXED_BOOK);
int total_weight = 0;
for (int i = 0; i < SPELLBOOK_SIZE; i++)
@@ -1746,9 +1746,14 @@ static bool _do_book_acquirement(item_def &book, int agent)
int total_weights = 0;
// Pick a random spellbook according to unknown spells contained.
- int weights[MAX_NORMAL_BOOK+1];
- for (int bk = 0; bk <= MAX_NORMAL_BOOK; bk++)
+ int weights[MAX_FIXED_BOOK+1];
+ for (int bk = 0; bk <= MAX_FIXED_BOOK; bk++)
{
+ if (bk > MAX_NORMAL_BOOK && agent == GOD_SIF_MUNA)
+ {
+ weights[bk] = 0;
+ continue;
+ }
weights[bk] = _book_weight(bk);
total_weights += weights[bk];
}
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 0165aa8984..c717e64a2d 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2509,7 +2509,7 @@ static void _generate_book_item(item_def& item, int allow_uniques,
{
do
{
- item.sub_type = random2(NUM_NORMAL_BOOKS);
+ item.sub_type = random2(NUM_FIXED_BOOKS);
if (book_rarity(item.sub_type) != 100
&& one_chance_in(10))