diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 04:36:32 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 04:36:32 +0000 |
commit | 2eca4d6c7a1f9490725d206f0ae53506f08ec20b (patch) | |
tree | aad233a77f04e1e40cd62f8dc8143d8b5398d84e /crawl-ref/source | |
parent | 8f9adf5d26be96c03eca477ef2a5e3fe20827ef2 (diff) | |
download | crawl-ref-2eca4d6c7a1f9490725d206f0ae53506f08ec20b.tar.gz crawl-ref-2eca4d6c7a1f9490725d206f0ae53506f08ec20b.zip |
Clean up summon_general_creature() some more.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5522 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/spells2.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/spells2.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 18 |
3 files changed, 24 insertions, 16 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 71cc2f3e80..6c83a684ec 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1532,8 +1532,14 @@ void summon_scorpions(int pow) } // end summon_scorpions() bool summon_general_creature(int pow, monster_type mon, beh_type beha, - int numsc, bool god_gift) + int unfriendly, int numsc, bool god_gift) { + if (beha == BEH_FRIENDLY && random2(pow) > unfriendly) + beha = BEH_HOSTILE; + + if (numsc == -1) + numsc = std::min(2 + (random2(pow) / 4), 6); + unsigned short hitting = (beha == BEH_FRIENDLY) ? you.pet_target : MHITYOU; bool success = false; @@ -1576,15 +1582,8 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, (mon == MONS_UGLY_THING) ? "An ugly thing appears." : "A demon appears!"; - bool friendly = (random2(pow) > 3); - - if (!friendly) - { + if (beha == BEH_HOSTILE) msg += " It doesn't look very happy."; - - beha = BEH_HOSTILE; - hitting = MHITYOU; - } break; } } @@ -1607,6 +1606,8 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, if (mon == MONS_DAEVA) summon->flags |= MF_ATT_CHANGE_ATTEMPT; } + else + canned_msg(MSG_NOTHING_HAPPENS); return (success); } diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index bdfacc04be..a64039277e 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -133,7 +133,8 @@ bool restore_stat(unsigned char which_stat, unsigned char stat_gain, * called from: ability - spell * *********************************************************************** */ bool summon_general_creature(int pow, monster_type mon, beh_type beha, - int numsc = -1, bool god_gift = false); + int unfriendly = -1, int numsc = -1, + 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 e444d5c53d..aabb253d6e 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1498,13 +1498,18 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) case SPELL_SUMMON_DAEVA: { monster_type mon = MONS_PROGRAM_BUG; + + int unfriendly = + (spell == SPELL_SUMMON_DEMON || spell == SPELL_DEMONIC_HORDE + || spell == SPELL_SUMMON_UGLY_THING) ? 3 + : -1; int numsc = - (spell == SPELL_SUMMON_BUTTERFLIES) ? 3 - : std::min(2 + (random2(powc) / 4), 6); + (spell == SPELL_SUMMON_BUTTERFLIES) ? 3 + : std::min(2 + (random2(powc) / 4), 6); int how_many = - (spell == SPELL_SUMMON_BUTTERFLIES) ? std::max(15, 4 + random2(3) + random2(powc) / 10) : - (spell == SPELL_DEMONIC_HORDE) ? 7 + random2(5) - : 1; + (spell == SPELL_SUMMON_BUTTERFLIES) ? std::max(15, 4 + random2(3) + random2(powc) / 10) : + (spell == SPELL_DEMONIC_HORDE) ? 7 + random2(5) + : 1; for (int i = 0; i < how_many; ++i) { @@ -1553,7 +1558,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; } - summon_general_creature(powc, mon, BEH_FRIENDLY, numsc, false); + summon_general_creature(powc, mon, BEH_FRIENDLY, unfriendly, + numsc, false); } break; } |