diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 20:38:04 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 20:38:04 +0000 |
commit | 0ccc499b94a92c3467fafffc147d78e1c16167b2 (patch) | |
tree | 37be1f9606bdccdfe3292422a0235a30f8b6f334 /crawl-ref/source/spells2.cc | |
parent | bd4a9cb9d0fc64d9938428fdfb78a4c3764e7380 (diff) | |
download | crawl-ref-0ccc499b94a92c3467fafffc147d78e1c16167b2.tar.gz crawl-ref-0ccc499b94a92c3467fafffc147d78e1c16167b2.zip |
Clean up yet again.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5553 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 2373f26073..bdf927b6cc 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1836,10 +1836,7 @@ bool cast_call_canine_familiar(int pow, bool god_gift) 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) @@ -1871,6 +1868,8 @@ bool cast_call_canine_familiar(int pow, bool god_gift) } } + const int dur = std::min(2 + (random2(pow) / 4), 6); + bool friendly = (random2(pow) > 3); if (create_monster( @@ -1972,6 +1971,38 @@ bool cast_summon_ice_beast(int pow, bool god_gift) return (success); } +bool cast_summon_ugly_thing(int pow, bool god_gift) +{ + bool success = false; + + const int chance = std::max(6 - (pow / 12), 1); + monster_type mon = (one_chance_in(chance)) ? MONS_VERY_UGLY_THING + : MONS_UGLY_THING; + + const int dur = std::min(2 + (random2(pow) / 4), 6); + + 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((mon == MONS_VERY_UGLY_THING) ? "A very ugly thing appears.%s" + : "An ugly thing 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) { @@ -1982,8 +2013,7 @@ bool summon_general_creature_spell(spell_type spell, int pow, beh_type beha = (spell == SPELL_SUMMON_GREATER_DEMON) ? BEH_CHARMED : BEH_FRIENDLY; - int hostile = (spell == SPELL_SUMMON_UGLY_THING) ? 3 : - (spell == SPELL_SUMMON_GREATER_DEMON + int hostile = (spell == SPELL_SUMMON_GREATER_DEMON || spell == SPELL_SUMMON_WRAITHS || spell == SPELL_SUMMON_DRAGON) ? 5 : -1; @@ -2001,14 +2031,6 @@ bool summon_general_creature_spell(spell_type spell, int pow, { switch (spell) { - case SPELL_SUMMON_UGLY_THING: - { - const int chance = std::max(6 - (pow / 12), 1); - mon = (one_chance_in(chance)) ? MONS_VERY_UGLY_THING - : MONS_UGLY_THING; - break; - } - case SPELL_SUMMON_GREATER_DEMON: mon = summon_any_demon(DEMON_GREATER); break; @@ -2081,14 +2103,6 @@ bool summon_general_creature(int pow, bool quiet, monster_type mon, switch (mon) { - case MONS_UGLY_THING: - msg = "An ugly thing appears."; - break; - - case MONS_VERY_UGLY_THING: - msg = "A very ugly thing appears."; - break; - case MONS_WRAITH: case MONS_FREEZING_WRAITH: case MONS_SPECTRAL_WARRIOR: |