summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 18:44:17 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 18:44:17 +0000
commitf5156c1a88350f8f2534e1bc80847172e74cf489 (patch)
treee3d36c4bdbc3b4ebc2d5e1532d17760e1d4965b4 /crawl-ref/source/spells2.cc
parente5b3e8a0ce548ff817583809fadc06329db21a11 (diff)
downloadcrawl-ref-f5156c1a88350f8f2534e1bc80847172e74cf489.tar.gz
crawl-ref-f5156c1a88350f8f2534e1bc80847172e74cf489.zip
Add more cleanups.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5548 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc107
1 files changed, 63 insertions, 44 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 16bc5b3cf6..d61de07a87 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1830,13 +1830,73 @@ bool cast_call_imp(int pow, bool god_gift)
return (success);
}
+bool cast_call_canine_familiar(int pow, bool god_gift)
+{
+ bool success = false;
+
+ monster_type mon = MONS_PROGRAM_BUG;
+
+ const int dur = std::min(2 + (random2(pow) / 4), 6);
+
+ const int chance = random2(pow);
+
+ if (chance < 10)
+ mon = MONS_JACKAL;
+ else if (chance < 15)
+ mon = MONS_HOUND;
+ else
+ {
+ switch (chance % 7)
+ {
+ case 0:
+ if (one_chance_in(you.species == SP_HILL_ORC ? 3 : 6))
+ mon = MONS_WARG;
+ else
+ mon = MONS_WOLF;
+ break;
+
+ case 1:
+ case 2:
+ mon = MONS_WAR_DOG;
+ break;
+
+ case 3:
+ case 4:
+ mon = MONS_HOUND;
+ break;
+
+ default:
+ mon = MONS_JACKAL;
+ break;
+ }
+ }
+
+ bool friendly = (random2(pow) > 3);
+
+ 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;
+
+ mprf("A canine appears!%s",
+ friendly ? "" : " It doesn't look very happy.");
+ }
+
+ if (!success)
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
bool summon_general_creature_spell(spell_type spell, int pow,
bool god_gift)
{
bool success = false;
- bool quiet = (spell == SPELL_CALL_CANINE_FAMILIAR);
-
monster_type mon = MONS_PROGRAM_BUG;
beh_type beha = (spell == SPELL_SUMMON_GREATER_DEMON) ? BEH_CHARMED
@@ -1844,7 +1904,6 @@ bool summon_general_creature_spell(spell_type spell, int pow,
int hostile = (spell == SPELL_SUMMON_DEMON
|| spell == SPELL_DEMONIC_HORDE
- || spell == SPELL_CALL_CANINE_FAMILIAR
|| spell == SPELL_SUMMON_UGLY_THING) ? 3 :
(spell == SPELL_SUMMON_GREATER_DEMON
|| spell == SPELL_SUMMON_WRAITHS
@@ -1875,38 +1934,6 @@ bool summon_general_creature_spell(spell_type spell, int pow,
: DEMON_LESSER);
break;
- case SPELL_CALL_CANINE_FAMILIAR:
- {
- const int chance = random2(pow);
- if (chance < 10)
- mon = MONS_JACKAL;
- else if (chance < 15)
- mon = MONS_HOUND;
- else
- {
- switch (chance % 7)
- {
- case 0:
- if (one_chance_in(you.species == SP_HILL_ORC ? 3 : 6))
- mon = MONS_WARG;
- else
- mon = MONS_WOLF;
- break;
- case 1:
- case 2:
- mon = MONS_WAR_DOG;
- break;
- case 3:
- case 4:
- mon = MONS_HOUND;
- break;
- default:
- mon = MONS_JACKAL;
- break;
- }
- }
- }
-
case SPELL_SUMMON_ICE_BEAST:
mon = MONS_ICE_BEAST;
break;
@@ -1951,7 +1978,7 @@ bool summon_general_creature_spell(spell_type spell, int pow,
mpr("You open a gate to Pandemonium!");
}
- if (summon_general_creature(pow, quiet, mon, beha,
+ if (summon_general_creature(pow, false, mon, beha,
hostile, dur, false))
{
success = true;
@@ -1991,14 +2018,6 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon,
switch (mon)
{
- case MONS_JACKAL:
- case MONS_HOUND:
- case MONS_WARG:
- case MONS_WOLF:
- case MONS_WAR_DOG:
- msg = "A canine appears!";
- break;
-
case MONS_ICE_BEAST:
msg = "A chill wind blows around you.";
break;