summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2009-12-18 16:48:40 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2009-12-18 23:52:19 +0100
commita515e3fef2cb3582e90959c15f89d4d25043cb67 (patch)
treeb1efb10222f7284d444c1ed6c8ee39a0ccbdb5bf /crawl-ref/source/effects.cc
parent246140dae9c981170485da51e298bf000b4f2e8b (diff)
downloadcrawl-ref-a515e3fef2cb3582e90959c15f89d4d25043cb67.tar.gz
crawl-ref-a515e3fef2cb3582e90959c15f89d4d25043cb67.zip
Skills unusable with your current god are less likely in manual acquirement.
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc37
1 files changed, 33 insertions, 4 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 4cf1a5860b..1c98e6e611 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1762,6 +1762,30 @@ static int _book_weight(book_type book)
return (total_weight);
}
+static bool _is_magic_skill(int skill)
+{
+ return (skill >= SK_SPELLCASTING && skill < SK_INVOCATIONS);
+}
+
+static bool _skill_useless_with_god(int skill)
+{
+ switch (you.religion)
+ {
+ case GOD_TROG:
+ return (_is_magic_skill(skill) || skill == SK_INVOCATIONS);
+ case GOD_ZIN:
+ case GOD_SHINING_ONE:
+ case GOD_ELYVILON:
+ case GOD_FEDHAS:
+ return (skill == SK_NECROMANCY);
+ case GOD_XOM:
+ case GOD_NEMELEX_XOBEH:
+ return (skill == SK_INVOCATIONS);
+ default:
+ return (false);
+ }
+}
+
static bool _do_book_acquirement(item_def &book, int agent)
{
// items() shouldn't make book a randart for acquirement items.
@@ -1813,7 +1837,7 @@ static bool _do_book_acquirement(item_def &book, int agent)
if (i == SK_SPELLCASTING && weight >= 1)
weight--;
- if (i >= SK_SPELLCASTING && i <= SK_POISON_MAGIC)
+ if (_is_magic_skill(i))
magic_weights += weight;
else
other_weights += weight;
@@ -1928,9 +1952,14 @@ static bool _do_book_acquirement(item_def &book, int agent)
w += 5;
}
+ // Greatly reduce the chances of getting a manual for a skill
+ // you couldn't use unless you switched your religion.
+ if (_skill_useless_with_god(i))
+ w /= 2;
+
// If we don't have any magic skills, make non-magic skills
// more likely.
- if (!knows_magic && (i < SK_SPELLCASTING || i > SK_POISON_MAGIC))
+ if (!knows_magic && !_is_magic_skill(i))
w *= 2;
weights[i] = w;
@@ -1946,8 +1975,8 @@ static bool _do_book_acquirement(item_def &book, int agent)
// Set number of reads possible before it "crumbles to dust".
book.plus2 = 3 + random2(15);
break;
- }
- }
+ } // manuals
+ } // switch book choice
return (true);
}