summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-21 19:52:14 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-21 19:52:14 +0000
commit6fe9d2d6362915f3ab999971c87dd2f4d09e905f (patch)
tree3815ce19535e80e61c54ab53234616c885688d2a /crawl-ref/source/effects.cc
parent2846de53110f56c1732a3e9b2ab71b396af3c5a0 (diff)
downloadcrawl-ref-6fe9d2d6362915f3ab999971c87dd2f4d09e905f.tar.gz
crawl-ref-6fe9d2d6362915f3ab999971c87dd2f4d09e905f.zip
* Tweak spell number of randart books some more.
* Loosen restrictions on spell levels of unknown spells for normal books, so there are more matches even for untrained schools. * Add a new option dump_book_spells that, if set to true (default), will dump the spells even for non-randart book. Useful if you don't know the books' contents by heart and want to know spells at your disposal without checking some spoilers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9143 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index e71c3658d8..5d07fb3786 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1041,7 +1041,7 @@ static int _acquirement_weapon_subtype()
for (int i = SK_SHORT_BLADES; i <= SK_DARTS; i++)
{
- if (i == SK_UNUSED_1)
+ if (is_invalid_skill(i))
continue;
// Adding a small constant allows for the occasional
@@ -1328,9 +1328,10 @@ static int _spell_weight(spell_type spell)
}
ASSERT(count > 0);
- int level = spell_difficulty(spell) - 1;
+ int leveldiff = 5 - spell_difficulty(spell);
+
+ return std::max(0, 2 * weight/count + leveldiff);
- return std::max(0, weight/count - 2*level);
}
// When randomly picking a book for acquirement, use the sum of the
@@ -1401,7 +1402,7 @@ static void _do_book_acquirement(item_def &book, int agent)
for (int i = 0; i < NUM_SKILLS; i++)
{
- if (i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING)
+ if (is_invalid_skill(i))
continue;
int weight = you.skills[i] * 100 / species_skills(i, you.species);
@@ -1472,9 +1473,9 @@ static void _do_book_acquirement(item_def &book, int agent)
case BOOK_RANDART_LEVEL:
{
- book.sub_type = BOOK_RANDART_LEVEL;
- int num_spells = 5 - (level + 1) / 2 + random_range(1, 3);
- make_book_level_randart(book, level, num_spells, owner);
+ book.sub_type = BOOK_RANDART_LEVEL;
+ int max_spells = 5 + level/3;
+ make_book_level_randart(book, level, max_spells, owner);
break;
}
@@ -1489,8 +1490,7 @@ static void _do_book_acquirement(item_def &book, int agent)
for (int i = 0; i < NUM_SKILLS; i++)
{
- if (i == SK_UNUSED_1
- || i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING)
+ if (is_invalid_skill(i))
{
weights[i] = 0;
continue;