summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 21:43:07 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 21:43:07 +0000
commit4e09ab3a1e2477f405ec94e02a4b5aba22928b7a (patch)
tree575e3011fbcecdf9684d4170abb024271df60424 /crawl-ref/source/spells3.cc
parent28595dfdcc32c09e67c728eb3cba0af9acab38fe (diff)
downloadcrawl-ref-4e09ab3a1e2477f405ec94e02a4b5aba22928b7a.tar.gz
crawl-ref-4e09ab3a1e2477f405ec94e02a4b5aba22928b7a.zip
Move most of the demon-summoning routines to spells3.cc, since they're
unholy. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5611 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc120
1 files changed, 120 insertions, 0 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 1155568972..ead8d17a10 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -412,6 +412,126 @@ bool cast_sublimation_of_blood(int pow)
return (success);
}
+bool cast_call_imp(int pow, bool god_gift)
+{
+ bool success = false;
+
+ monster_type mon = (one_chance_in(3)) ? MONS_WHITE_IMP :
+ (one_chance_in(7)) ? MONS_SHADOW_IMP
+ : MONS_IMP;
+
+ const int dur = std::min(2 + (random2(pow) / 4), 6);
+
+ if (create_monster(
+ mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
+ you.pet_target,
+ god_gift ? MF_GOD_GIFT : 0)) != -1)
+ {
+ success = true;
+
+ mpr((mon == MONS_WHITE_IMP) ? "A beastly little devil appears in a puff of frigid air." :
+ (mon == MONS_SHADOW_IMP) ? "A shadowy apparition takes form in the air."
+ : "A beastly little devil appears in a puff of flame.");
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
+static bool _summon_demon_class_wrapper(int pow, bool god_gift,
+ demon_class_type dct, int dur,
+ bool friendly, bool charmed)
+{
+ bool success = false;
+
+ mpr("You open a gate to Pandemonium!");
+
+ monster_type mon = summon_any_demon(dct);
+
+ if (create_monster(
+ mgen_data(mon,
+ friendly ? BEH_FRIENDLY :
+ charmed ? BEH_CHARMED : BEH_HOSTILE,
+ dur, you.pos(),
+ friendly ? you.pet_target : MHITYOU,
+ god_gift ? MF_GOD_GIFT : 0)) != -1)
+ {
+ success = true;
+
+ mprf("A demon appears!%s",
+ friendly ? "" :
+ charmed ? " You don't feel so good about this..."
+ : " It doesn't look very happy.");
+ }
+
+ return (success);
+}
+
+bool summon_lesser_demon(int pow, bool god_gift)
+{
+ return _summon_demon_class_wrapper(pow, god_gift, DEMON_LESSER,
+ std::min(2 + (random2(pow) / 4), 6),
+ random2(pow) > 3, false);
+}
+
+bool summon_common_demon(int pow, bool god_gift)
+{
+ return _summon_demon_class_wrapper(pow, god_gift, DEMON_COMMON,
+ std::min(2 + (random2(pow) / 4), 6),
+ random2(pow) > 3, false);
+}
+
+bool summon_greater_demon(int pow, bool god_gift)
+{
+ return _summon_demon_class_wrapper(pow, god_gift, DEMON_GREATER,
+ 5, false, random2(pow) > 5);
+}
+
+bool cast_summon_demon(int pow, bool god_gift)
+{
+ mpr("You open a gate to Pandemonium!");
+
+ bool success = summon_common_demon(pow, god_gift);
+
+ if (!success)
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
+bool cast_demonic_horde(int pow, bool god_gift)
+{
+ bool success = false;
+
+ const int how_many = 7 + random2(5);
+
+ mpr("You open a gate to Pandemonium!");
+
+ for (int i = 0; i < how_many; ++i)
+ {
+ if (summon_lesser_demon(pow, god_gift))
+ success = true;
+ }
+
+ if (!success)
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
+bool cast_summon_greater_demon(int pow, bool god_gift)
+{
+ mpr("You open a gate to Pandemonium!");
+
+ bool success = summon_greater_demon(pow, god_gift);
+
+ if (!success)
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
bool cast_summon_horrible_things(int pow, bool god_gift)
{
if (one_chance_in(3)