summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abl-show.cc39
-rw-r--r--crawl-ref/source/mstuff2.cc3
-rw-r--r--crawl-ref/source/spells2.cc45
-rw-r--r--crawl-ref/source/spells2.h6
-rw-r--r--crawl-ref/source/spl-cast.cc75
5 files changed, 86 insertions, 82 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index e3a7b576fb..aa433cb15e 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1277,15 +1277,15 @@ static bool _do_ability(const ability_def& abil)
// DEMONIC POWERS:
case ABIL_SUMMON_MINOR_DEMON:
- summon_ice_beast_etc(you.experience_level * 4,
- summon_any_demon(DEMON_LESSER),
- BEH_FRIENDLY, false);
+ summon_general_creature(you.experience_level * 4,
+ summon_any_demon(DEMON_LESSER),
+ BEH_FRIENDLY, false);
break;
case ABIL_SUMMON_DEMONS:
- summon_ice_beast_etc(you.experience_level * 4,
- summon_any_demon(DEMON_COMMON),
- BEH_FRIENDLY, false);
+ summon_general_creature(you.experience_level * 4,
+ summon_any_demon(DEMON_COMMON),
+ BEH_FRIENDLY, false);
break;
case ABIL_HELLFIRE:
@@ -1438,8 +1438,8 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_TSO_SUMMON_DAEVA:
- summon_ice_beast_etc(you.skills[SK_INVOCATIONS] * 4, MONS_DAEVA,
- BEH_FRIENDLY, true);
+ summon_general_creature(you.skills[SK_INVOCATIONS] * 4,
+ MONS_DAEVA, BEH_FRIENDLY, true);
exercise(SK_INVOCATIONS, 8 + random2(10));
break;
@@ -1461,9 +1461,8 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_KIKU_INVOKE_DEATH:
- summon_ice_beast_etc(
- 20 + you.skills[SK_INVOCATIONS] * 3, MONS_REAPER,
- BEH_FRIENDLY, true);
+ summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3,
+ MONS_REAPER, BEH_FRIENDLY, true);
exercise(SK_INVOCATIONS, 10 + random2(14));
break;
@@ -1543,11 +1542,10 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB:
- summon_ice_beast_etc(20 + you.skills[SK_INVOCATIONS] * 3,
- static_cast<monster_type>(
- MONS_NEQOXEC + random2(5)),
- BEH_FRIENDLY, true);
-
+ summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3,
+ static_cast<monster_type>(
+ MONS_NEQOXEC + random2(5)),
+ BEH_FRIENDLY, true);
exercise(SK_INVOCATIONS, 2 + random2(3));
break;
@@ -1605,11 +1603,10 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_MAKHLEB_GREATER_SERVANT_OF_MAKHLEB:
- summon_ice_beast_etc(20 + you.skills[SK_INVOCATIONS] * 3,
- static_cast<monster_type>(
- MONS_EXECUTIONER + random2(5)),
- BEH_FRIENDLY, true);
-
+ summon_general_creature(20 + you.skills[SK_INVOCATIONS] * 3,
+ static_cast<monster_type>(
+ MONS_EXECUTIONER + random2(5)),
+ BEH_FRIENDLY, true);
exercise(SK_INVOCATIONS, 6 + random2(6));
break;
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index ccafa312d9..0e655bb470 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -622,8 +622,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
mons = summon_any_demon(DEMON_COMMON);
else
{
- int chance = std::max(6 - (monster->hit_dice / 6), 1);
-
+ const int chance = std::max(6 - (monster->hit_dice / 6), 1);
mons = (one_chance_in(chance) ? MONS_VERY_UGLY_THING
: MONS_UGLY_THING);
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 76e45f6c4c..1fe62dd439 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1531,32 +1531,8 @@ void summon_scorpions(int pow)
}
} // end summon_scorpions()
-void summon_ugly_thing(int pow)
-{
- int chance = std::max(6 - (pow / 12), 1);
-
- monster_type ugly = (one_chance_in(chance)) ?
- MONS_VERY_UGLY_THING : MONS_UGLY_THING;
-
- int numsc = std::min(2 + (random2(pow) / 4), 6);
-
- bool friendly = (random2(pow) > 3);
-
- if (create_monster(
- mgen_data(ugly,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- numsc, you.pos(),
- friendly ? you.pet_target : MHITYOU)) != -1)
- {
- const char *prefix = (ugly == MONS_VERY_UGLY_THING) ? " very" : "n";
-
- mprf("A%s ugly thing appears.%s", prefix,
- friendly ? "" : " It doesn't look very happy.");
- }
-} // end summon_ugly_thing()
-
-bool summon_ice_beast_etc(int pow, monster_type mon, beh_type beha,
- bool god_gift)
+bool summon_general_creature(int pow, monster_type mon, beh_type beha,
+ bool god_gift)
{
int numsc = std::min(2 + (random2(pow) / 4), 6);
unsigned short hitting = (beha == BEH_FRIENDLY) ? you.pet_target : MHITYOU;
@@ -1580,6 +1556,23 @@ bool summon_ice_beast_etc(int pow, monster_type mon, beh_type beha,
mpr("A shadowy apparition takes form in the air.");
break;
+ case MONS_UGLY_THING:
+ case MONS_VERY_UGLY_THING:
+ {
+ bool friendly = (random2(pow) > 3);
+ const char *prefix = (mon == MONS_VERY_UGLY_THING) ? " very" : "n";
+
+ mprf("A%s ugly thing appears.%s", prefix,
+ friendly ? "" : " It doesn't look very happy.");
+
+ if (!friendly)
+ {
+ beha = BEH_HOSTILE;
+ hitting = MHITYOU;
+ }
+ break;
+ }
+
case MONS_ANGEL:
mpr("You open a gate to Zin's realm!");
break;
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 8b5e3f5c5c..a7f84b819a 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -132,8 +132,8 @@ bool restore_stat(unsigned char which_stat, unsigned char stat_gain,
/* ***********************************************************************
* called from: ability - spell
* *********************************************************************** */
-bool summon_ice_beast_etc(int pow, monster_type mon, beh_type beha,
- bool god_gift);
+bool summon_general_creature(int pow, monster_type mon, beh_type beha,
+ bool god_gift);
// last updated 24may2000 {dlb}
@@ -142,8 +142,6 @@ bool summon_ice_beast_etc(int pow, monster_type mon, beh_type beha,
* *********************************************************************** */
void summon_scorpions(int pow);
-void summon_ugly_thing(int pow);
-
void summon_animals(int pow);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 8fb9bf1e97..9bd94d7473 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1487,24 +1487,55 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
return (SPRET_ABORT);
break;
+ // Remember that most holy spells don't yet use powc!
+ case SPELL_CALL_IMP:
case SPELL_SUMMON_ICE_BEAST:
- summon_ice_beast_etc(powc, MONS_ICE_BEAST, BEH_FRIENDLY, false);
- break;
+ case SPELL_SUMMON_UGLY_THING:
+ case SPELL_SUMMON_GUARDIAN:
+ case SPELL_SUMMON_DAEVA:
+ {
+ monster_type mon = MONS_PROGRAM_BUG;
- case SPELL_OZOCUBUS_ARMOUR:
- ice_armour(powc, false);
- break;
+ switch (spell)
+ {
+ case SPELL_CALL_IMP:
+ mon = (one_chance_in(3)) ? MONS_WHITE_IMP :
+ (one_chance_in(7)) ? MONS_SHADOW_IMP
+ : MONS_IMP;
+ break;
- case SPELL_CALL_IMP:
- {
- monster_type mon = (one_chance_in(3)) ? MONS_WHITE_IMP :
- (one_chance_in(7)) ? MONS_SHADOW_IMP
- : MONS_IMP;
+ case SPELL_SUMMON_ICE_BEAST:
+ mon = MONS_ICE_BEAST;
+ break;
+
+ case SPELL_SUMMON_UGLY_THING:
+ {
+ const int chance = std::max(6 - (powc / 12), 1);
+ mon = (one_chance_in(chance)) ? MONS_VERY_UGLY_THING
+ : MONS_UGLY_THING;
+ break;
+ }
+
+ case SPELL_SUMMON_GUARDIAN:
+ mon = MONS_ANGEL;
+ break;
- summon_ice_beast_etc(powc, mon, BEH_FRIENDLY, false);
+ case SPELL_SUMMON_DAEVA:
+ mon = MONS_DAEVA;
+ break;
+
+ default:
+ break;
+ }
+
+ summon_general_creature(powc, mon, BEH_FRIENDLY, false);
break;
}
+ case SPELL_OZOCUBUS_ARMOUR:
+ ice_armour(powc, false);
+ break;
+
case SPELL_REPEL_MISSILES:
missile_prot(powc);
break;
@@ -1518,10 +1549,6 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
return (SPRET_ABORT);
break;
- case SPELL_SUMMON_GUARDIAN:
- summon_ice_beast_etc(powc, MONS_ANGEL, BEH_FRIENDLY, false);
- break;
-
case SPELL_THUNDERBOLT:
if (!zapping(ZAP_LIGHTNING, powc, beam, true))
return (SPRET_ABORT);
@@ -1532,12 +1559,6 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
return (SPRET_ABORT);
break;
- case SPELL_SUMMON_DAEVA:
- summon_ice_beast_etc(powc, MONS_DAEVA, BEH_FRIENDLY, false);
- break;
-
- // Remember that most holy spells above don't yet use powc!
-
case SPELL_TWISTED_RESURRECTION:
cast_twisted(powc, BEH_FRIENDLY, you.pet_target);
break;
@@ -1589,8 +1610,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
case SPELL_SUMMON_DEMON:
mpr("You open a gate to Pandemonium!");
- summon_ice_beast_etc(powc, summon_any_demon(DEMON_COMMON),
- BEH_FRIENDLY, false);
+ summon_general_creature(powc, summon_any_demon(DEMON_COMMON),
+ BEH_FRIENDLY, false);
break;
case SPELL_DEMONIC_HORDE:
@@ -1599,8 +1620,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
const int num = 7 + random2(5);
for (int i = 0; i < num; ++i)
{
- summon_ice_beast_etc(powc, summon_any_demon(DEMON_LESSER),
- BEH_FRIENDLY, false);
+ summon_general_creature(powc, summon_any_demon(DEMON_LESSER),
+ BEH_FRIENDLY, false);
}
}
break;
@@ -1843,10 +1864,6 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
return (SPRET_ABORT);
break;
- case SPELL_SUMMON_UGLY_THING:
- summon_ugly_thing(powc);
- break;
-
case SPELL_SHADOW_CREATURES:
{
mpr( "Wisps of shadow whirl around you..." );