summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 23:45:43 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 23:45:43 +0000
commita93993cc7b9e26ee669979d00ed34c3649e2b4ec (patch)
tree2e04ae6c9ca4e78e8b6b9a401a39ed2e35128b4d /crawl-ref/source
parent0380e33912ed90d0cf6f9aac69b1ff2a63bd292f (diff)
downloadcrawl-ref-a93993cc7b9e26ee669979d00ed34c3649e2b4ec.tar.gz
crawl-ref-a93993cc7b9e26ee669979d00ed34c3649e2b4ec.zip
Clean up some more.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5564 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc29
-rw-r--r--crawl-ref/source/spells2.cc211
-rw-r--r--crawl-ref/source/spells2.h15
-rw-r--r--crawl-ref/source/spl-cast.cc10
4 files changed, 132 insertions, 133 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 83388249d2..8a616712b3 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1277,15 +1277,11 @@ static bool _do_ability(const ability_def& abil)
// DEMONIC POWERS:
case ABIL_SUMMON_MINOR_DEMON:
- summon_general_creature(you.experience_level * 4, false,
- summon_any_demon(DEMON_LESSER),
- BEH_FRIENDLY);
+ summon_minor_demon(you.experience_level * 4);
break;
case ABIL_SUMMON_DEMON:
- summon_general_creature(you.experience_level * 4, false,
- summon_any_demon(DEMON_COMMON),
- BEH_FRIENDLY);
+ summon_demon(you.experience_level * 4);
break;
case ABIL_HELLFIRE:
@@ -1438,8 +1434,7 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_TSO_SUMMON_DAEVA:
- summon_general_creature(you.skills[SK_INVOCATIONS] * 4, false,
- MONS_DAEVA, BEH_FRIENDLY, true);
+ cast_summon_daeva(you.skills[SK_INVOCATIONS] * 4, true);
exercise(SK_INVOCATIONS, 8 + random2(10));
break;
@@ -1461,8 +1456,8 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_KIKU_INVOKE_DEATH:
- summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false,
- MONS_REAPER, BEH_FRIENDLY, true);
+ summon_specific_demon(MONS_REAPER,
+ 20 + you.skills[SK_INVOCATIONS] * 3, true);
exercise(SK_INVOCATIONS, 10 + random2(14));
break;
@@ -1542,10 +1537,9 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB:
- summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false,
- static_cast<monster_type>(
- MONS_NEQOXEC + random2(5)),
- BEH_FRIENDLY, true);
+ summon_specific_demon(static_cast<monster_type>(
+ MONS_NEQOXEC + random2(5)),
+ 20 + you.skills[SK_INVOCATIONS] * 3, true);
exercise(SK_INVOCATIONS, 2 + random2(3));
break;
@@ -1603,10 +1597,9 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB:
- summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false,
- static_cast<monster_type>(
- MONS_EXECUTIONER + random2(5)),
- BEH_FRIENDLY, true);
+ summon_specific_demon(static_cast<monster_type>(
+ MONS_EXECUTIONER + random2(5)),
+ 20 + you.skills[SK_INVOCATIONS] * 3, true);
exercise(SK_INVOCATIONS, 6 + random2(6));
break;
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 2b12440780..5d2edc99c0 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1890,24 +1890,32 @@ bool cast_call_canine_familiar(int pow, bool god_gift)
}
static bool _summon_demon_wrapper(int pow, bool god_gift, demon_class_type dct,
- int dur, bool friendly, bool charmed)
+ int dur, bool friendly, bool charmed,
+ int how_many)
{
bool success = false;
- monster_type mon = summon_any_demon(dct);
+ mpr("You open a gate to Pandemonium!");
- 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)
+ for (int i = 0; i < how_many; ++i)
{
- success = true;
+ monster_type mon = summon_any_demon(dct);
- mprf("A demon appears!%s",
- friendly ? "" : " It doesn't look very happy.");
+ 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.");
+ }
}
if (!success)
@@ -1920,30 +1928,18 @@ bool cast_summon_demon(int pow, bool god_gift)
{
mpr("You open a gate to Pandemonium!");
- return _summon_demon_wrapper(pow, god_gift, DEMON_COMMON,
- std::min(2 + (random2(pow) / 4), 6),
- random2(pow) > 3, false);
+ return summon_demon(pow, god_gift);
}
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_demon_wrapper(pow, god_gift, DEMON_LESSER,
- std::min(2 + (random2(pow) / 4), 6),
- random2(pow) > 3, false))
- {
- success = true;
- }
- }
-
- return (success);
+ return _summon_demon_wrapper(pow, god_gift, DEMON_LESSER,
+ std::min(2 + (random2(pow) / 4), 6),
+ random2(pow) > 3, false, how_many);
}
bool cast_summon_ice_beast(int pow, bool god_gift)
@@ -2002,24 +1998,12 @@ bool cast_summon_ugly_thing(int pow, bool god_gift)
bool cast_summon_greater_demon(int pow, bool god_gift)
{
- bool success = false;
-
- mpr("You open a gate to Pandemonium!");
-
bool charmed = (random2(pow) > 5);
- if (_summon_demon_wrapper(pow, god_gift, DEMON_GREATER,
- 5, false, charmed))
- {
- success = true;
-
- mpr("A demon appears!");
-
- if (charmed)
- mpr("You don't feel so good about this...");
- }
+ mpr("You open a gate to Pandemonium!");
- return (success);
+ return _summon_demon_wrapper(pow, god_gift, DEMON_GREATER,
+ 5, false, charmed, 1);
}
bool cast_summon_wraiths(int pow, bool god_gift)
@@ -2061,100 +2045,111 @@ bool cast_summon_wraiths(int pow, bool god_gift)
return (success);
}
-bool summon_general_creature_spell(spell_type spell, int pow,
- bool god_gift)
+static bool _summon_holy_being_wrapper(int pow, bool god_gift,
+ holy_being_class_type hbct)
{
bool success = false;
- monster_type mon = MONS_PROGRAM_BUG;
-
- int hostile = (spell == SPELL_SUMMON_DRAGON) ? 5
- : -1;
+ monster_type mon = summon_any_holy_being(hbct);
- switch (spell)
- {
- case SPELL_SUMMON_GUARDIAN:
- mon = MONS_ANGEL;
- break;
-
- case SPELL_SUMMON_DAEVA:
- mon = MONS_DAEVA;
- break;
-
- case SPELL_SUMMON_DRAGON:
- mon = MONS_DRAGON;
- break;
+ const int dur = std::min(2 + (random2(pow) / 4), 6);
- default:
- break;
- }
+ 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());
- if (summon_general_creature(pow, false, mon, BEH_FRIENDLY,
- hostile, -1, false))
+ 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 summon_general_creature(int pow, bool quiet, monster_type mon,
- beh_type beha, int hostile, int dur,
- bool god_gift)
+bool cast_summon_guardian(int pow, bool god_gift)
{
- if (beha != BEH_HOSTILE && random2(pow) > hostile)
- beha = BEH_HOSTILE;
-
- if (dur == -1)
- dur = std::min(2 + (random2(pow) / 4), 6);
+ return _summon_holy_being_wrapper(pow, god_gift, HOLY_BEING_ANGEL);
+}
- unsigned short hitting = (beha == BEH_FRIENDLY) ? you.pet_target : MHITYOU;
+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
+ // than enough, and if it isn't, the player can cast again...
+ // especially since these aren't on the Abjuration plan... they'll
+ // last until they die (maybe that should be changed, but this is
+ // a very high level spell so it might be okay). -- bwr
bool success = false;
- std::string msg = "";
+ const bool friendly = (random2(pow) > 5);
- switch (mon)
+ if (create_monster(
+ mgen_data(MONS_DRAGON,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, 3,
+ you.pos(),
+ friendly ? you.pet_target : MHITYOU)) != -1)
{
- case MONS_ANGEL:
- msg = "You open a gate to Zin's realm!";
- break;
+ success = true;
- case MONS_DAEVA:
- msg = "You are momentarily dazzled by a brilliant golden light.";
- break;
+ mprf("A dragon appears.%s",
+ friendly ? "" : " It doesn't look very happy.");
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
- case MONS_DRAGON:
- msg = "A dragon appears.";
- break;
+ return (success);
+}
- default:
- {
- msg = "A demon appears!";
- break;
- }
- }
+bool summon_minor_demon(int pow, bool god_gift)
+{
+ return _summon_demon_wrapper(pow, god_gift, DEMON_LESSER,
+ std::min(2 + (random2(pow) / 4), 6),
+ random2(pow) > 3, false, 1);
+}
- if (beha == BEH_HOSTILE)
- msg += " It doesn't look very happy.";
+bool summon_demon(int pow, bool god_gift)
+{
+ return _summon_demon_wrapper(pow, god_gift, DEMON_COMMON,
+ std::min(2 + (random2(pow) / 4), 6),
+ random2(pow) > 3, false, 1);
+}
- int monster =
- create_monster(
- mgen_data(mon, beha, dur,
- you.pos(), hitting,
- god_gift ? MF_GOD_GIFT : 0));
+bool summon_specific_demon(monster_type mon, int pow, bool god_gift)
+{
+ bool success = false;
- if (monster != -1)
- {
- if (!quiet)
- mprf("%s", msg.c_str());
+ const int dur = std::min(2 + (random2(pow) / 4), 6);
- success = true;
+ const bool friendly = (random2(pow) > 3);
- monsters *summon = &menv[monster];
+ if (create_monster(
+ mgen_data(mon,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ dur, you.pos(),
+ friendly ? you.pet_target : MHITYOU,
+ god_gift ? MF_GOD_GIFT : 0)) != -1)
+ {
+ success = true;
- if (mon == MONS_ANGEL || mon == MONS_DAEVA)
- summon->flags |= MF_ATT_CHANGE_ATTEMPT;
+ mprf("A demon appears!%s",
+ friendly ? "" : " It doesn't look very happy.");
}
else
canned_msg(MSG_NOTHING_HAPPENS);
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 079ad068b9..47a9546440 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -163,12 +163,17 @@ bool cast_summon_greater_demon(int pow, bool god_gift = false);
bool cast_summon_wraiths(int pow, bool god_gift = false);
-bool summon_general_creature_spell(spell_type spell, int pow,
- bool god_gift = false);
+bool cast_summon_guardian(int pow, bool god_gift = false);
-bool summon_general_creature(int pow, bool quiet, monster_type mon,
- beh_type beha, int hostile = -1, int dur = -1,
- bool god_gift = false);
+bool cast_summon_daeva(int pow, bool god_gift = false);
+
+bool cast_summon_dragon(int pow, bool god_gift = false);
+
+bool summon_minor_demon(int pow, bool god_gift = false);
+
+bool summon_demon(int pow, bool god_gift = false);
+
+bool summon_specific_demon(monster_type mon, int pow, bool god_gift = false);
// last updated 24may2000 {dlb}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index fe4a1becba..7cad63c787 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1004,6 +1004,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
_surge_power(spell);
// Added this so that the passed in powc can have meaning -- bwr
+ // Remember that most holy spells don't yet use powc!
if (powc == 0)
powc = calc_spell_power( spell, true );
@@ -1519,11 +1520,16 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_summon_wraiths(powc);
break;
- // Remember that most holy spells don't yet use powc!
case SPELL_SUMMON_GUARDIAN:
+ cast_summon_guardian(powc);
+ break;
+
case SPELL_SUMMON_DAEVA:
+ cast_summon_daeva(powc);
+ break;
+
case SPELL_SUMMON_DRAGON:
- summon_general_creature_spell(spell, powc);
+ cast_summon_dragon(powc);
break;
case SPELL_OZOCUBUS_ARMOUR: