diff options
-rw-r--r-- | crawl-ref/source/monstuff.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.h | 8 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 14 |
3 files changed, 28 insertions, 14 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index a59affc253..41428506dc 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3487,18 +3487,21 @@ bool choose_any_monster(const monsters* mon) // for the type of monster wanted. // If prefer_named is true, named monsters (including uniques) are twice // as likely to get chosen compared to non-named ones. +// If prefer_priest is true, priestly monsters (including uniques) are +// twice as likely to get chosen compared to non-priestly ones. monsters *choose_random_nearby_monster(int weight, bool (*suitable)(const monsters* mon), - bool in_sight, bool prefer_named) + bool in_sight, bool prefer_named, + bool prefer_priest) { return choose_random_monster_on_level(weight, suitable, in_sight, true, - prefer_named); + prefer_named, prefer_priest); } monsters *choose_random_monster_on_level(int weight, bool (*suitable)(const monsters* mon), bool in_sight, bool near_by, - bool prefer_named) + bool prefer_named, bool prefer_priest) { monsters *chosen = NULL; @@ -3525,8 +3528,15 @@ monsters *choose_random_monster_on_level(int weight, // is fine, I think. Once more gods name followers (and // prefer them) that should be changed, of course. (jpeg) - // Named monsters have doubled chances. - int mon_weight = ((prefer_named && mon->is_named()) ? 2 : 1); + // Named or priestly monsters have doubled chances. + int mon_weight = 1; + + if ((prefer_named && mon->is_named()) + || (prefer_priest && mons_class_flag(mon->type, M_PRIEST))) + { + mon_weight++; + } + if ( x_chance_in_y(mon_weight, (weight += mon_weight)) ) chosen = mon; } diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h index ebefa0c2fa..c41dc6daa7 100644 --- a/crawl-ref/source/monstuff.h +++ b/crawl-ref/source/monstuff.h @@ -143,16 +143,16 @@ bool choose_any_monster(const monsters* mon); monsters *choose_random_nearby_monster( int weight, bool (*suitable)(const monsters* mon) = - choose_any_monster, + choose_any_monster, bool in_sight = true, - bool prefer_named = false); + bool prefer_named = false, bool prefer_priest = false); monsters *choose_random_monster_on_level( int weight, bool (*suitable)(const monsters* mon) = - choose_any_monster, + choose_any_monster, bool in_sight = true, bool near_by = false, - bool prefer_named = false); + bool prefer_named = false, bool prefer_priest = false); /* *********************************************************************** * called from: acr diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index e1d969745c..a924c6c1df 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1555,8 +1555,10 @@ bool bless_follower(monsters *follower, if (chance > 2) return (false); - // Choose a random follower in LOS, preferably a named one (10% chance). - follower = choose_random_nearby_monster(0, suitable, true, true); + // Choose a random follower in LOS, preferably a named one, or a + // priestly one for Beogh (10% chance). + follower = choose_random_nearby_monster(0, suitable, true, true, + god == GOD_BEOGH); if (!follower) { @@ -1564,7 +1566,8 @@ bool bless_follower(monsters *follower, return (false); // Try again, without the LOS restriction (5% chance). - follower = choose_random_nearby_monster(0, suitable, false, true); + follower = choose_random_nearby_monster(0, suitable, false, true, + god == GOD_BEOGH); if (!follower) { @@ -1572,8 +1575,9 @@ bool bless_follower(monsters *follower, return (false); // Try *again*, on the entire level (2.5% chance). - follower = choose_random_monster_on_level(0, suitable, - false, false, true); + follower = choose_random_monster_on_level(0, suitable, false, + false, true, + god == GOD_BEOGH); if (!follower) { |