summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-24 23:05:09 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-24 23:05:09 +0000
commit86878386c072b70e0e54c7176cdfae250564ddae (patch)
tree4b4ceaffa08a376a601c3579a295ce1fd9f7b923 /crawl-ref/source/religion.cc
parent6388931826b0bced2cd7f185b85e2f3d299b2f71 (diff)
downloadcrawl-ref-86878386c072b70e0e54c7176cdfae250564ddae.tar.gz
crawl-ref-86878386c072b70e0e54c7176cdfae250564ddae.zip
Fix blessing routine -- oops!
Fix choose_random_nearby_monster() to really pick a random monster rather than the first one that fits, and allow named monsters to get higher chances. Use this when deciding which monster to bless (only happens if the one doing the kill, usually the player, is not eligible for blessing). At high xp levels allow reinforcement (if there are no orcs nearby) to send in high xp orcs: orc warrior, orc knight, or orc warlord, rather than the normal ones (orc, orc wizard, orc priest). At xl 27 the probability for this happening is about 31%. Problem: From the code, it appears that scumming for large armies is possible by deliberately losing your followers somewhere and then killing monsters until you get the reinforcement effect. This will have to be controlled somehow, while still allowing for genuinely lost allies somewhere on the level. Maybe use recall instead or something like that. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4598 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc86
1 files changed, 45 insertions, 41 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 4448765d2e..9021dd92be 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1026,13 +1026,20 @@ static bool _beogh_blessing_reinforcement()
MONS_ORC, MONS_ORC_WIZARD, MONS_ORC_PRIEST
};
+ const monster_type high_xl_followers[] = {
+ MONS_ORC_PRIEST, MONS_ORC_WARRIOR, MONS_ORC_KNIGHT, MONS_ORC_WARLORD
+ };
+
// Send up to four followers.
int how_many = random2(4) + 1;
+ monster_type follower_type;
for (int i = 0; i < how_many; ++i)
{
- monster_type follower_type =
- followers[RANDOM_ELEMENT(followers)];
+ if (random2(you.experience_level) >= 9 && coinflip())
+ follower_type = RANDOM_ELEMENT(high_xl_followers);
+ else
+ follower_type = RANDOM_ELEMENT(followers);
int monster = create_monster(follower_type, 0, BEH_GOD_GIFT,
you.x_pos, you.y_pos, you.pet_target,
@@ -1040,7 +1047,6 @@ static bool _beogh_blessing_reinforcement()
if (monster != -1)
{
monsters *mon = &menv[monster];
-
mon->flags |= MF_ATT_CHANGE_ATTEMPT;
success = true;
@@ -1079,67 +1085,62 @@ bool bless_follower(int follower,
bool (*suitable)(const monsters* mon),
bool force)
{
- monsters *mon;
-
std::string pronoun;
std::string blessed;
std::string result;
+ monsters *mon;
- int chance = random2(20);
- if (force)
- chance = coinflip();
+ int chance = (force ? coinflip() : random2(20));
+
+ if (chance > 2)
+ return false;
bool is_near = false;
// If a follower was specified, and it's suitable, pick it.
- if (follower != -1 && (force || suitable(&menv[follower])))
- mon = &menv[follower];
// Otherwise, pick a random follower within sight of the player.
- else
+ if (follower == -1 || (!force && !suitable(&menv[follower])))
{
- int monster = choose_random_nearby_monster(0, suitable);
+ // Choose a random follower in LOS, preferably a named one.
+ follower = choose_random_nearby_monster(0, suitable, true);
- if (monster == NON_MONSTER)
+ if (follower == NON_MONSTER)
{
- if (chance <= 1)
+ switch (god)
{
- switch (god)
+ case GOD_BEOGH:
{
- case GOD_BEOGH:
- {
- // If no follower was chosen, either send
- // reinforcement or get out.
- bool reinforced = _beogh_blessing_reinforcement();
-
- if (!reinforced || coinflip())
- {
- // Try again, or possibly send more
- // reinforcement.
- if (_beogh_blessing_reinforcement())
- reinforced = true;
- }
+ // If no follower was chosen, either send
+ // reinforcement or get out.
+ bool reinforced = _beogh_blessing_reinforcement();
- if (reinforced)
- {
- pronoun = "";
- blessed = "you";
- result = "reinforcement";
- goto blessing_done;
- }
- break;
- }
+ if (!reinforced || coinflip())
+ {
+ // Try again, or possibly send more reinforcement.
+ if (_beogh_blessing_reinforcement())
+ reinforced = true;
+ }
- default:
- break;
+ if (reinforced)
+ {
+ pronoun = "";
+ blessed = "you";
+ result = "reinforcement";
+ goto blessing_done;
+ }
+ break;
}
+
+ default:
+ break;
}
return false;
}
- mon = &menv[monster];
}
+ mon = &menv[follower];
is_near = mons_near(mon);
pronoun = (mons_is_unique(mon->type)) ? "" : "your ";
@@ -1302,7 +1303,10 @@ bool bless_follower(int follower,
}
blessing_done:
- std::string whom = get_unique_monster_name(mon);
+ std::string whom = "";
+ if (follower != NON_MONSTER)
+ whom = get_unique_monster_name(mon);
+
if (whom.empty())
whom = pronoun + blessed;