summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-20 17:07:47 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-20 17:07:47 +0000
commita3713a349b1e0a7e5191758ac479bff172bd294a (patch)
treee86c554f7f23145fafe152a068eee007722645c3 /crawl-ref/source/religion.cc
parent6af861467f4a57206eb6eb0656140d87021aa7f5 (diff)
downloadcrawl-ref-a3713a349b1e0a7e5191758ac479bff172bd294a.tar.gz
crawl-ref-a3713a349b1e0a7e5191758ac479bff172bd294a.zip
Add somewhat experimental code to bless random followers. Currently,
it's only used for Beogh, and its only effects are full healing and full healing with one or two added hit points. Eventually, it should get more effects, and be expanded for use by TSO. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3752 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 72287b1c6e..ae28e7cc12 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -754,6 +754,48 @@ static void give_nemelex_gift()
}
}
+void bless_follower(god_type god,
+ bool (*suitable)(const monsters* mon))
+{
+ if (!there_are_monsters_nearby())
+ return;
+
+ int monster = choose_random_nearby_monster(0, suitable);
+ monsters* mon = (monster != NON_MONSTER) ? &menv[monster] : NULL;
+
+ if (mon)
+ {
+ const char *result;
+ bool healing = false;
+ bool vigour = true;
+
+ // Full healing.
+ healing = heal_monster(mon, mon->max_hit_points, false);
+
+ if (!healing || coinflip())
+ {
+ // Full healing, plus one added hit point.
+ heal_monster(mon, mon->max_hit_points, true);
+
+ if (coinflip())
+ // Full healing, plus another added hit point.
+ heal_monster(mon, mon->max_hit_points, true);
+
+ vigour = true;
+ }
+
+ if (healing && vigour)
+ result = "healing and extra vigour";
+ else if (healing)
+ result = "healing";
+ else
+ result = "extra vigour";
+
+ mprf(MSGCH_GOD, "%s blesses %s with %s.", god_name(god).c_str(),
+ mon->name(DESC_NOCAP_A).c_str(), result);
+ }
+}
+
static void do_god_gift(bool prayed_for)
{
ASSERT(you.religion != GOD_NO_GOD);
@@ -950,6 +992,15 @@ static void do_god_gift(bool prayed_for)
} // end of giving book
} // end of book gods
break;
+
+ case GOD_BEOGH:
+ // Blessings for followers.
+ if (you.piety >= piety_breakpoint(2)
+ && random2(you.piety) >= piety_breakpoint(0))
+ {
+ bless_follower(GOD_BEOGH, is_orcish_follower);
+ }
+ break;
}
} // end of gift giving