summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
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
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')
-rw-r--r--crawl-ref/source/spells2.cc120
-rw-r--r--crawl-ref/source/spells2.h7
-rw-r--r--crawl-ref/source/spells3.cc120
-rw-r--r--crawl-ref/source/spells3.h7
-rw-r--r--crawl-ref/source/spl-cast.cc32
5 files changed, 143 insertions, 143 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 72ea70af2f..987de531da 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1680,33 +1680,6 @@ bool cast_summon_swarm(int pow, bool god_gift, bool force_hostile,
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);
-}
-
bool cast_call_canine_familiar(int pow, bool god_gift)
{
bool success = false;
@@ -1912,87 +1885,6 @@ bool summon_elemental(int pow, bool god_gift,
return (true);
}
-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_ice_beast(int pow, bool god_gift)
{
bool success = false;
@@ -2047,18 +1939,6 @@ bool cast_summon_ugly_thing(int pow, bool god_gift)
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_dragon(int pow, bool god_gift)
{
// Removed the chance of multiple dragons... one should be more
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 8570117899..12b313bdd5 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -145,16 +145,9 @@ bool cast_summon_swarm(int pow, bool god_gift = false,
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool cast_call_imp(int pow, bool god_gift = false);
bool cast_call_canine_familiar(int pow, bool god_gift = false);
-bool summon_lesser_demon(int pow, bool god_gift = false);
-bool summon_common_demon(int pow, bool god_gift = false);
-bool summon_greater_demon(int pow, bool god_gift = false);
-bool cast_summon_demon(int pow, bool god_gift = false);
-bool cast_demonic_horde(int pow, bool god_gift = false);
bool cast_summon_ice_beast(int pow, bool god_gift = false);
bool cast_summon_ugly_thing(int pow, bool god_gift = false);
-bool cast_summon_greater_demon(int pow, bool god_gift = false);
bool cast_summon_dragon(int pow, bool god_gift = false);
bool cast_conjure_ball_lightning(int pow, bool god_gift = false);
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)
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 2bba87a45f..fc32f03151 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -112,6 +112,13 @@ bool remove_curse(bool suppress_msg);
* *********************************************************************** */
bool cast_sublimation_of_blood(int pow);
+bool cast_call_imp(int pow, bool god_gift = false);
+bool summon_lesser_demon(int pow, bool god_gift = false);
+bool summon_common_demon(int pow, bool god_gift = false);
+bool summon_greater_demon(int pow, bool god_gift = false);
+bool cast_summon_demon(int pow, bool god_gift = false);
+bool cast_demonic_horde(int pow, bool god_gift = false);
+bool cast_summon_greater_demon(int pow, bool god_gift = false);
bool cast_summon_horrible_things(int pow, bool god_gift = false);
bool cast_simulacrum(int pow, bool god_gift = false);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 97347baa5d..eb1feb86ed 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1483,10 +1483,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_summon_swarm(powc);
break;
- case SPELL_CALL_IMP:
- cast_call_imp(powc);
- break;
-
case SPELL_CALL_CANINE_FAMILIAR:
cast_call_canine_familiar(powc);
break;
@@ -1496,14 +1492,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
return (SPRET_ABORT);
break;
- case SPELL_SUMMON_DEMON:
- cast_summon_demon(powc);
- break;
-
- case SPELL_DEMONIC_HORDE:
- cast_demonic_horde(powc);
- break;
-
case SPELL_SUMMON_ICE_BEAST:
cast_summon_ice_beast(powc);
break;
@@ -1512,10 +1500,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_summon_ugly_thing(powc);
break;
- case SPELL_SUMMON_GREATER_DEMON:
- cast_summon_greater_demon(powc);
- break;
-
case SPELL_SUMMON_GUARDIAN:
summon_guardian(powc);
break;
@@ -1537,6 +1521,22 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_tukimas_dance(powc);
break;
+ case SPELL_CALL_IMP:
+ cast_call_imp(powc);
+ break;
+
+ case SPELL_SUMMON_DEMON:
+ cast_summon_demon(powc);
+ break;
+
+ case SPELL_DEMONIC_HORDE:
+ cast_demonic_horde(powc);
+ break;
+
+ case SPELL_SUMMON_GREATER_DEMON:
+ cast_summon_greater_demon(powc);
+ break;
+
case SPELL_SUMMON_HORRIBLE_THINGS:
cast_summon_horrible_things(powc);
break;