summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 04:14:40 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 04:14:40 +0000
commit8f9adf5d26be96c03eca477ef2a5e3fe20827ef2 (patch)
treedc48a634387eb07b789858f2df48dda1579af2c3 /crawl-ref/source
parent35180d844ba8e0177c6d214358453e8e81c07082 (diff)
downloadcrawl-ref-8f9adf5d26be96c03eca477ef2a5e3fe20827ef2.tar.gz
crawl-ref-8f9adf5d26be96c03eca477ef2a5e3fe20827ef2.zip
Consolidate "Summon Butterflies" into summon_general_creature().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5521 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc4
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/spells2.cc45
-rw-r--r--crawl-ref/source/spells2.h2
-rw-r--r--crawl-ref/source/spells4.cc15
-rw-r--r--crawl-ref/source/spells4.h1
-rw-r--r--crawl-ref/source/spl-cast.cc44
7 files changed, 54 insertions, 59 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index aa433cb15e..74ac0d49a8 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1279,13 +1279,13 @@ static bool _do_ability(const ability_def& abil)
case ABIL_SUMMON_MINOR_DEMON:
summon_general_creature(you.experience_level * 4,
summon_any_demon(DEMON_LESSER),
- BEH_FRIENDLY, false);
+ BEH_FRIENDLY);
break;
case ABIL_SUMMON_DEMONS:
summon_general_creature(you.experience_level * 4,
summon_any_demon(DEMON_COMMON),
- BEH_FRIENDLY, false);
+ BEH_FRIENDLY);
break;
case ABIL_HELLFIRE:
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 046893fa3d..dce6b0d93b 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -789,7 +789,7 @@ void random_uselessness(int scroll_slot)
case 6:
mpr("You hear the tinkle of a tiny bell.", MSGCH_SOUND);
- cast_summon_butterflies( 100 );
+ your_spells(SPELL_SUMMON_BUTTERFLIES, 100, false);
break;
case 7:
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index a5c9679dac..71cc2f3e80 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1532,52 +1532,56 @@ void summon_scorpions(int pow)
} // end summon_scorpions()
bool summon_general_creature(int pow, monster_type mon, beh_type beha,
- bool god_gift)
+ int numsc, bool god_gift)
{
- int numsc = std::min(2 + (random2(pow) / 4), 6);
unsigned short hitting = (beha == BEH_FRIENDLY) ? you.pet_target : MHITYOU;
bool success = false;
+ std::string msg = "";
+
switch (mon)
{
+ case MONS_BUTTERFLY:
+ break;
+
case MONS_IMP:
+ msg = "A beastly little devil appears in a puff of flame.";
+ break;
+
case MONS_WHITE_IMP:
- case MONS_SHADOW_IMP:
- {
- const char *where = (mon == MONS_SHADOW_IMP) ? "the shadows" :
- (mon == MONS_WHITE_IMP) ? "a puff of frigid air"
- : "a puff of flame";
+ msg = "A beastly little devil appears in a puff of frigid air.";
+ break;
- mprf("A beastly little devil appears in %s.", where);
+ case MONS_SHADOW_IMP:
+ msg = "A shadowy apparition takes form in the air.";
break;
- }
case MONS_ICE_BEAST:
- mpr("A chill wind blows around you.");
+ msg = "A chill wind blows around you.";
break;
case MONS_ANGEL:
- mpr("You open a gate to Zin's realm!");
+ msg = "You open a gate to Zin's realm!";
break;
case MONS_DAEVA:
- mpr("You are momentarily dazzled by a brilliant golden light.");
+ msg = "You are momentarily dazzled by a brilliant golden light.";
break;
case MONS_UGLY_THING:
case MONS_VERY_UGLY_THING:
default:
{
- bool friendly = (random2(pow) > 3);
- const char *what = (mon == MONS_VERY_UGLY_THING) ? " very ugly thing" :
- (mon == MONS_UGLY_THING) ? "n ugly thing"
- : " demon";
+ msg = (mon == MONS_VERY_UGLY_THING) ? "A very ugly thing appears." :
+ (mon == MONS_UGLY_THING) ? "An ugly thing appears."
+ : "A demon appears!";
- mprf("A%s appears.%s", what,
- friendly ? "" : " It doesn't look very happy.");
+ bool friendly = (random2(pow) > 3);
if (!friendly)
{
+ msg += " It doesn't look very happy.";
+
beha = BEH_HOSTILE;
hitting = MHITYOU;
}
@@ -1595,6 +1599,9 @@ bool summon_general_creature(int pow, monster_type mon, beh_type beha,
{
success = true;
+ if (msg != "")
+ mprf("%s", msg.c_str());
+
monsters *summon = &menv[monster];
if (mon == MONS_DAEVA)
@@ -1685,7 +1692,7 @@ bool summon_berserker(int pow, beh_type beha, bool god_gift)
}
return (success);
-} // end summon_berserker()
+}
bool summon_swarm(int pow, beh_type beha, bool god_gift)
{
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index a7f84b819a..bdfacc04be 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -133,7 +133,7 @@ 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,
- bool god_gift);
+ 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 5d3962aed9..89cbed5d39 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -414,21 +414,6 @@ void cast_detect_secret_doors(int pow)
mprf("You detect %s", (found > 0) ? "secret doors!" : "nothing.");
} // end cast_detect_secret_doors()
-void cast_summon_butterflies(int pow)
-{
- // explicitly limiting the number
- int num = 4 + random2(3) + random2( pow ) / 10;
- if (num > 16)
- num = 16;
-
- for (int scount = 1; scount < num; scount++)
- {
- create_monster(
- mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY, 3,
- you.pos(), you.pet_target));
- }
-}
-
void cast_summon_large_mammal(int pow)
{
monster_type mon;
diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h
index 3675cb8566..23809b3cda 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_butterflies(int pow);
void cast_summon_dragon(int pow);
void cast_chain_lightning( int pow );
void cast_conjure_ball_lightning(int pow);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 74ed682f28..e444d5c53d 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1488,22 +1488,32 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
// Remember that most holy spells don't yet use powc!
+ case SPELL_SUMMON_BUTTERFLIES:
case SPELL_CALL_IMP:
case SPELL_SUMMON_DEMON:
case SPELL_DEMONIC_HORDE:
case SPELL_SUMMON_ICE_BEAST:
+ case SPELL_SUMMON_UGLY_THING:
case SPELL_SUMMON_GUARDIAN:
case SPELL_SUMMON_DAEVA:
- case SPELL_SUMMON_UGLY_THING:
{
monster_type mon = MONS_PROGRAM_BUG;
- int how_many = (spell == SPELL_DEMONIC_HORDE) ? 7 + random2(5)
- : 1;
+ int numsc =
+ (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;
for (int i = 0; i < how_many; ++i)
{
switch (spell)
{
+ case SPELL_SUMMON_BUTTERFLIES:
+ mon = MONS_BUTTERFLY;
+ break;
+
case SPELL_CALL_IMP:
mon = (one_chance_in(3)) ? MONS_WHITE_IMP :
(one_chance_in(7)) ? MONS_SHADOW_IMP
@@ -1515,24 +1525,14 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
if (i == 0)
mpr("You open a gate to Pandemonium!");
mon = summon_any_demon(
- (spell == SPELL_DEMONIC_HORDE) ? DEMON_LESSER
- : DEMON_COMMON);
+ (spell == SPELL_DEMONIC_HORDE) ? DEMON_LESSER
+ : DEMON_COMMON);
break;
case SPELL_SUMMON_ICE_BEAST:
mon = MONS_ICE_BEAST;
break;
- case SPELL_SUMMON_GUARDIAN:
- mon = MONS_ANGEL;
- break;
-
- case SPELL_SUMMON_DAEVA:
- mon = MONS_DAEVA;
- break;
-
- // Starting here, there's a chance of monsters' being
- // unfriendly.
case SPELL_SUMMON_UGLY_THING:
{
const int chance = std::max(6 - (powc / 12), 1);
@@ -1541,11 +1541,19 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
}
+ case SPELL_SUMMON_GUARDIAN:
+ mon = MONS_ANGEL;
+ break;
+
+ case SPELL_SUMMON_DAEVA:
+ mon = MONS_DAEVA;
+ break;
+
default:
break;
}
- summon_general_creature(powc, mon, BEH_FRIENDLY, false);
+ summon_general_creature(powc, mon, BEH_FRIENDLY, numsc, false);
}
break;
}
@@ -1936,10 +1944,6 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
cast_forescry(powc);
break;
- case SPELL_SUMMON_BUTTERFLIES:
- cast_summon_butterflies(powc);
- break;
-
case SPELL_EXCRUCIATING_WOUNDS:
if (!brand_weapon(SPWPN_PAIN, powc))
canned_msg(MSG_SPELL_FIZZLES);