diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 04:54:57 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-07 04:54:57 +0000 |
commit | 4406258079282fb38da52df875ccd76ee70941bd (patch) | |
tree | 37d7c5a953e8013e4f7d81b9fd4a4585e34122ec /crawl-ref/source | |
parent | 2eca4d6c7a1f9490725d206f0ae53506f08ec20b (diff) | |
download | crawl-ref-4406258079282fb38da52df875ccd76ee70941bd.tar.gz crawl-ref-4406258079282fb38da52df875ccd76ee70941bd.zip |
Consolidate "Summon Dragon" into summon_general_creature() as well.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5523 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/abl-show.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 39 | ||||
-rw-r--r-- | crawl-ref/source/spells2.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/spells4.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/spells4.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 19 |
6 files changed, 46 insertions, 53 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 74ac0d49a8..244ad339b8 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1277,13 +1277,13 @@ static bool _do_ability(const ability_def& abil) // DEMONIC POWERS: case ABIL_SUMMON_MINOR_DEMON: - summon_general_creature(you.experience_level * 4, + summon_general_creature(you.experience_level * 4, false, summon_any_demon(DEMON_LESSER), BEH_FRIENDLY); break; case ABIL_SUMMON_DEMONS: - summon_general_creature(you.experience_level * 4, + summon_general_creature(you.experience_level * 4, false, summon_any_demon(DEMON_COMMON), BEH_FRIENDLY); break; @@ -1438,7 +1438,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_TSO_SUMMON_DAEVA: - summon_general_creature(you.skills[SK_INVOCATIONS] * 4, + summon_general_creature(you.skills[SK_INVOCATIONS] * 4, false, MONS_DAEVA, BEH_FRIENDLY, true); exercise(SK_INVOCATIONS, 8 + random2(10)); break; @@ -1461,7 +1461,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_KIKU_INVOKE_DEATH: - summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, + summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false, MONS_REAPER, BEH_FRIENDLY, true); exercise(SK_INVOCATIONS, 10 + random2(14)); break; @@ -1542,7 +1542,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB: - summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, + summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false, static_cast<monster_type>( MONS_NEQOXEC + random2(5)), BEH_FRIENDLY, true); @@ -1603,7 +1603,7 @@ static bool _do_ability(const ability_def& abil) break; case ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB: - summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, + summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3, false, static_cast<monster_type>( MONS_EXECUTIONER + random2(5)), BEH_FRIENDLY, true); diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 6c83a684ec..8da2a64d40 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1531,8 +1531,9 @@ void summon_scorpions(int pow) } } // end summon_scorpions() -bool summon_general_creature(int pow, monster_type mon, beh_type beha, - int unfriendly, int numsc, bool god_gift) +bool summon_general_creature(int pow, bool quiet, monster_type mon, + beh_type beha, int unfriendly, + int numsc, bool god_gift) { if (beha == BEH_FRIENDLY && random2(pow) > unfriendly) beha = BEH_HOSTILE; @@ -1541,6 +1542,7 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, numsc = std::min(2 + (random2(pow) / 4), 6); unsigned short hitting = (beha == BEH_FRIENDLY) ? you.pet_target : MHITYOU; + bool success = false; std::string msg = ""; @@ -1548,6 +1550,7 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, switch (mon) { case MONS_BUTTERFLY: + msg = "A butterfly appears."; break; case MONS_IMP: @@ -1566,6 +1569,18 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, msg = "A chill wind blows around you."; break; + case MONS_UGLY_THING: + msg = "An ugly thing appears."; + break; + + case MONS_VERY_UGLY_THING: + msg = "A very ugly thing appears."; + break; + + case MONS_DRAGON: + msg = "A dragon appears."; + break; + case MONS_ANGEL: msg = "You open a gate to Zin's realm!"; break; @@ -1574,20 +1589,16 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, msg = "You are momentarily dazzled by a brilliant golden light."; break; - case MONS_UGLY_THING: - case MONS_VERY_UGLY_THING: default: { - msg = (mon == MONS_VERY_UGLY_THING) ? "A very ugly thing appears." : - (mon == MONS_UGLY_THING) ? "An ugly thing appears." - : "A demon appears!"; - - if (beha == BEH_HOSTILE) - msg += " It doesn't look very happy."; + msg = "A demon appears!"; break; } } + if (beha == BEH_HOSTILE) + msg += " It doesn't look very happy."; + int monster = create_monster( mgen_data(mon, beha, numsc, @@ -1596,17 +1607,17 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha, if (monster != -1) { - success = true; - - if (msg != "") + if (!quiet) mprf("%s", msg.c_str()); + success = true; + monsters *summon = &menv[monster]; if (mon == MONS_DAEVA) summon->flags |= MF_ATT_CHANGE_ATTEMPT; } - else + else if (!quiet) canned_msg(MSG_NOTHING_HAPPENS); return (success); diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index a64039277e..ef6d4534ef 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -132,9 +132,9 @@ 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 unfriendly = -1, int numsc = -1, - bool god_gift = false); +bool summon_general_creature(int pow, bool quiet, monster_type mon, + beh_type beha, int unfriendly = -1, + int numsc = -1, bool god_gift = false); // last updated 24may2000 {dlb} diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 89cbed5d39..6553e65e4b 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -570,28 +570,6 @@ void cast_sticks_to_snakes(int pow) } // end cast_sticks_to_snakes() -void cast_summon_dragon(int pow) -{ - // Removed the chance of multiple dragons... one should be more - // than enough, and if it isn't, the player can cast again... - // especially since these aren't on the Abjuration plan... they'll - // last until they die (maybe that should be changed, but this is - // a very high level spell so it might be okay). -- bwr - const bool friendly = (random2(pow) > 5); - - if (create_monster( - mgen_data( MONS_DRAGON, - friendly ? BEH_FRIENDLY : BEH_HOSTILE, 3, - you.pos(), - friendly ? you.pet_target : MHITYOU )) != -1) - { - mprf("A dragon appears.%s", - friendly ? "" : " It doesn't look very happy."); - } - else - canned_msg( MSG_NOTHING_HAPPENS ); -} // end cast_summon_dragon() - void cast_conjure_ball_lightning( int pow ) { int num = 3 + random2( 2 + pow / 50 ); diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h index 23809b3cda..a4bb6cfe45 100644 --- a/crawl-ref/source/spells4.h +++ b/crawl-ref/source/spells4.h @@ -48,7 +48,6 @@ void cast_see_invisible(int pow); void cast_shatter(int pow); void cast_silence(int pow); void cast_sticks_to_snakes(int pow); -void cast_summon_dragon(int pow); void cast_chain_lightning( int pow ); void cast_conjure_ball_lightning(int pow); void cast_summon_large_mammal(int pow); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index aabb253d6e..265bc141a5 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1497,15 +1497,20 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) case SPELL_SUMMON_GUARDIAN: case SPELL_SUMMON_DAEVA: { + bool quiet = (spell == SPELL_SUMMON_BUTTERFLIES); + monster_type mon = MONS_PROGRAM_BUG; int unfriendly = (spell == SPELL_SUMMON_DEMON || spell == SPELL_DEMONIC_HORDE - || spell == SPELL_SUMMON_UGLY_THING) ? 3 + || spell == SPELL_SUMMON_UGLY_THING) ? 3 : + (spell == SPELL_SUMMON_DRAGON) ? 5 : -1; + int numsc = (spell == SPELL_SUMMON_BUTTERFLIES) ? 3 - : std::min(2 + (random2(powc) / 4), 6); + : -1; + int how_many = (spell == SPELL_SUMMON_BUTTERFLIES) ? std::max(15, 4 + random2(3) + random2(powc) / 10) : (spell == SPELL_DEMONIC_HORDE) ? 7 + random2(5) @@ -1546,6 +1551,10 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; } + case SPELL_SUMMON_DRAGON: + mon = MONS_DRAGON; + break; + case SPELL_SUMMON_GUARDIAN: mon = MONS_ANGEL; break; @@ -1558,7 +1567,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; } - summon_general_creature(powc, mon, BEH_FRIENDLY, unfriendly, + summon_general_creature(powc, quiet, mon, BEH_FRIENDLY, unfriendly, numsc, false); } break; @@ -1909,10 +1918,6 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) cast_summon_large_mammal(powc); break; - case SPELL_SUMMON_DRAGON: - cast_summon_dragon(powc); - break; - case SPELL_TAME_BEASTS: cast_tame_beasts(powc); break; |