summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/religion.cc51
-rw-r--r--crawl-ref/source/religion.h2
2 files changed, 53 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
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index f4416658be..b21a525f90 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -71,6 +71,8 @@ bool ely_destroy_weapons();
bool trog_burn_books();
bool tso_stab_safe_monster(const actor *act);
+void bless_follower(god_type god,
+ bool (*suitable)(const monsters* mon));
bool is_orcish_follower(const monsters* mon);
bool god_hates_attacking_friend(god_type god, const actor *fr);