summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 06:37:43 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 06:37:43 +0000
commita59ecb47aaf7a31776f383446c9b5f2788f42d98 (patch)
tree11dbb488dfc35980c1bccf9314c8ec65b69e1965 /crawl-ref
parent55e422bf9dcda3c8515848e84e079da6dc9a9ad9 (diff)
downloadcrawl-ref-a59ecb47aaf7a31776f383446c9b5f2788f42d98.tar.gz
crawl-ref-a59ecb47aaf7a31776f383446c9b5f2788f42d98.zip
Expand the setting of spell_type in mgen_data to include all
monster-creating spells, and avoid assertion failures caused by setting an abjuration duration of 0 and a spell_type to something other than 0. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8162 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/decks.cc15
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/it_use3.cc6
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/mon-util.h4
-rw-r--r--crawl-ref/source/monplace.h25
-rw-r--r--crawl-ref/source/monstuff.cc4
-rw-r--r--crawl-ref/source/mstuff2.cc46
-rw-r--r--crawl-ref/source/religion.cc8
-rw-r--r--crawl-ref/source/spells2.cc69
-rw-r--r--crawl-ref/source/spells2.h6
-rw-r--r--crawl-ref/source/spells3.cc63
-rw-r--r--crawl-ref/source/spells3.h9
-rw-r--r--crawl-ref/source/spl-cast.cc23
15 files changed, 147 insertions, 137 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index d2232990d4..b427f6eee2 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2498,7 +2498,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
if (create_monster(
mgen_data(RANDOM_ELEMENT(golems),
- BEH_FRIENDLY, 5,
+ BEH_FRIENDLY, 5, 0,
you.pos(), you.pet_target)) != -1)
{
mpr("You construct a golem!");
@@ -2684,7 +2684,7 @@ static void _summon_demon_card(int power, deck_rarity_type rarity)
create_monster(
mgen_data(summon_any_demon(dct), BEH_FRIENDLY,
- std::min(power / 50, 6),
+ std::min(power / 50, 6), 0,
you.pos(), you.pet_target));
}
@@ -2737,7 +2737,8 @@ static void _summon_any_monster(int power, deck_rarity_type rarity)
create_monster(
mgen_data(mon_chosen,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 3, chosen_spot,
+ 3, 0,
+ chosen_spot,
friendly ? you.pet_target : MHITYOU));
}
@@ -2750,7 +2751,7 @@ static void _summon_dancing_weapon(int power, deck_rarity_type rarity)
create_monster(
mgen_data(MONS_DANCING_WEAPON,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- power_level + 3, you.pos(),
+ power_level + 3, 0, you.pos(),
friendly ? you.pet_target : MHITYOU));
// Given the abundance of Nemelex decks, not setting hard reset
@@ -2813,9 +2814,7 @@ static void _summon_flying(int power, deck_rarity_type rarity)
// Be nice and don't summon friendly invisibles.
monster_type result = MONS_PROGRAM_BUG;
do
- {
result = flytypes[random2(4) + power_level];
- }
while (friendly && mons_class_flag(result, M_INVIS)
&& !player_see_invis());
@@ -2842,7 +2841,7 @@ static void _summon_skeleton(int power, deck_rarity_type rarity)
mgen_data(
skeltypes[power_level],
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- std::min(power / 50, 6),
+ std::min(power / 50, 6), 0,
you.pos(),
friendly ? you.pet_target : MHITYOU));
}
@@ -2862,7 +2861,7 @@ static void _summon_ugly(int power, deck_rarity_type rarity)
create_monster(
mgen_data(ugly,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- std::min(power / 50, 6),
+ std::min(power / 50, 6), 0,
you.pos(),
friendly ? you.pet_target : MHITYOU));
}
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 4c507001df..73a890d50e 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3303,7 +3303,7 @@ static int _place_uniques(int level_number, char level_type)
if (which_unique == MONS_PROGRAM_BUG)
break;
- mgen_data mg(which_unique, BEH_SLEEP, 0,
+ mgen_data mg(which_unique, BEH_SLEEP, 0, 0,
coord_def(), MHITNOT, MG_PERMIT_BANDS,
GOD_NO_GOD, MONS_PROGRAM_BUG, 0, BLACK,
level_number, PROX_ANYWHERE);
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index fb71076fe5..ad847f5688 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2574,7 +2574,7 @@ static bool _make_zombie(monsters* mon, int corpse_class, int corpse_index,
monster_type type = (mons_zombie_size(mon->type) == Z_SMALL) ?
MONS_ZOMBIE_SMALL : MONS_ZOMBIE_LARGE;
zombie_index = create_monster(
- mgen_data(type, mon->behaviour, 0, mon->pos(),
+ mgen_data(type, mon->behaviour, 0, 0, mon->pos(),
mon->foe, MG_FORCE_PLACE, mon->god,
(monster_type) mon->type, mon->number));
}
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 1c19650a76..8e835e0eca 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -226,7 +226,7 @@ void special_wielded()
{
create_monster(
mgen_data(MONS_SHADOW, BEH_FRIENDLY,
- 2, you.pos(), you.pet_target));
+ 2, 0, you.pos(), you.pet_target));
did_god_conduct(DID_NECROMANCY, 1);
}
break;
@@ -715,7 +715,7 @@ static bool efreet_flask(void)
create_monster(
mgen_data(MONS_EFREET,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 0, you.pos(),
+ 0, 0, you.pos(),
friendly ? you.pet_target : MHITYOU,
MG_FORCE_BEH));
@@ -1008,7 +1008,7 @@ static bool box_of_beasts()
}
if (create_monster(
- mgen_data(beasty, beha, 2 + random2(4),
+ mgen_data(beasty, beha, 2 + random2(4), 0,
you.pos(), hitting)) != -1)
{
success = true;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 6ced87ca08..c68b9d761f 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4467,7 +4467,7 @@ void read_scroll(int slot)
case SCR_SUMMONING:
if (create_monster(
mgen_data(MONS_ABOMINATION_SMALL, BEH_FRIENDLY,
- 0, you.pos(), you.pet_target)) != -1)
+ 0, 0, you.pos(), you.pet_target)) != -1)
{
mpr("A horrible Thing appears!");
}
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index fad483a5be..7ce3388565 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -85,8 +85,8 @@ enum mon_attack_flavour
AF_STEAL_FOOD
};
-// Non-spell "summoning" types to give to monsters::mark_summoned(), or as
-// the fourth parameter of mgen_data's second constructor.
+// Non-spell "summoning" types to give to monsters::mark_summoned(), or
+// as the fourth parameter of mgen_data's constructor.
//
// Negative values since spells are non-negative.
enum mon_summon_type
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 6e51f386aa..2ac22d950d 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -182,28 +182,7 @@ struct mgen_data
mgen_data(monster_type mt = RANDOM_MONSTER,
beh_type beh = BEH_HOSTILE,
int abj = 0,
- const coord_def &p = coord_def(-1, -1),
- unsigned short mfoe = MHITNOT,
- unsigned monflags = 0,
- god_type which_god = GOD_NO_GOD,
- monster_type base = MONS_PROGRAM_BUG,
- int monnumber = 0,
- int moncolour = BLACK,
- int monpower = you.your_level,
- proximity_type prox = PROX_ANYWHERE,
- level_area_type ltype = you.level_type)
-
- : cls(mt), base_type(base), behaviour(beh),
- abjuration_duration(abj), summon_type(0), pos(p), foe(mfoe),
- flags(monflags), god(which_god), number(monnumber), colour(moncolour),
- power(monpower), proximity(prox), level_type(ltype), map_mask(0)
- {
- }
-
- mgen_data(monster_type mt,
- beh_type beh,
- int abj,
- int st,
+ int st = 0,
const coord_def &p = coord_def(-1, -1),
unsigned short mfoe = MHITNOT,
unsigned monflags = 0,
@@ -237,7 +216,7 @@ struct mgen_data
const coord_def &where,
unsigned flags = 0)
{
- return mgen_data(what, BEH_SLEEP, 0, where, MHITNOT, flags);
+ return mgen_data(what, BEH_SLEEP, 0, 0, where, MHITNOT, flags);
}
static mgen_data hostile_at(monster_type what,
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 5aecdd1ca6..c3d5290a88 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1306,7 +1306,7 @@ void monster_die(monsters *monster, killer_type killer,
const int spectre =
create_monster(
mgen_data(MONS_SPECTRAL_THING, BEH_FRIENDLY,
- 0, monster->pos(), you.pet_target,
+ 0, 0, monster->pos(), you.pet_target,
0, static_cast<god_type>(you.attribute[ATTR_DIVINE_DEATH_CHANNEL]),
spectre_type, monster->number));
@@ -5628,7 +5628,7 @@ static bool _handle_scroll(monsters *monster)
simple_monster_message(monster, " reads a scroll.");
int mon = create_monster(
mgen_data(MONS_ABOMINATION_SMALL, SAME_ATTITUDE(monster),
- 0, monster->pos(), monster->foe));
+ 0, 0, monster->pos(), monster->foe));
read = true;
if (mon != -1 && you.can_see(&menv[mon]))
{
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index aa9cbc0a4a..387de794cc 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -91,8 +91,8 @@ static monster_type _pick_undead_summon()
}
static void _do_high_level_summon(monsters *monster, bool monsterNearby,
- monster_type (*mpicker)(),
- int nsummons)
+ spell_type spell_cast,
+ monster_type (*mpicker)(), int nsummons)
{
if (_mons_abjured(monster, monsterNearby))
return;
@@ -108,7 +108,7 @@ static void _do_high_level_summon(monsters *monster, bool monsterNearby,
create_monster(
mgen_data(which_mons, SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
}
@@ -212,7 +212,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(mon, SAME_ATTITUDE(monster),
- 5, monster->pos(), monster->foe));
+ 5, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -237,7 +237,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_RAKSHASA_FAKE, SAME_ATTITUDE(monster),
- 3, monster->pos(), monster->foe));
+ 3, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -252,7 +252,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(summon_any_demon(DEMON_COMMON),
- SAME_ATTITUDE(monster), duration,
+ SAME_ATTITUDE(monster), duration, spell_cast,
monster->pos(), monster->foe));
}
return;
@@ -272,7 +272,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(mon, SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -291,7 +291,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(summon_any_demon(DEMON_LESSER),
SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -306,7 +306,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_SCORPION, SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -319,20 +319,20 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_UFETUBUS, SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
case SPELL_SUMMON_BEAST: // Geryon
create_monster(
mgen_data(MONS_BEAST, SAME_ATTITUDE(monster),
- 4, monster->pos(), monster->foe));
+ 4, spell_cast, monster->pos(), monster->foe));
return;
case SPELL_SUMMON_ICE_BEAST:
create_monster(
mgen_data(MONS_ICE_BEAST, SAME_ATTITUDE(monster),
- 5, monster->pos(), monster->foe));
+ 5, spell_cast, monster->pos(), monster->foe));
return;
case SPELL_SUMMON_MUSHROOMS: // Summon swarms of icky crawling fungi.
@@ -346,18 +346,18 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_WANDERING_MUSHROOM, SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
case SPELL_SUMMON_WRAITHS:
- _do_high_level_summon(monster, monsterNearby, _pick_random_wraith,
- random_range(3, 6));
+ _do_high_level_summon(monster, monsterNearby, spell_cast,
+ _pick_random_wraith, random_range(3, 6));
return;
case SPELL_SUMMON_HORRIBLE_THINGS:
- _do_high_level_summon(monster, monsterNearby, _pick_horrible_thing,
- random_range(3, 5));
+ _do_high_level_summon(monster, monsterNearby, spell_cast,
+ _pick_horrible_thing, random_range(3, 5));
return;
case SPELL_CONJURE_BALL_LIGHTNING:
@@ -367,13 +367,14 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_BALL_LIGHTNING, SAME_ATTITUDE(monster),
- 2, monster->pos(), monster->foe));
+ 2, spell_cast, monster->pos(), monster->foe));
}
return;
}
case SPELL_SUMMON_UNDEAD: // Summon undead around player.
- _do_high_level_summon(monster, monsterNearby, _pick_undead_summon,
+ _do_high_level_summon(monster, monsterNearby, spell_cast,
+ _pick_undead_summon,
2 + random2(2)
+ random2(monster->hit_dice / 4 + 1));
return;
@@ -397,7 +398,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(summon_any_demon(DEMON_GREATER),
SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe));
}
return;
@@ -431,7 +432,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(monsters[i], SAME_ATTITUDE(monster),
- duration, monster->pos(), monster->foe));
+ duration, spell_cast,
+ monster->pos(), monster->foe));
}
}
return;
@@ -2390,7 +2392,7 @@ bool silver_statue_effects(monsters *mons)
mgen_data(
summon_any_demon((coinflip() ? DEMON_COMMON
: DEMON_LESSER)),
- SAME_ATTITUDE(mons), 5, foe->pos(), mons->foe));
+ SAME_ATTITUDE(mons), 5, 0, foe->pos(), mons->foe));
return (true);
}
return (false);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 41015c8eda..4d90ee6874 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -939,7 +939,7 @@ static int _yred_random_servants(int threshold, bool force_hostile = false)
if (create_monster(
mgen_data(mon,
!force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- 0, you.pos(),
+ 0, 0, you.pos(),
!force_hostile ? you.pet_target : MHITYOU,
0, GOD_YREDELEMNUL)) != -1)
{
@@ -1532,7 +1532,7 @@ static bool _beogh_blessing_reinforcement()
int monster =
create_monster(
- mgen_data(follower_type, BEH_FRIENDLY, 0,
+ mgen_data(follower_type, BEH_FRIENDLY, 0, 0,
you.pos(), you.pet_target, 0, GOD_BEOGH));
if (monster != -1)
@@ -4029,7 +4029,7 @@ static bool _tso_retribution()
for (int i = 0; i < how_many; ++i)
{
- if (summon_holy_warrior(100, god, true, true, true))
+ if (summon_holy_warrior(100, god, 0, true, true, true))
success = true;
}
@@ -4415,7 +4415,7 @@ static bool _trog_retribution()
points -= cost;
- if (summon_berserker(cost * 20, god, true))
+ if (summon_berserker(cost * 20, god, 0, true))
count++;
}
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index e642ff08d7..217bb6164f 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -942,7 +942,7 @@ bool summon_animals(int pow)
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 4, you.pos(),
+ 4, 0, you.pos(),
friendly ? you.pet_target : MHITYOU)) != -1)
{
success = true;
@@ -961,7 +961,8 @@ bool cast_summon_butterflies(int pow, god_type god)
for (int i = 0; i < how_many; ++i)
{
if (create_monster(
- mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY, 3,
+ mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY,
+ 3, SPELL_SUMMON_BUTTERFLIES,
you.pos(), you.pet_target,
0, god)) != -1)
{
@@ -1020,7 +1021,8 @@ bool cast_summon_small_mammals(int pow, god_type god)
count++;
if (create_monster(
- mgen_data(mon, BEH_FRIENDLY, 3,
+ mgen_data(mon, BEH_FRIENDLY,
+ 3, SPELL_SUMMON_SMALL_MAMMALS,
you.pos(), you.pet_target,
0, god)) != -1)
{
@@ -1077,7 +1079,8 @@ bool cast_sticks_to_snakes(int pow, god_type god)
mon = MONS_SMALL_SNAKE;
if (create_monster(
- mgen_data(mon, beha, dur,
+ mgen_data(mon, beha,
+ dur, SPELL_STICKS_TO_SNAKES,
you.pos(), hitting,
0, god)) != -1)
{
@@ -1124,7 +1127,8 @@ bool cast_sticks_to_snakes(int pow, god_type god)
mon = MONS_GREY_SNAKE;
if (create_monster(
- mgen_data(mon, beha, dur,
+ mgen_data(mon, beha,
+ dur, SPELL_STICKS_TO_SNAKES,
you.pos(), hitting,
0, god)) != -1)
{
@@ -1164,7 +1168,8 @@ bool cast_summon_scorpions(int pow, god_type god)
if (create_monster(
mgen_data(MONS_SCORPION,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 3, you.pos(),
+ 3, SPELL_SUMMON_SCORPIONS,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
0, god)) != -1)
{
@@ -1248,7 +1253,8 @@ bool cast_summon_swarm(int pow, god_type god,
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, you.pos(),
+ dur, !permanent ? SPELL_SUMMON_SWARM : 0,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
0, god)) != -1)
{
@@ -1307,7 +1313,8 @@ bool cast_call_canine_familiar(int pow, god_type god)
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, you.pos(),
+ dur, SPELL_CALL_CANINE_FAMILIAR,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
0, god)) != -1)
{
@@ -1448,7 +1455,8 @@ bool cast_summon_elemental(int pow, god_type god,
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, targ,
+ dur, SPELL_SUMMON_ELEMENTAL,
+ targ,
friendly ? you.pet_target : MHITYOU,
0, god)) == -1)
{
@@ -1471,7 +1479,8 @@ bool cast_summon_ice_beast(int pow, god_type god)
const int dur = std::min(2 + (random2(pow) / 4), 6);
if (create_monster(
- mgen_data(mon, BEH_FRIENDLY, dur,
+ mgen_data(mon, BEH_FRIENDLY,
+ dur, SPELL_SUMMON_ICE_BEAST,
you.pos(), you.pet_target,
0, god)) != -1)
{
@@ -1496,7 +1505,8 @@ bool cast_summon_ugly_thing(int pow, god_type god)
if (create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, you.pos(),
+ dur, SPELL_SUMMON_UGLY_THING,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
0, god)) != -1)
{
@@ -1525,7 +1535,8 @@ bool cast_summon_dragon(int pow, god_type god)
if (create_monster(
mgen_data(MONS_DRAGON,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 3, you.pos(),
+ 3, SPELL_SUMMON_DRAGON,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
0, god)) != -1)
{
@@ -1541,7 +1552,8 @@ bool cast_summon_dragon(int pow, god_type god)
return (false);
}
-bool summon_berserker(int pow, god_type god, bool force_hostile)
+bool summon_berserker(int pow, god_type god, int spell,
+ bool force_hostile)
{
monster_type mon = MONS_PROGRAM_BUG;
@@ -1591,7 +1603,8 @@ bool summon_berserker(int pow, god_type god, bool force_hostile)
create_monster(
mgen_data(mon,
!force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, you.pos(),
+ dur, spell,
+ you.pos(),
!force_hostile ? you.pet_target : MHITYOU,
0, god));
@@ -1617,8 +1630,9 @@ bool summon_berserker(int pow, god_type god, bool force_hostile)
return (true);
}
-static bool _summon_holy_being_wrapper(int pow, god_type god, monster_type mon,
- int dur, bool friendly, bool quiet)
+static bool _summon_holy_being_wrapper(int pow, god_type god, int spell,
+ monster_type mon, int dur, bool friendly,
+ bool quiet)
{
UNUSED(pow);
@@ -1626,8 +1640,9 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, monster_type mon,
create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, friendly ? MON_SUMM_AID : MON_SUMM_WRATH,
- you.pos(), friendly ? you.pet_target : MHITYOU,
+ dur, spell,
+ you.pos(),
+ friendly ? you.pet_target : MHITYOU,
MG_FORCE_BEH, god));
if (monster == -1)
@@ -1649,29 +1664,31 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, monster_type mon,
return (true);
}
-static bool _summon_holy_being_wrapper(int pow, god_type god,
- holy_being_class_type hbct,
- int dur, bool friendly, bool quiet)
+static bool _summon_holy_being_wrapper(int pow, god_type god, int spell,
+ holy_being_class_type hbct, int dur,
+ bool friendly, bool quiet)
{
monster_type mon = summon_any_holy_being(hbct);
- return _summon_holy_being_wrapper(pow, god, mon, dur, friendly, quiet);
+ return _summon_holy_being_wrapper(pow, god, spell, mon, dur, friendly,
+ quiet);
}
-bool summon_holy_warrior(int pow, god_type god,
+bool summon_holy_warrior(int pow, god_type god, int spell,
bool force_hostile, bool permanent,
bool quiet)
{
- return _summon_holy_being_wrapper(pow, god, HOLY_BEING_WARRIOR,
+ return _summon_holy_being_wrapper(pow, god, spell, HOLY_BEING_WARRIOR,
!permanent ?
std::min(2 + (random2(pow) / 4), 6) :
0,
!force_hostile, quiet);
}
-bool summon_holy_being_type(monster_type mon, int pow, god_type god)
+bool summon_holy_being_type(monster_type mon, int pow,
+ god_type god, int spell)
{
- return _summon_holy_being_wrapper(pow, god, mon,
+ return _summon_holy_being_wrapper(pow, god, spell, mon,
std::min(2 + (random2(pow) / 4), 6),
true, false);
}
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 1ed6cec231..f3f03486c4 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -61,13 +61,13 @@ bool cast_summon_elemental(int pow, god_type god = GOD_NO_GOD,
bool cast_summon_ice_beast(int pow, god_type god = GOD_NO_GOD);
bool cast_summon_ugly_thing(int pow, god_type god = GOD_NO_GOD);
bool cast_summon_dragon(int pow, god_type god = GOD_NO_GOD);
-bool summon_berserker(int pow, god_type god = GOD_NO_GOD,
+bool summon_berserker(int pow, god_type god = GOD_NO_GOD, int spell = 0,
bool force_hostile = false);
-bool summon_holy_warrior(int pow, god_type god = GOD_NO_GOD,
+bool summon_holy_warrior(int pow, god_type god = GOD_NO_GOD, int spell = 0,
bool force_hostile = false, bool permanent = false,
bool quiet = false);
bool summon_holy_being_type(monster_type mon, int pow,
- god_type god = GOD_NO_GOD);
+ god_type god = GOD_NO_GOD, int spell = 0);
bool cast_tukimas_dance(int pow, god_type god = GOD_NO_GOD,
bool force_hostile = false);
bool cast_conjure_ball_lightning(int pow, god_type god = GOD_NO_GOD);
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 104cacd6b6..d9d93e109d 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -406,8 +406,9 @@ bool cast_call_imp(int pow, god_type god)
const int monster =
create_monster(
- mgen_data(mon, BEH_FRIENDLY, dur, you.pos(),
- you.pet_target,
+ mgen_data(mon, BEH_FRIENDLY,
+ dur, SPELL_CALL_IMP,
+ you.pos(), you.pet_target,
MG_FORCE_BEH, god));
if (monster != -1)
@@ -426,9 +427,9 @@ bool cast_call_imp(int pow, god_type god)
return (success);
}
-static bool _summon_demon_wrapper(int pow, god_type god, monster_type mon,
- int dur, bool friendly, bool charmed,
- bool quiet)
+static bool _summon_demon_wrapper(int pow, god_type god, int spell,
+ monster_type mon, int dur, bool friendly,
+ bool charmed, bool quiet)
{
bool success = false;
@@ -437,7 +438,8 @@ static bool _summon_demon_wrapper(int pow, god_type god, monster_type mon,
mgen_data(mon,
friendly ? BEH_FRIENDLY :
charmed ? BEH_CHARMED : BEH_HOSTILE,
- dur, you.pos(),
+ dur, spell,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
MG_FORCE_BEH, god));
@@ -457,41 +459,43 @@ static bool _summon_demon_wrapper(int pow, god_type god, monster_type mon,
return (success);
}
-static bool _summon_demon_wrapper(int pow, god_type god, demon_class_type dct,
- int dur, bool friendly, bool charmed,
- bool quiet)
+static bool _summon_demon_wrapper(int pow, god_type god, int spell,
+ demon_class_type dct, int dur, bool friendly,
+ bool charmed, bool quiet)
{
monster_type mon = summon_any_demon(dct);
- return _summon_demon_wrapper(pow, god, mon, dur, friendly, charmed, quiet);
+ return _summon_demon_wrapper(pow, god, spell, mon, dur, friendly, charmed,
+ quiet);
}
-bool summon_lesser_demon(int pow, god_type god,
+bool summon_lesser_demon(int pow, god_type god, int spell,
bool quiet)
{
- return _summon_demon_wrapper(pow, god, DEMON_LESSER,
+ return _summon_demon_wrapper(pow, god, spell, DEMON_LESSER,
std::min(2 + (random2(pow) / 4), 6),
random2(pow) > 3, false, quiet);
}
-bool summon_common_demon(int pow, god_type god,
+bool summon_common_demon(int pow, god_type god, int spell,
bool quiet)
{
- return _summon_demon_wrapper(pow, god, DEMON_COMMON,
+ return _summon_demon_wrapper(pow, god, spell, DEMON_COMMON,
std::min(2 + (random2(pow) / 4), 6),
random2(pow) > 3, false, quiet);
}
-bool summon_greater_demon(int pow, god_type god,
+bool summon_greater_demon(int pow, god_type god, int spell,
bool quiet)
{
- return _summon_demon_wrapper(pow, god, DEMON_GREATER,
+ return _summon_demon_wrapper(pow, god, spell, DEMON_GREATER,
5, false, random2(pow) > 5, quiet);
}
-bool summon_demon_type(monster_type mon, int pow, god_type god)
+bool summon_demon_type(monster_type mon, int pow, god_type god,
+ int spell)
{
- return _summon_demon_wrapper(pow, god, mon,
+ return _summon_demon_wrapper(pow, god, spell, mon,
std::min(2 + (random2(pow) / 4), 6),
random2(pow) > 3, false, false);
}
@@ -500,7 +504,7 @@ bool cast_summon_demon(int pow, god_type god)
{
mpr("You open a gate to Pandemonium!");
- bool success = summon_common_demon(pow, god);
+ bool success = summon_common_demon(pow, god, SPELL_SUMMON_DEMON);
if (!success)
canned_msg(MSG_NOTHING_HAPPENS);
@@ -518,7 +522,7 @@ bool cast_demonic_horde(int pow, god_type god)
for (int i = 0; i < how_many; ++i)
{
- if (summon_lesser_demon(pow, god, true))
+ if (summon_lesser_demon(pow, god, SPELL_DEMONIC_HORDE, true))
success = true;
}
@@ -532,7 +536,7 @@ bool cast_summon_greater_demon(int pow, god_type god)
{
mpr("You open a gate to Pandemonium!");
- bool success = summon_greater_demon(pow, god);
+ bool success = summon_greater_demon(pow, god, SPELL_SUMMON_GREATER_DEMON);
if (!success)
canned_msg(MSG_NOTHING_HAPPENS);
@@ -591,7 +595,8 @@ bool cast_summon_horrible_things(int pow, god_type god)
while (how_many_big > 0)
{
if (create_monster(
- mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY, 6,
+ mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY,
+ 6, SPELL_SUMMON_HORRIBLE_THINGS,
you.pos(), you.pet_target,
0, god)) != -1)
{
@@ -604,7 +609,8 @@ bool cast_summon_horrible_things(int pow, god_type god)
while (how_many_small > 0)
{
if (create_monster(
- mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY, 6,
+ mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY,
+ 6, SPELL_SUMMON_HORRIBLE_THINGS,
you.pos(), you.pet_target,
0, god)) != -1)
{
@@ -812,7 +818,7 @@ static bool _raise_remains(const coord_def &a, int corps, beh_type beha,
const int monster = create_monster(
mgen_data(mon, beha,
- 0, a, hitting,
+ 0, 0, a, hitting,
0, god,
zombie_type, number));
if (mon_index != NULL)
@@ -1002,7 +1008,8 @@ bool cast_simulacrum(int pow, god_type god)
{
if (create_monster(
mgen_data(MONS_SIMULACRUM_SMALL, BEH_FRIENDLY,
- 6, you.pos(), you.pet_target,
+ 6, SPELL_SIMULACRUM,
+ you.pos(), you.pet_target,
0, god, mon)) != -1)
{
count++;
@@ -1084,7 +1091,8 @@ bool cast_twisted_resurrection(int pow, god_type god)
const int monster =
create_monster(
mgen_data(mon, BEH_FRIENDLY,
- 0, you.pos(), you.pet_target,
+ 0, SPELL_TWISTED_RESURRECTION,
+ you.pos(), you.pet_target,
MG_FORCE_BEH, god,
MONS_PROGRAM_BUG, 0, colour));
@@ -1135,7 +1143,8 @@ bool cast_summon_wraiths(int pow, god_type god)
create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 5, you.pos(),
+ 5, SPELL_SUMMON_WRAITHS,
+ you.pos(),
friendly ? you.pet_target : MHITYOU,
MG_FORCE_BEH, god));
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 3460a91368..3ab8babacb 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -110,13 +110,14 @@ bool remove_curse(bool suppress_msg);
bool cast_sublimation_of_blood(int pow);
bool cast_call_imp(int pow, god_type god = GOD_NO_GOD);
-bool summon_lesser_demon(int pow, god_type god = GOD_NO_GOD,
+bool summon_lesser_demon(int pow, god_type god = GOD_NO_GOD, int spell = 0,
bool quiet = false);
-bool summon_common_demon(int pow, god_type god = GOD_NO_GOD,
+bool summon_common_demon(int pow, god_type god = GOD_NO_GOD, int spell = 0,
bool quiet = false);
-bool summon_greater_demon(int pow, god_type god = GOD_NO_GOD,
+bool summon_greater_demon(int pow, god_type god = GOD_NO_GOD, int spell = 0,
bool quiet = false);
-bool summon_demon_type(monster_type mon, int pow, god_type god = GOD_NO_GOD);
+bool summon_demon_type(monster_type mon, int pow, god_type god = GOD_NO_GOD,
+ int spell = 0);
bool cast_summon_demon(int pow, god_type god = GOD_NO_GOD);
bool cast_demonic_horde(int pow, god_type god = GOD_NO_GOD);
bool cast_summon_greater_demon(int pow, god_type god = GOD_NO_GOD);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 05c5929fb6..7c2753a7ec 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1543,11 +1543,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
break;
case SPELL_SUMMON_ANGEL:
- summon_holy_being_type(MONS_ANGEL, powc, god);
+ summon_holy_being_type(MONS_ANGEL, powc, god, (int)spell);
break;
case SPELL_SUMMON_DAEVA:
- summon_holy_being_type(MONS_DAEVA, powc, god);
+ summon_holy_being_type(MONS_DAEVA, powc, god, (int)spell);
break;
case SPELL_TUKIMAS_DANCE:
@@ -2881,14 +2881,17 @@ bool MiscastEffect::_create_monster(monster_type what, int abj_deg,
data.abjuration_duration = 6;
}
- // If data.abjuration_duration == 0 then data.summon_type will simply
- // be ignored.
- if (you.penance[god] > 0)
- data.summon_type = MON_SUMM_WRATH;
- else if (source == ZOT_TRAP_MISCAST)
- data.summon_type = MON_SUMM_ZOT;
- else
- data.summon_type = MON_SUMM_MISCAST;
+ // If data.abjuration_duration == 0, then data.summon_type will
+ // simply be ignored.
+ if (data.abjuration_duration != 0)
+ {
+ if (you.penance[god] > 0)
+ data.summon_type = MON_SUMM_WRATH;
+ else if (source == ZOT_TRAP_MISCAST)
+ data.summon_type = MON_SUMM_ZOT;
+ else
+ data.summon_type = MON_SUMM_MISCAST;
+ }
return (create_monster(data) != -1);
}