summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 00:13:14 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 00:13:14 +0000
commitb857cd3be4fe4adcf3a5abcf83d9873439dc1ab1 (patch)
treed3e81e8210fd1a2f8d90ac8ed1c63852336d6acc /crawl-ref/source/spells2.cc
parenta93993cc7b9e26ee669979d00ed34c3649e2b4ec (diff)
downloadcrawl-ref-b857cd3be4fe4adcf3a5abcf83d9873439dc1ab1.tar.gz
crawl-ref-b857cd3be4fe4adcf3a5abcf83d9873439dc1ab1.zip
Simplify summoning of hostile holy beings.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5565 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc103
1 files changed, 58 insertions, 45 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 5d2edc99c0..c9531a7d7e 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -2045,50 +2045,6 @@ bool cast_summon_wraiths(int pow, bool god_gift)
return (success);
}
-static bool _summon_holy_being_wrapper(int pow, bool god_gift,
- holy_being_class_type hbct)
-{
- bool success = false;
-
- monster_type mon = summon_any_holy_being(hbct);
-
- const int dur = std::min(2 + (random2(pow) / 4), 6);
-
- mprf("You open a gate to %s's realm!",
- (mon == MONS_DAEVA) ? god_name(GOD_SHINING_ONE).c_str()
- : god_name(GOD_ZIN).c_str());
-
- int monster = create_monster(
- mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
- you.pet_target,
- god_gift ? MF_GOD_GIFT : 0));
- if (monster != -1)
- {
- success = true;
-
- monsters *summon = &menv[monster];
- summon->flags |= MF_ATT_CHANGE_ATTEMPT;
-
- mprf("You are momentarily dazzled by a brilliant %s light.",
- (mon == MONS_DAEVA) ? "golden"
- : "white");
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
-
- return (success);
-}
-
-bool cast_summon_guardian(int pow, bool god_gift)
-{
- return _summon_holy_being_wrapper(pow, god_gift, HOLY_BEING_ANGEL);
-}
-
-bool cast_summon_daeva(int pow, bool god_gift)
-{
- return _summon_holy_being_wrapper(pow, god_gift, HOLY_BEING_DAEVA);
-}
-
bool cast_summon_dragon(int pow, bool god_gift)
{
// Removed the chance of multiple dragons... one should be more
@@ -2157,7 +2113,7 @@ bool summon_specific_demon(monster_type mon, int pow, bool god_gift)
return (success);
}
-// Trog sends some fighting buddies (or enemies) for his followers.
+// Trog sends a fighting buddy (or enemy) for a follower.
bool summon_berserker(int pow, bool force_hostile)
{
bool success = false;
@@ -2236,6 +2192,63 @@ bool summon_berserker(int pow, bool force_hostile)
return (success);
}
+static bool _summon_holy_being_wrapper(int pow, holy_being_class_type hbct,
+ bool force_hostile, bool quiet,
+ bool permanent)
+{
+ bool success = false;
+
+ monster_type mon = summon_any_holy_being(hbct);
+
+ const int dur = (permanent) ? 0 : std::min(2 + (random2(pow) / 4), 6);
+
+ if (!quiet)
+ {
+ mprf("You open a gate to %s's realm!",
+ (mon == MONS_DAEVA) ? god_name(GOD_SHINING_ONE).c_str()
+ : god_name(GOD_ZIN).c_str());
+ }
+
+ int monster = create_monster(
+ mgen_data(mon,
+ !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
+ dur, you.pos(),
+ !force_hostile ? you.pet_target : MHITYOU,
+ MF_GOD_GIFT));
+ if (monster != -1)
+ {
+ success = true;
+
+ monsters *summon = &menv[monster];
+ summon->flags |= MF_ATT_CHANGE_ATTEMPT;
+
+ if (!quiet)
+ {
+ mprf("You are momentarily dazzled by a brilliant %s light.",
+ (mon == MONS_DAEVA) ? "golden"
+ : "white");
+ }
+ }
+
+ return (success);
+}
+
+// Zin sends an angel for a follower.
+bool summon_guardian(int pow, bool force_hostile, bool quiet,
+ bool permanent)
+{
+ return _summon_holy_being_wrapper(pow, HOLY_BEING_ANGEL, force_hostile,
+ quiet, permanent);
+}
+
+// TSO sends a daeva for a follower.
+bool summon_daeva(int pow, bool force_hostile, bool quiet,
+ bool permanent)
+{
+ return _summon_holy_being_wrapper(pow, HOLY_BEING_DAEVA, force_hostile,
+ quiet, permanent);
+}
+
void summon_things(int pow)
{
int big_things = 0;