summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 21:14:34 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 21:14:34 +0000
commit857a0760acce7f0e7bf9346aeb5a0a050602ecc9 (patch)
treec96752a39eaced683e6c902d0bb535c3b39a3d0e /crawl-ref/source
parent46a28d2a16ce83edcd522516daf40a6e44f19977 (diff)
downloadcrawl-ref-857a0760acce7f0e7bf9346aeb5a0a050602ecc9.tar.gz
crawl-ref-857a0760acce7f0e7bf9346aeb5a0a050602ecc9.zip
Clean up yet some more.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5555 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/spells2.cc126
-rw-r--r--crawl-ref/source/spells2.h2
-rw-r--r--crawl-ref/source/spl-cast.cc9
3 files changed, 67 insertions, 70 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 9ee725d075..b92276cfd1 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -2026,71 +2026,78 @@ bool cast_summon_greater_demon(int pow, bool god_gift)
return (success);
}
-bool summon_general_creature_spell(spell_type spell, int pow,
- bool god_gift)
+bool cast_summon_wraiths(int pow, bool god_gift)
{
bool success = false;
- monster_type mon = MONS_PROGRAM_BUG;
+ const int chance = random2(25);
+ monster_type mon = ((chance > 8) ? MONS_WRAITH : // 64%
+ (chance > 3) ? MONS_FREEZING_WRAITH // 20%
+ : MONS_SPECTRAL_WARRIOR); // 16%
- int hostile = (spell == SPELL_SUMMON_WRAITHS
- || spell == SPELL_SUMMON_DRAGON) ? 5
- : -1;
+ bool friendly = (random2(pow) > 5);
- int dur = (spell == SPELL_SUMMON_WRAITHS) ? 5
- : -1;
+ if (create_monster(
+ mgen_data(mon,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ 5, you.pos(),
+ friendly ? you.pet_target : MHITYOU,
+ god_gift ? MF_GOD_GIFT : 0)) != -1)
+ {
+ success = true;
- int how_many = (spell == SPELL_SUMMON_WRAITHS) ?
- stepdown_value(1 + random2(pow) / 30 + random2(pow) / 30,
- 2, 2, 6, 8)
- : 1;
+ mprf("%s",
+ friendly ? "An insubstantial figure forms in the air."
+ : "You sense a hostile presence.");
+ }
- for (int i = 0; i < how_many; ++i)
+ if (!success)
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ //jmf: Kiku sometimes deflects this
+ if (!(you.religion == GOD_KIKUBAAQUDGHA
+ && (!player_under_penance()
+ && you.piety >= piety_breakpoint(3)
+ && you.piety > random2(MAX_PIETY))))
{
- switch (spell)
- {
- case SPELL_SUMMON_WRAITHS:
- {
- const int chance = random2(25);
- mon = ((chance > 8) ? MONS_WRAITH :
- (chance > 3) ? MONS_FREEZING_WRAITH
- : MONS_SPECTRAL_WARRIOR);
- break;
- }
+ disease_player(25 + random2(50));
+ }
- case SPELL_SUMMON_GUARDIAN:
- mon = MONS_ANGEL;
- break;
+ return (success);
+}
- case SPELL_SUMMON_DAEVA:
- mon = MONS_DAEVA;
- break;
+bool summon_general_creature_spell(spell_type spell, int pow,
+ bool god_gift)
+{
+ bool success = false;
- case SPELL_SUMMON_DRAGON:
- mon = MONS_DRAGON;
- break;
+ monster_type mon = MONS_PROGRAM_BUG;
- default:
- break;
- }
+ int hostile = (spell == SPELL_SUMMON_DRAGON) ? 5
+ : -1;
- if (summon_general_creature(pow, false, mon, BEH_FRIENDLY,
- hostile, dur, false))
- {
- success = true;
- }
+ 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;
+
+ default:
+ break;
}
- if (success && spell == SPELL_SUMMON_WRAITHS)
+ if (summon_general_creature(pow, false, mon, BEH_FRIENDLY,
+ hostile, -1, false))
{
- if (!you.is_undead
- && !(you.religion == GOD_KIKUBAAQUDGHA
- && (!player_under_penance()
- && you.piety >= piety_breakpoint(3)
- && you.piety > random2(MAX_PIETY))))
- {
- disease_player(25 + random2(50));
- }
+ success = true;
}
return (success);
@@ -2114,12 +2121,6 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon,
switch (mon)
{
- case MONS_WRAITH:
- case MONS_FREEZING_WRAITH:
- case MONS_SPECTRAL_WARRIOR:
- msg = "An insubstantial figure forms in the air.";
- break;
-
case MONS_ANGEL:
msg = "You open a gate to Zin's realm!";
break;
@@ -2139,17 +2140,8 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon,
}
}
- if (beha == BEH_CHARMED)
- {
- msg += " You don't feel so good about this...";
- }
- else if (beha == BEH_HOSTILE)
- {
- if (mons_class_holiness(mon) == MH_UNDEAD)
- msg = "You sense a hostile presence.";
- else
- msg += " It doesn't look very happy.";
- }
+ if (beha == BEH_HOSTILE)
+ msg += " It doesn't look very happy.";
int monster =
create_monster(
@@ -2166,7 +2158,7 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon,
monsters *summon = &menv[monster];
- if (mon == MONS_DAEVA)
+ if (mon == MONS_ANGEL || mon == MONS_DAEVA)
summon->flags |= MF_ATT_CHANGE_ATTEMPT;
}
else
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 6739eeed91..079ad068b9 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -161,6 +161,8 @@ 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_wraiths(int pow, bool god_gift = false);
+
bool summon_general_creature_spell(spell_type spell, int pow,
bool god_gift = false);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 4031e02f6c..fe4a1becba 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1515,8 +1515,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_summon_greater_demon(powc);
break;
- // Remember that most holy spells don't yet use powc!
case SPELL_SUMMON_WRAITHS:
+ cast_summon_wraiths(powc);
+ break;
+
+ // Remember that most holy spells don't yet use powc!
case SPELL_SUMMON_GUARDIAN:
case SPELL_SUMMON_DAEVA:
case SPELL_SUMMON_DRAGON:
@@ -2782,10 +2785,10 @@ static void _miscast_necromancy(int severity, const char* cause)
mpr("You sense a malignant aura.");
break;
case 8:
- canned_msg(MSG_NOTHING_HAPPENS);
+ mpr("You feel very uncomfortable.");
break;
case 9:
- mpr("You feel very uncomfortable.");
+ canned_msg(MSG_NOTHING_HAPPENS);
break;
}
break;