diff options
-rw-r--r-- | crawl-ref/source/effects.cc | 30 | ||||
-rw-r--r-- | crawl-ref/source/makeitem.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/spl-book.cc | 6 |
3 files changed, 22 insertions, 19 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index c5acfe2441..e71c3658d8 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1413,12 +1413,12 @@ static void _do_book_acquirement(item_def &book, int agent) // Count magic skills double to bias against manuals // for magic users. if (i >= SK_SPELLCASTING && i <= SK_POISON_MAGIC) - magic_weights += 2*weight; + magic_weights += weight; else other_weights += weight; } - if (x_chance_in_y(other_weights, magic_weights + other_weights)) + if (x_chance_in_y(other_weights, 2*magic_weights + other_weights)) { choice = BOOK_MANUAL; if (magic_weights > 0) @@ -1429,17 +1429,15 @@ static void _do_book_acquirement(item_def &book, int agent) if (choice == NUM_BOOKS) { choice = random_choose_weighted( - 60, BOOK_RANDART_THEME, - agent == GOD_SIF_MUNA ? 24 : 34, book.sub_type, - level == -1 ? 0 : - agent == GOD_SIF_MUNA ? 4 : 1, BOOK_RANDART_LEVEL, - 0); + 30, BOOK_RANDART_THEME, + agent == GOD_SIF_MUNA ? 10 : 40, book.sub_type, + level == -1 ? 0 : 1, BOOK_RANDART_LEVEL, 0); } // Acquired randart books have a chance of being named after the player. std::string owner = ""; - if (agent == AQ_SCROLL && one_chance_in(10) - || agent == AQ_CARD_GENIE && one_chance_in(5)) + if (agent == AQ_SCROLL && one_chance_in(12) + || agent == AQ_CARD_GENIE && one_chance_in(6)) { owner = you.your_name; } @@ -1467,14 +1465,15 @@ static void _do_book_acquirement(item_def &book, int agent) // else intentional fall-through } case BOOK_RANDART_THEME: - book.sub_type = choice; - make_book_theme_randart(book, 0, 0, 7, 22, SPELL_NO_SPELL, owner); + book.sub_type = BOOK_RANDART_THEME; + make_book_theme_randart(book, 0, 0, 5 + coinflip(), 20, SPELL_NO_SPELL, + owner); break; case BOOK_RANDART_LEVEL: { - book.sub_type = choice; - int num_spells = 7 - (level + 1) / 2 + random_range(1, 2); + 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); break; } @@ -1490,7 +1489,8 @@ 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 (i == SK_UNUSED_1 + || i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING) { weights[i] = 0; continue; @@ -1504,7 +1504,7 @@ static void _do_book_acquirement(item_def &book, int agent) // If we don't know any magic skills, make non-magic skills // more likely. - if (!knows_magic && i < SK_SPELLCASTING) + if (!knows_magic && (i < SK_SPELLCASTING || i > SK_POISON_MAGIC)) w *= 2; weights[i] = w; diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 90ac8de89c..f5e52e30a6 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2518,7 +2518,6 @@ static void _generate_book_item(item_def& item, int allow_uniques, if (allow_uniques && item_level > 2 && force_type == OBJ_RANDOM && x_chance_in_y(101 + item_level * 3, 4000)) { - // Same relative weights as acquirement int choice = random_choose_weighted( 58, BOOK_RANDART_THEME, 2, BOOK_RANDART_LEVEL, // 1/30 @@ -2528,12 +2527,12 @@ static void _generate_book_item(item_def& item, int allow_uniques, } if (item.sub_type == BOOK_RANDART_THEME) - make_book_theme_randart(item, 0, 0, 7, 22); + make_book_theme_randart(item, 0, 0, 5 + coinflip(), 20); else if (item.sub_type == BOOK_RANDART_LEVEL) { int max_level = std::min( 9, std::max(1, item_level / 3) ); int spell_level = random_range(1, max_level); - int num_spells = 7 - (spell_level + 1) / 2 + random_range(1, 2); + int num_spells = 5 - (spell_level + 1) / 2 + random_range(1, 3); make_book_level_randart(item, spell_level, num_spells); } } diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index a70637fb47..4f0ee38e99 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -2440,6 +2440,7 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, disc2 = 1 << max2; int highest_level = 0; + int lowest_level = 10; bool all_spells_disc1 = true; // Finally fill the spell vector. @@ -2449,6 +2450,8 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, int diff = spell_difficulty(chosen_spells[i]); if (diff > highest_level) highest_level = diff; + else if (diff < lowest_level) + lowest_level = diff; if (all_spells_disc1 && is_valid_spell(chosen_spells[i]) && !spell_typematch( chosen_spells[i], disc1 )) @@ -2474,7 +2477,8 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, owner = god_name(god, false); else if (god_gift && one_chance_in(3) || one_chance_in(5)) { - bool highlevel = (highest_level >= 6 + random2(3)); + bool highlevel = (highest_level >= 7 + random2(3) + && lowest_level > 1); if (disc1 != disc2) { |