From bd4a9cb9d0fc64d9938428fdfb78a4c3764e7380 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sat, 7 Jun 2008 20:24:39 +0000 Subject: Clean up again. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5552 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells2.cc | 118 +++++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 51 deletions(-) (limited to 'crawl-ref/source/spells2.cc') diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index d4b4d7f3ca..2373f26073 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1830,6 +1830,68 @@ 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); +} + static bool _summon_demon_wrapper(int pow, bool god_gift, demon_class_type dct, int dur, bool friendly) { @@ -1886,60 +1948,22 @@ bool cast_demonic_horde(int pow, bool god_gift) return (success); } -bool cast_call_canine_familiar(int pow, bool god_gift) +bool cast_summon_ice_beast(int pow, bool god_gift) { bool success = false; - monster_type mon = MONS_PROGRAM_BUG; + monster_type mon = MONS_ICE_BEAST; 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, + mgen_data(mon, BEH_FRIENDLY, dur, you.pos(), + you.pet_target, god_gift ? MF_GOD_GIFT : 0)) != -1) { success = true; - mprf("A canine appears!%s", - friendly ? "" : " It doesn't look very happy."); + mpr("A chill wind blows around you."); } if (!success) @@ -1977,10 +2001,6 @@ bool summon_general_creature_spell(spell_type spell, int pow, { switch (spell) { - case SPELL_SUMMON_ICE_BEAST: - mon = MONS_ICE_BEAST; - break; - case SPELL_SUMMON_UGLY_THING: { const int chance = std::max(6 - (pow / 12), 1); @@ -2061,10 +2081,6 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon, switch (mon) { - case MONS_ICE_BEAST: - msg = "A chill wind blows around you."; - break; - case MONS_UGLY_THING: msg = "An ugly thing appears."; break; -- cgit v1.2.3-54-g00ecf