From 6fe9d2d6362915f3ab999971c87dd2f4d09e905f Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 21 Feb 2009 19:52:14 +0000 Subject: * 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 --- crawl-ref/source/effects.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/effects.cc') 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; -- cgit v1.2.3-54-g00ecf