summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-12 03:52:08 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-12 03:53:13 -0800
commit078019644214628520c8116a9b4a16f30d8fadf2 (patch)
treedf1fc93d35c6b39455445360e482be5c26e1e2ac
parent7f502e207784d2c33ab38079dadfa298ab9fafc6 (diff)
downloadcrawl-ref-078019644214628520c8116a9b4a16f30d8fadf2.tar.gz
crawl-ref-078019644214628520c8116a9b4a16f30d8fadf2.zip
Add summoner and non_actor_summoner to mgen_data
Monsters now know who summoned them. This will be important later. Probably breaks something; saves are not one of them.
-rw-r--r--crawl-ref/source/abl-show.cc11
-rw-r--r--crawl-ref/source/abyss.cc5
-rw-r--r--crawl-ref/source/art-func.h4
-rw-r--r--crawl-ref/source/beam.cc5
-rw-r--r--crawl-ref/source/decks.cc15
-rw-r--r--crawl-ref/source/effects.cc9
-rw-r--r--crawl-ref/source/enum.h3
-rw-r--r--crawl-ref/source/fight.cc12
-rw-r--r--crawl-ref/source/godabil.cc5
-rw-r--r--crawl-ref/source/godwrath.cc19
-rw-r--r--crawl-ref/source/it_use3.cc11
-rw-r--r--crawl-ref/source/item_use.cc6
-rw-r--r--crawl-ref/source/mon-abil.cc5
-rw-r--r--crawl-ref/source/mon-act.cc3
-rw-r--r--crawl-ref/source/mon-cast.cc43
-rw-r--r--crawl-ref/source/mon-place.h24
-rw-r--r--crawl-ref/source/mon-stuff.cc2
-rw-r--r--crawl-ref/source/monster.cc3
-rw-r--r--crawl-ref/source/ouch.cc2
-rw-r--r--crawl-ref/source/religion.cc16
-rw-r--r--crawl-ref/source/spells2.cc78
-rw-r--r--crawl-ref/source/spells3.cc41
-rw-r--r--crawl-ref/source/spells3.h2
-rw-r--r--crawl-ref/source/spl-cast.cc4
-rw-r--r--crawl-ref/source/spl-mis.cc4
-rw-r--r--crawl-ref/source/wiz-fsim.cc3
-rw-r--r--crawl-ref/source/xom.cc50
27 files changed, 237 insertions, 148 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 9c86936570..365cb01024 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1482,7 +1482,8 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_RAISE_DEAD:
- animate_dead(&you, you.experience_level * 5, BEH_FRIENDLY, MHITYOU);
+ animate_dead(&you, you.experience_level * 5, BEH_FRIENDLY,
+ MHITYOU, &you);
break;
case ABIL_CONTROL_DEMON:
@@ -1609,7 +1610,7 @@ static bool _do_ability(const ability_def& abil)
mpr("You attempt to give life to the dead...");
if (animate_remains(you.pos(), CORPSE_BODY, BEH_FRIENDLY,
- MHITYOU, GOD_YREDELEMNUL) < 0)
+ MHITYOU, &you, "", GOD_YREDELEMNUL) < 0)
{
mpr("There are no remains here to animate!");
}
@@ -1625,7 +1626,7 @@ static bool _do_ability(const ability_def& abil)
mpr("You call on the dead to walk for you...");
animate_dead(&you, 1 + you.skills[SK_INVOCATIONS], BEH_FRIENDLY,
- MHITYOU, GOD_YREDELEMNUL);
+ MHITYOU, &you, "", GOD_YREDELEMNUL);
exercise(SK_INVOCATIONS, 2 + random2(4));
break;
@@ -1993,9 +1994,11 @@ static bool _do_ability(const ability_def& abil)
case ABIL_JIYVA_CALL_JELLY:
{
- mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0, you.pos(),
+ mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0, 0, you.pos(),
MHITNOT, 0, GOD_JIYVA);
+ mg.non_actor_summoner = "Jiyva";
+
if (create_monster(mg) == -1)
return (false);
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index e30013a5be..fe628db0af 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -709,7 +709,10 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos)
const beh_type beh =
one_chance_in(5 + you.skills[SK_INVOCATIONS] / 4) ? BEH_HOSTILE
: BEH_NEUTRAL;
- const int mid = create_monster(mgen_data(mons, beh, 5, 0, p));
+ mgen_data mg(mons, beh, 0, 5, 0, p);
+ mg.non_actor_summoner = "Lugonu's corruption";
+
+ const int mid = create_monster(mg);
return (mid != -1);
}
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h
index 1c8e3dc9c4..b460304502 100644
--- a/crawl-ref/source/art-func.h
+++ b/crawl-ref/source/art-func.h
@@ -74,6 +74,7 @@ static bool _evoke_sceptre_of_asmodeus()
summon_any_demon(DEMON_COMMON));
const bool good_summon = create_monster(
mgen_data::hostile_at(mon,
+ "the Sceptre of Asmodeus",
true, 6, 0, you.pos())) != -1;
if (good_summon)
@@ -462,7 +463,8 @@ static void _ZONGULDROK_world_reacts(item_def *item)
{
if (one_chance_in(5))
{
- animate_dead(&you, 1 + random2(3), BEH_HOSTILE, MHITYOU);
+ animate_dead(&you, 1 + random2(3), BEH_HOSTILE, MHITYOU, 0,
+ "the Sword of Zonguldrok");
did_god_conduct(DID_NECROMANCY, 1);
}
}
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index bd777efe11..66bebe1642 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3091,6 +3091,7 @@ void bolt::affect_ground()
int rc = create_monster(mgen_data(MONS_BALLISTOMYCETE,
beh,
+ agent(),
0,
0,
pos(),
@@ -3322,8 +3323,8 @@ void bolt::affect_place_explosion_clouds()
(whose_kill() == KC_OTHER ? BEH_HOSTILE : BEH_FRIENDLY);
mons_place(
- mgen_data(MONS_FIRE_VORTEX, att, 2, SPELL_FIRE_STORM, p,
- MHITNOT, 0, god));
+ mgen_data(MONS_FIRE_VORTEX, att, agent(), 2, SPELL_FIRE_STORM,
+ p, MHITNOT, 0, god));
}
}
}
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 1c023c3e4c..b57989a745 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2373,7 +2373,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
if (create_monster(
mgen_data::hostile_at(
- RANDOM_ELEMENT(statues),
+ RANDOM_ELEMENT(statues), "the Trowel card",
true, 0, 0, you.pos())) != -1)
{
mpr("A menacing statue appears!");
@@ -2387,7 +2387,7 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
if (create_monster(
mgen_data(RANDOM_ELEMENT(golems),
- BEH_FRIENDLY, 5, 0,
+ BEH_FRIENDLY, &you, 5, 0,
you.pos(), MHITYOU)) != -1)
{
mpr("You construct a golem!");
@@ -2582,7 +2582,7 @@ static void _summon_demon_card(int power, deck_rarity_type rarity)
// and thus not print the message.
// This hack appears later in this file as well.
if (create_monster(
- mgen_data(summon_any_demon(dct), BEH_FRIENDLY,
+ mgen_data(summon_any_demon(dct), BEH_FRIENDLY, &you,
std::min(power/50 + 1, 6), 0,
you.pos(), MHITYOU),
false) == -1)
@@ -2638,7 +2638,7 @@ static void _summon_any_monster(int power, deck_rarity_type rarity)
const bool friendly = (power_level > 0 || !one_chance_in(4));
if (create_monster(mgen_data(mon_chosen,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
3, 0, chosen_spot, MHITYOU),
false) == -1)
{
@@ -2654,7 +2654,7 @@ static void _summon_dancing_weapon(int power, deck_rarity_type rarity)
const int mon =
create_monster(
mgen_data(MONS_DANCING_WEAPON,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
power_level + 3, 0, you.pos(), MHITYOU),
false);
@@ -2740,7 +2740,7 @@ static void _summon_flying(int power, deck_rarity_type rarity)
{
create_monster(
mgen_data(result,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
std::min(power/50 + 1, 6), 0,
you.pos(), MHITYOU));
}
@@ -2755,7 +2755,7 @@ static void _summon_skeleton(int power, deck_rarity_type rarity)
};
if (create_monster(mgen_data(skeltypes[power_level],
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
std::min(power/50 + 1, 6), 0,
you.pos(), MHITYOU),
false) == -1)
@@ -2778,6 +2778,7 @@ static void _summon_ugly(int power, deck_rarity_type rarity)
if (create_monster(mgen_data(ugly,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ &you,
std::min(power/50 + 1, 6), 0,
you.pos(), MHITYOU),
false) == -1)
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 64bf8dce2b..f74729b323 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2860,7 +2860,7 @@ static void _hell_effects()
if (summon_instead)
{
create_monster(
- mgen_data::hostile_at(which_beastie,
+ mgen_data::hostile_at(which_beastie, "the effects of Hell",
true, 0, 0, you.pos()));
}
else
@@ -2882,6 +2882,7 @@ static void _hell_effects()
mgen_data mg;
mg.pos = you.pos();
mg.foe = MHITYOU;
+ mg.non_actor_summoner = "the effects of Hell";
create_monster(mg);
for (int i = 0; i < 4; ++i)
@@ -3936,8 +3937,9 @@ void handle_time(long time_delta)
|| monster_at(newpos)
|| env.cgrid(newpos) != EMPTY_CLOUD);
- mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0, newpos,
+ mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0, 0, newpos,
MHITNOT, 0, GOD_JIYVA);
+ mg.non_actor_summoner = "Jiyva";
if (create_monster(mg) != -1)
success = true;
@@ -4445,7 +4447,7 @@ static int _mushroom_ring(item_def &corpse, int & seen_count,
return (0);
mgen_data temp(MONS_TOADSTOOL,
- toadstool_behavior, 0, 0,
+ toadstool_behavior, 0, 0, 0,
coord_def(),
MHITNOT,
MG_FORCE_PLACE,
@@ -4541,6 +4543,7 @@ int spawn_corpse_mushrooms(item_def &corpse,
toadstool_behavior,
0,
0,
+ 0,
current,
MHITNOT,
MG_FORCE_PLACE,
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 193d4887a2..aab7442d05 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2093,7 +2093,8 @@ enum beh_type
BEH_STRICT_NEUTRAL,
BEH_NEUTRAL, // creation only
BEH_HOSTILE, // creation only
- BEH_GUARD // creation only - monster is guard
+ BEH_GUARD, // creation only - monster is guard
+ BEH_COPY // creation only - copy from summoner
};
enum mon_attitude_type
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 8466aa7f7c..ada19b5efc 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2854,7 +2854,8 @@ static bool _make_zombie(monsters* mon, int corpse_class, int corpse_index,
mitm[last_item].link = idx;
animate_remains(mon->pos(), CORPSE_BODY, mon->behaviour,
- mon->foe, mon->god, true, true, true, &zombie_index);
+ mon->foe, 0, "a chaos effect", mon->god,
+ true, true, true, &zombie_index);
}
// No equipment to get, or couldn't get it for some reason.
@@ -2862,10 +2863,11 @@ 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, 0, mon->pos(),
- mon->foe, MG_FORCE_PLACE, mon->god,
- mon->type, mon->number));
+ mgen_data mg(type, mon->behaviour, 0, 0, 0, mon->pos(),
+ mon->foe, MG_FORCE_PLACE, mon->god,
+ mon->type, mon->number);
+ mg.non_actor_summoner = "a chaos effect";
+ zombie_index = create_monster(mg);
}
if (zombie_index == -1)
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 114cb53842..6af4394a09 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -386,6 +386,7 @@ int fungal_bloom()
const int mushroom = create_monster(
mgen_data(MONS_TOADSTOOL,
BEH_FRIENDLY,
+ &you,
0,
0,
pos,
@@ -458,6 +459,7 @@ static int _create_plant(coord_def & target)
const int plant = create_monster(mgen_data
(MONS_PLANT,
BEH_FRIENDLY,
+ &you,
0,
0,
target,
@@ -560,6 +562,7 @@ bool sunlight()
// Create a plant.
const int plant = create_monster(mgen_data(MONS_PLANT,
BEH_HOSTILE,
+ &you,
0,
0,
target,
@@ -876,6 +879,7 @@ int rain(const coord_def &target)
const int plant = create_monster(mgen_data
(coinflip() ? MONS_PLANT : MONS_FUNGUS,
BEH_GOOD_NEUTRAL,
+ &you,
0,
0,
*rad,
@@ -953,6 +957,7 @@ int corpse_spores(beh_type behavior)
int rc = create_monster(mgen_data(MONS_GIANT_SPORE,
behavior,
+ &you,
0,
0,
*rad,
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index 7b0f262c20..678b35a209 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -61,7 +61,8 @@ static bool _yred_random_zombified_hostile()
else
z_type = skel ? MONS_SKELETON_SMALL : MONS_ZOMBIE_SMALL;
- return (create_monster(mgen_data::hostile_at(z_type, true,
+ return (create_monster(mgen_data::hostile_at(z_type,
+ "the anger of Yredelemnul", true,
0, 0, you.pos(), 0, GOD_YREDELEMNUL, z_base)) != -1);
}
@@ -83,7 +84,7 @@ static bool _okawaru_random_servant()
: MONS_TITAN); // 5%
return (create_monster(
- mgen_data::hostile_at(mon_type,
+ mgen_data::hostile_at(mon_type, "the fury of Okawaru",
true, 0, 0, you.pos(), 0, GOD_OKAWARU)) != -1);
}
@@ -202,7 +203,7 @@ static bool _zin_retribution()
mon_pos = you.pos();
if (mons_place(
- mgen_data::hostile_at(mon,
+ mgen_data::hostile_at(mon, "the power of Zin",
true, 0, 0, mon_pos, 0, god)) != -1)
{
success = true;
@@ -400,6 +401,7 @@ static bool _makhleb_retribution()
mgen_data::hostile_at(
static_cast<monster_type>(
MONS_EXECUTIONER + random2(5)),
+ "the fury of Makhleb",
true, 0, 0, you.pos(), 0, god)) != -1);
simple_god_message(success ? " sends a greater servant after you!"
@@ -417,6 +419,7 @@ static bool _makhleb_retribution()
mgen_data::hostile_at(
static_cast<monster_type>(
MONS_NEQOXEC + random2(5)),
+ "the fury of Makhleb",
true, 0, 0, you.pos(), 0, god)) != -1)
{
count++;
@@ -445,6 +448,7 @@ static bool _kikubaaqudgha_retribution()
{
if (create_monster(
mgen_data::hostile_at(MONS_REAPER,
+ "the malice of Kikubaaqudgha",
true, 0, 0, you.pos(), 0, god)) != -1)
{
success = true;
@@ -646,6 +650,7 @@ static bool _beogh_retribution()
const int mon =
create_monster(
mgen_data::hostile_at(MONS_DANCING_WEAPON,
+ "the wrath of Beogh",
true, 0, 0, you.pos(), 0, god));
if (mon != -1)
@@ -724,6 +729,7 @@ static bool _beogh_retribution()
int mons = create_monster(
mgen_data::hostile_at(punisher,
+ "the wrath of Beogh",
true, 0, 0, you.pos(), MG_PERMIT_BANDS, god));
// sometimes name band leader
@@ -835,6 +841,7 @@ static bool _lugonu_retribution()
mgen_data::hostile_at(
static_cast<monster_type>(
MONS_GREEN_DEATH + random2(3)),
+ "the touch of Lugonu",
true, 0, 0, you.pos(), 0, god)) != -1);
simple_god_message(success ? " sends a demon after you!"
@@ -851,6 +858,7 @@ static bool _lugonu_retribution()
mgen_data::hostile_at(
static_cast<monster_type>(
MONS_NEQOXEC + random2(5)),
+ "the touch of Lugonu",
true, 0, 0, you.pos(), 0, god)) != -1)
{
success = true;
@@ -977,6 +985,7 @@ static bool _jiyva_retribution()
if (create_monster(
mgen_data::hostile_at(static_cast<monster_type>(slime),
+ "the vengence of Jiyva",
true, 0, 0, you.pos(), 0, god)) != -1)
{
success = true;
@@ -1043,12 +1052,14 @@ static bool _fedhas_retribution()
unsigned free_thresh = 30;
mgen_data temp(MONS_OKLOB_PLANT,
- BEH_HOSTILE, 0, 0,
+ BEH_HOSTILE, 0, 0, 0,
coord_def(),
MHITNOT,
MG_FORCE_PLACE,
GOD_FEDHAS);
+ temp.non_actor_summoner = "the enmity of Fedhas Madash";
+
// If we have a lot of space to work with (the circle with
// radius 6 is substantially unoccupied), we can do something
// flashy.
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 8e40030f83..d1bfd030c6 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -145,8 +145,8 @@ void shadow_lantern_effect()
{
if (x_chance_in_y(player_spec_death() + 1, 8))
{
- create_monster(mgen_data(MONS_SHADOW, BEH_FRIENDLY, 2, 0, you.pos(),
- MHITYOU));
+ create_monster(mgen_data(MONS_SHADOW, BEH_FRIENDLY, &you, 2, 0,
+ you.pos(), MHITYOU));
item_def *lantern = you.weapon();
@@ -336,7 +336,7 @@ static bool evoke_horn_of_geryon()
{
mpr("You produce a hideous howling noise!", MSGCH_SOUND);
create_monster(
- mgen_data::hostile_at(MONS_BEAST,
+ mgen_data::hostile_at(MONS_BEAST, "the horn of Geryon",
true, 4, 0, you.pos()));
}
return (rc);
@@ -352,7 +352,7 @@ static bool _efreet_flask(int slot)
create_monster(
mgen_data(MONS_EFREET,
friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- 0, 0, you.pos(),
+ &you, 0, 0, you.pos(),
MHITYOU, MG_FORCE_BEH));
if (monster != -1)
@@ -530,6 +530,7 @@ void tome_of_power(int slot)
{
if (create_monster(
mgen_data::hostile_at(MONS_ABOMINATION_SMALL,
+ "a tome of Destruction",
true, 6, 0, you.pos())) != -1)
{
mpr("A horrible Thing appears!");
@@ -630,7 +631,7 @@ static bool _box_of_beasts(item_def &box)
beha = BEH_HOSTILE;
if (create_monster(
- mgen_data(beasty, beha, 2 + random2(4), 0,
+ mgen_data(beasty, beha, &you, 2 + random2(4), 0,
you.pos(), MHITYOU)) != -1)
{
success = true;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index eda4114516..94672df38d 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1794,8 +1794,8 @@ static bool _reaping_hit_victim(bolt& beam, actor* victim, int dmg, int corpse)
}
int midx = NON_MONSTER;
- if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting, GOD_NO_GOD,
- true, true, true, &midx) <= 0)
+ if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting, agent, "",
+ GOD_NO_GOD, true, true, true, &midx) <= 0)
{
return (false);
}
@@ -5261,7 +5261,7 @@ void read_scroll(int slot)
{
const int monster = create_monster(
mgen_data(MONS_ABOMINATION_SMALL, BEH_FRIENDLY,
- 0, 0, you.pos(), MHITYOU,
+ &you, 0, 0, you.pos(), MHITYOU,
MG_FORCE_BEH));
if (monster != -1)
{
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 73af98dd11..43118781d1 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -193,6 +193,7 @@ static bool _do_split(monsters *thing, coord_def & target)
thing->behaviour,
0,
0,
+ 0,
target,
thing->foe,
MG_FORCE_PLACE));
@@ -209,6 +210,8 @@ static bool _do_split(monsters *thing, coord_def & target)
_split_ench_durations(thing, new_slime);
new_slime->attitude = thing->attitude;
new_slime->flags = thing->flags;
+ new_slime->props = thing->props;
+ // XXX copy summoner info
if (you.can_see(thing))
mprf("%s splits.", thing->name(DESC_CAP_A).c_str());
@@ -547,7 +550,7 @@ static bool _silver_statue_effects(monsters *mons)
mgen_data(
summon_any_demon((coinflip() ? DEMON_COMMON
: DEMON_LESSER)),
- SAME_ATTITUDE(mons), 5, 0, foe->pos(), mons->foe));
+ SAME_ATTITUDE(mons), mons, 5, 0, foe->pos(), mons->foe));
return (true);
}
return (false);
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 08993ab449..d9bce0dbfd 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -857,7 +857,8 @@ static bool _handle_scroll(monsters *monster)
simple_monster_message(monster, " reads a scroll.");
const int mon = create_monster(
mgen_data(MONS_ABOMINATION_SMALL, SAME_ATTITUDE(monster),
- 0, 0, monster->pos(), monster->foe, MG_FORCE_BEH));
+ monster, 0, 0, monster->pos(), monster->foe,
+ MG_FORCE_BEH));
read = true;
if (mon != -1)
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 402576bd14..a07ad8987c 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1257,7 +1257,7 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
// Try to animate dead: if nothing rises, pretend we didn't cast it.
if (spell_cast == SPELL_ANIMATE_DEAD
&& !animate_dead(monster, 100, SAME_ATTITUDE(monster),
- monster->foe, god, false))
+ monster->foe, monster, "", god, false))
{
return (false);
}
@@ -1485,7 +1485,7 @@ static void _do_high_level_summon(monsters *monster, bool monsterNearby,
continue;
create_monster(
- mgen_data(which_mons, SAME_ATTITUDE(monster),
+ mgen_data(which_mons, SAME_ATTITUDE(monster), monster,
duration, spell_cast, target ? *target : monster->pos(),
monster->foe, 0, god));
}
@@ -1618,7 +1618,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
const monster_type mon = (one_chance_in(3) ? MONS_GIANT_BAT
: RANDOM_ELEMENT(rats));
create_monster(
- mgen_data(mon, SAME_ATTITUDE(monster),
+ mgen_data(mon, SAME_ATTITUDE(monster), monster,
5, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -1632,7 +1632,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; ++sumcount)
{
create_monster(
- mgen_data(RANDOM_MONSTER, SAME_ATTITUDE(monster),
+ mgen_data(RANDOM_MONSTER, SAME_ATTITUDE(monster), monster,
5, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -1661,7 +1661,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
create_monster(
- mgen_data(el_summon_type, SAME_ATTITUDE(monster),
+ mgen_data(el_summon_type, SAME_ATTITUDE(monster), monster,
3, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -1693,7 +1693,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
// being passed to summon_type), so I'm not sure what the
// abjuration value (3) is doing there. (jpeg)
if (create_monster(
- mgen_data(MONS_KRAKEN_TENTACLE, SAME_ATTITUDE(monster),
+ mgen_data(MONS_KRAKEN_TENTACLE, SAME_ATTITUDE(monster), monster,
3, spell_cast, monster->pos(), monster->foe, 0, god,
MONS_NO_MONSTER, kraken_index, monster->colour,
you.your_level, PROX_CLOSE_TO_PLAYER,
@@ -1714,7 +1714,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
create_monster(
- mgen_data(MONS_RAKSHASA_FAKE, SAME_ATTITUDE(monster),
+ mgen_data(MONS_RAKSHASA_FAKE, SAME_ATTITUDE(monster), monster,
3, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -1730,7 +1730,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, spell_cast,
+ SAME_ATTITUDE(monster), monster, duration, spell_cast,
monster->pos(), monster->foe, 0, god));
}
return;
@@ -1749,7 +1749,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
: MONS_UGLY_THING);
create_monster(
- mgen_data(mon, SAME_ATTITUDE(monster),
+ mgen_data(mon, SAME_ATTITUDE(monster), monster,
duration, spell_cast, monster->pos(), monster->foe, 0,
god));
}
@@ -1758,7 +1758,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
case SPELL_ANIMATE_DEAD:
// see special handling in mon-stuff::handle_spell() {dlb}
animate_dead(monster, 5 + random2(5), SAME_ATTITUDE(monster),
- monster->foe, god);
+ monster->foe, monster, "", god);
return;
case SPELL_CALL_IMP: // class 5 demons
@@ -1769,7 +1769,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(summon_any_demon(DEMON_LESSER),
- SAME_ATTITUDE(monster),
+ SAME_ATTITUDE(monster), monster,
duration, spell_cast, monster->pos(), monster->foe, 0,
god));
}
@@ -1785,7 +1785,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; ++sumcount)
{
create_monster(
- mgen_data(MONS_SCORPION, SAME_ATTITUDE(monster),
+ mgen_data(MONS_SCORPION, SAME_ATTITUDE(monster), monster,
duration, spell_cast, monster->pos(), monster->foe, 0,
god));
}
@@ -1799,7 +1799,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; ++sumcount)
{
create_monster(
- mgen_data(MONS_UFETUBUS, SAME_ATTITUDE(monster),
+ mgen_data(MONS_UFETUBUS, SAME_ATTITUDE(monster), monster,
duration, spell_cast, monster->pos(), monster->foe, 0,
god));
}
@@ -1807,13 +1807,13 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
case SPELL_SUMMON_BEAST: // Geryon
create_monster(
- mgen_data(MONS_BEAST, SAME_ATTITUDE(monster),
+ mgen_data(MONS_BEAST, SAME_ATTITUDE(monster), monster,
4, spell_cast, monster->pos(), monster->foe, 0, god));
return;
case SPELL_SUMMON_ICE_BEAST:
create_monster(
- mgen_data(MONS_ICE_BEAST, SAME_ATTITUDE(monster),
+ mgen_data(MONS_ICE_BEAST, SAME_ATTITUDE(monster), monster,
5, spell_cast, monster->pos(), monster->foe, 0, god));
return;
@@ -1828,8 +1828,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_WANDERING_MUSHROOM, SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe, 0,
- god));
+ monster, duration, spell_cast, monster->pos(),
+ monster->foe, 0, god));
}
return;
@@ -1845,7 +1845,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_BALL_LIGHTNING, SAME_ATTITUDE(monster),
- 2, spell_cast, monster->pos(), monster->foe, 0, god));
+ monster, 2, spell_cast, monster->pos(), monster->foe,
+ 0, god));
}
return;
}
@@ -1875,7 +1876,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(summon_any_demon(DEMON_GREATER),
- SAME_ATTITUDE(monster),
+ SAME_ATTITUDE(monster), monster,
duration, spell_cast, monster->pos(), monster->foe,
0, god));
}
@@ -1913,7 +1914,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (int i = 0, size = monsters.size(); i < size; ++i)
{
create_monster(
- mgen_data(monsters[i], SAME_ATTITUDE(monster),
+ mgen_data(monsters[i], SAME_ATTITUDE(monster), monster,
duration, spell_cast,
monster->pos(), monster->foe, 0, god));
}
@@ -2100,7 +2101,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
0));
create_monster(
- mgen_data(mon, SAME_ATTITUDE(monster), duration,
+ mgen_data(mon, SAME_ATTITUDE(monster), monster, duration,
spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
diff --git a/crawl-ref/source/mon-place.h b/crawl-ref/source/mon-place.h
index 9f1f0606d3..bf9cd64ec2 100644
--- a/crawl-ref/source/mon-place.h
+++ b/crawl-ref/source/mon-place.h
@@ -126,6 +126,10 @@ struct mgen_data
// XXX: Could use splitting up these aspects.
beh_type behaviour;
+ // Who summoned this monster? Important to know for death accounting
+ // and the summon cap, if and when it goes in. NULL is no summoner.
+ actor* summoner;
+
// For summoned monsters, this is a measure of how long the summon will
// hang around, on a scale of 1-6, 6 being longest. Use 0 for monsters
// that aren't summoned.
@@ -190,8 +194,13 @@ struct mgen_data
// XXX: Rather hackish.
std::string mname;
+ // This is used to account for non-actor summoners. Blasted by an Ice
+ // Fiend ... summoned by the effects of Hell.
+ std::string non_actor_summoner;
+
mgen_data(monster_type mt = RANDOM_MONSTER,
beh_type beh = BEH_HOSTILE,
+ actor* sner = 0,
int abj = 0,
int st = 0,
const coord_def &p = coord_def(-1, -1),
@@ -204,13 +213,14 @@ struct mgen_data
int monpower = you.your_level,
proximity_type prox = PROX_ANYWHERE,
level_area_type ltype = you.level_type,
- std::string monname = "")
+ std::string monname = "",
+ std::string nas = "")
- : cls(mt), base_type(base), behaviour(beh),
+ : cls(mt), base_type(base), behaviour(beh), summoner(sner),
abjuration_duration(abj), summon_type(st), pos(p), foe(mfoe),
flags(monflags), god(which_god), number(monnumber), colour(moncolour),
power(monpower), proximity(prox), level_type(ltype), map_mask(0),
- mname(monname)
+ mname(monname), non_actor_summoner(nas)
{
ASSERT(summon_type == 0 || (abj >= 1 && abj <= 6)
|| mt == MONS_BALL_LIGHTNING);
@@ -230,10 +240,11 @@ struct mgen_data
const coord_def &where,
unsigned flags = 0)
{
- return mgen_data(what, BEH_SLEEP, 0, 0, where, MHITNOT, flags);
+ return mgen_data(what, BEH_SLEEP, 0, 0, 0, where, MHITNOT, flags);
}
static mgen_data hostile_at(monster_type mt,
+ std::string summoner,
bool alert = false,
int abj = 0,
int st = 0,
@@ -243,9 +254,10 @@ struct mgen_data
monster_type base = MONS_NO_MONSTER)
{
- return mgen_data(mt, BEH_HOSTILE, abj, st, p,
+ return mgen_data(mt, BEH_HOSTILE, 0, abj, st, p,
alert ? MHITYOU : MHITNOT,
- monflags, god, base);
+ monflags, god, base, 0, BLACK, you.your_level,
+ PROX_ANYWHERE, you.level_type, "", summoner);
}
};
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index fd300ea86c..d337cd45ab 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -1790,7 +1790,7 @@ int monster_die(monsters *monster, killer_type killer,
{
const int spectre =
create_monster(
- mgen_data(MONS_SPECTRAL_THING, BEH_FRIENDLY,
+ mgen_data(MONS_SPECTRAL_THING, BEH_FRIENDLY, &you,
0, 0, monster->pos(), MHITYOU,
0, static_cast<god_type>(you.attribute[ATTR_DIVINE_DEATH_CHANNEL]),
spectre_type, monster->number));
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index afbb16af7c..b2f42c18f9 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4997,6 +4997,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
int rc = create_monster(mgen_data(MONS_GIANT_SPORE,
created_behavior,
+ this,
0,
0,
adjacent,
@@ -5824,7 +5825,7 @@ void monsters::react_to_damage(int damage, beam_type flavour, kill_category whos
continue;
const int nmons = mons_place(
- mgen_data(jelly, beha, 0, 0,
+ mgen_data(jelly, beha, this, 0, 0,
jpos, foe, 0, god));
if (nmons != -1 && nmons != NON_MONSTER)
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 52ace7b1a8..5b6cf0a010 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -947,7 +947,7 @@ static void _maybe_spawn_jellies(int dam, const char* aux,
int count_created = 0;
for (int i = 0; i < how_many; ++i)
{
- mgen_data mg(mon, BEH_STRICT_NEUTRAL, 0, 0, you.pos(),
+ mgen_data mg(mon, BEH_STRICT_NEUTRAL, &you, 0, 0, you.pos(),
MHITNOT, 0, GOD_JIYVA);
if (create_monster(mg) != -1)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 2e7dc5eede..76a4c5af79 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1121,7 +1121,11 @@ int yred_random_servants(int threshold, bool force_hostile)
how_many = 2 + random2(4);
mgen_data mg(mon_type, !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- 0, 0, you.pos(), MHITYOU, 0, GOD_YREDELEMNUL);
+ !force_hostile ? &you : 0, 0, 0, you.pos(), MHITYOU, 0,
+ GOD_YREDELEMNUL);
+
+ if (force_hostile)
+ mg.non_actor_summoner = "the anger of Yredelemnul";
int created = 0;
if (force_hostile)
@@ -1730,7 +1734,7 @@ static void _beogh_blessing_reinforcements()
follower_type = RANDOM_ELEMENT(followers);
_delayed_monster(
- mgen_data(follower_type, BEH_FRIENDLY, 0, 0,
+ mgen_data(follower_type, BEH_FRIENDLY, &you, 0, 0,
you.pos(), MHITYOU, 0, GOD_BEOGH),
_beogh_reinf_callback);
}
@@ -2137,9 +2141,11 @@ static void _do_god_gift(bool prayed_for)
int count_created = 0;
for (; jelly_count > 0; --jelly_count)
{
- mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0,
+ mgen_data mg(MONS_JELLY, BEH_STRICT_NEUTRAL, 0, 0, 0,
you.pos(), MHITNOT, 0, GOD_JIYVA);
+ mg.non_actor_summoner = "Jiyva";
+
if (create_monster(mg) != -1)
count_created++;
@@ -5046,8 +5052,8 @@ void god_pitch(god_type which_god)
if (!_has_jelly())
{
monster_type mon = MONS_JELLY;
- mgen_data mg(mon, BEH_STRICT_NEUTRAL, 0, 0, you.pos(), MHITNOT, 0,
- GOD_JIYVA);
+ mgen_data mg(mon, BEH_STRICT_NEUTRAL, &you, 0, 0, you.pos(),
+ MHITNOT, 0, GOD_JIYVA);
_delayed_monster(mg);
simple_god_message(" grants you a jelly!");
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 44448142b3..e0378e81f4 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -884,7 +884,7 @@ bool summon_animals(int pow)
if (create_monster(
mgen_data(mon,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
4, 0, you.pos(), MHITYOU)) != -1)
{
success = true;
@@ -903,7 +903,7 @@ 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,
+ mgen_data(MONS_BUTTERFLY, BEH_FRIENDLY, &you,
3, SPELL_SUMMON_BUTTERFLIES,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -938,7 +938,7 @@ bool cast_summon_small_mammals(int pow, god_type god)
}
if (create_monster(
- mgen_data(mon, BEH_FRIENDLY,
+ mgen_data(mon, BEH_FRIENDLY, &you,
3, SPELL_SUMMON_SMALL_MAMMALS,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -996,7 +996,7 @@ bool cast_sticks_to_snakes(int pow, god_type god)
mon = MONS_SMALL_SNAKE;
if (create_monster(
- mgen_data(mon, beha,
+ mgen_data(mon, beha, &you,
dur, SPELL_STICKS_TO_SNAKES,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -1043,7 +1043,7 @@ bool cast_sticks_to_snakes(int pow, god_type god)
mon = MONS_GREY_SNAKE;
if (create_monster(
- mgen_data(mon, beha,
+ mgen_data(mon, beha, &you,
dur, SPELL_STICKS_TO_SNAKES,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -1082,7 +1082,7 @@ bool cast_summon_scorpions(int pow, god_type god)
if (create_monster(
mgen_data(MONS_SCORPION,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
3, SPELL_SUMMON_SCORPIONS,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -1123,7 +1123,7 @@ bool cast_summon_swarm(int pow, god_type god,
if (create_monster(
mgen_data(mon,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
dur, !permanent ? SPELL_SUMMON_SWARM : 0,
you.pos(),
MHITYOU,
@@ -1180,7 +1180,7 @@ bool cast_call_canine_familiar(int pow, god_type god)
const int dur = std::min(2 + (random2(pow) / 4), 6);
if (create_monster(
- mgen_data(mon, BEH_FRIENDLY,
+ mgen_data(mon, BEH_FRIENDLY, &you,
dur, SPELL_CALL_CANINE_FAMILIAR,
you.pos(),
MHITYOU,
@@ -1317,7 +1317,7 @@ bool cast_summon_elemental(int pow, god_type god,
if (create_monster(
mgen_data(mon,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
dur, SPELL_SUMMON_ELEMENTAL,
targ,
MHITYOU,
@@ -1342,7 +1342,7 @@ 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,
+ mgen_data(mon, BEH_FRIENDLY, &you,
dur, SPELL_SUMMON_ICE_BEAST,
you.pos(), MHITYOU,
0, god)) != -1)
@@ -1367,7 +1367,7 @@ bool cast_summon_ugly_thing(int pow, god_type god)
if (create_monster(
mgen_data(mon,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
dur, SPELL_SUMMON_UGLY_THING,
you.pos(),
MHITYOU,
@@ -1397,7 +1397,7 @@ bool cast_summon_dragon(int pow, god_type god)
if (create_monster(
mgen_data(MONS_DRAGON,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE, &you,
3, SPELL_SUMMON_DRAGON,
you.pos(),
MHITYOU,
@@ -1462,11 +1462,15 @@ bool summon_berserker(int pow, god_type god, int spell,
mon = (coinflip()) ? MONS_HILL_GIANT : MONS_STONE_GIANT;
}
+ mgen_data mg(mon, !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
+ !force_hostile ? &you : 0, dur, spell, you.pos(),
+ MHITYOU, 0, god);
+
+ if (force_hostile)
+ mg.non_actor_summoner = "the rage of " + god_name(god, false);
+
int monster =
- create_monster(
- mgen_data(mon,
- !force_hostile ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, spell, you.pos(), MHITYOU, 0, god));
+ create_monster(mg);
if (monster == -1)
return (false);
@@ -1496,14 +1500,18 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, int spell,
{
UNUSED(pow);
- const int monster =
- create_monster(
- mgen_data(mon,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, spell,
- you.pos(),
- MHITYOU,
- MG_FORCE_BEH, god));
+ mgen_data mg(mon,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ friendly ? &you : 0,
+ dur, spell,
+ you.pos(),
+ MHITYOU,
+ MG_FORCE_BEH, god);
+
+ if (!friendly)
+ mg.non_actor_summoner = god_name(god, false);
+
+ const int monster = create_monster(mg);
if (monster == -1)
return (false);
@@ -1584,14 +1592,18 @@ bool cast_tukimas_dance(int pow, god_type god, bool force_hostile)
// Cursed weapons become hostile.
const bool friendly = (!force_hostile && !item_cursed(you.inv[wpn]));
- monster =
- create_monster(
- mgen_data(MONS_DANCING_WEAPON,
- friendly ? BEH_FRIENDLY : BEH_HOSTILE,
- dur, SPELL_TUKIMAS_DANCE,
- you.pos(),
- MHITYOU,
- 0, god));
+ mgen_data mg(MONS_DANCING_WEAPON,
+ friendly ? BEH_FRIENDLY : BEH_HOSTILE,
+ force_hostile ? 0 : &you,
+ dur, SPELL_TUKIMAS_DANCE,
+ you.pos(),
+ MHITYOU,
+ 0, god);
+
+ if (force_hostile)
+ mg.non_actor_summoner = god_name(god, false);
+
+ monster = create_monster(mg);
if (monster == -1)
{
@@ -1680,7 +1692,7 @@ bool cast_conjure_ball_lightning(int pow, god_type god)
int monster =
mons_place(
- mgen_data(MONS_BALL_LIGHTNING, BEH_FRIENDLY,
+ mgen_data(MONS_BALL_LIGHTNING, BEH_FRIENDLY, &you,
0, SPELL_CONJURE_BALL_LIGHTNING,
target, MHITNOT, 0, god));
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 812b7d00d0..17b33ead54 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -427,7 +427,7 @@ bool cast_call_imp(int pow, god_type god)
const int monster =
create_monster(
- mgen_data(mon, BEH_FRIENDLY, dur, SPELL_CALL_IMP,
+ mgen_data(mon, BEH_FRIENDLY, &you, dur, SPELL_CALL_IMP,
you.pos(), MHITYOU, MG_FORCE_BEH, god));
if (monster != -1)
@@ -456,7 +456,7 @@ static bool _summon_demon_wrapper(int pow, god_type god, int spell,
create_monster(
mgen_data(mon,
friendly ? BEH_FRIENDLY :
- charmed ? BEH_CHARMED : BEH_HOSTILE,
+ charmed ? BEH_CHARMED : BEH_HOSTILE, &you,
dur, spell, you.pos(), MHITYOU, MG_FORCE_BEH, god));
if (monster != -1)
@@ -566,7 +566,7 @@ bool cast_shadow_creatures(god_type god)
const int monster =
create_monster(
- mgen_data(RANDOM_MONSTER, BEH_FRIENDLY,
+ mgen_data(RANDOM_MONSTER, BEH_FRIENDLY, &you,
2, SPELL_SHADOW_CREATURES,
you.pos(), MHITYOU,
MG_FORCE_BEH, god), false);
@@ -613,7 +613,7 @@ bool cast_summon_horrible_things(int pow, god_type god)
{
const int monster =
create_monster(
- mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY,
+ mgen_data(MONS_TENTACLED_MONSTROSITY, BEH_FRIENDLY, &you,
6, SPELL_SUMMON_HORRIBLE_THINGS,
you.pos(), MHITYOU,
MG_FORCE_BEH, god));
@@ -629,7 +629,7 @@ bool cast_summon_horrible_things(int pow, god_type god)
{
const int monster =
create_monster(
- mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY,
+ mgen_data(MONS_ABOMINATION_LARGE, BEH_FRIENDLY, &you,
6, SPELL_SUMMON_HORRIBLE_THINGS,
you.pos(), MHITYOU,
MG_FORCE_BEH, god));
@@ -926,8 +926,9 @@ void equip_undead(const coord_def &a, int corps, int monster, int monnum)
}
static bool _raise_remains(const coord_def &pos, int corps, beh_type beha,
- unsigned short hitting, god_type god, bool actual,
- bool force_beh, int* mon_index)
+ unsigned short hitting, actor *as, std::string nas,
+ god_type god, bool actual, bool force_beh,
+ int* mon_index)
{
if (mon_index != NULL)
*mon_index = -1;
@@ -970,11 +971,12 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha,
: MONS_SKELETON_LARGE;
}
- int monster = create_monster(
- mgen_data(mon, beha,
- 0, 0, pos, hitting,
- MG_FORCE_BEH, god,
- zombie_type, number));
+ mgen_data mg(mon, beha, as, 0, 0, pos, hitting, MG_FORCE_BEH, god,
+ zombie_type, number);
+
+ mg.non_actor_summoner = nas;
+
+ int monster = create_monster(mg);
if (mon_index != NULL)
*mon_index = monster;
@@ -1007,6 +1009,7 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha,
// you are butchering being animated.
int animate_remains(const coord_def &a, corpse_type class_allowed,
beh_type beha, unsigned short hitting,
+ actor *as, std::string nas,
god_type god, bool actual,
bool quiet, bool force_beh,
int* mon_index)
@@ -1031,8 +1034,8 @@ int animate_remains(const coord_def &a, corpse_type class_allowed,
const bool was_butchering = is_being_butchered(*si);
- success = _raise_remains(a, si.link(), beha, hitting, god, actual,
- force_beh, mon_index);
+ success = _raise_remains(a, si.link(), beha, hitting, as, nas,
+ god, actual, force_beh, mon_index);
if (actual && success)
{
@@ -1065,7 +1068,7 @@ int animate_remains(const coord_def &a, corpse_type class_allowed,
}
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
- god_type god, bool actual)
+ actor *as, std::string nas, god_type god, bool actual)
{
UNUSED(pow);
@@ -1080,7 +1083,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
{
// This will produce a message if the corpse you are butchering
// is raised.
- if (animate_remains(*ri, CORPSE_BODY, beha, hitting, god,
+ if (animate_remains(*ri, CORPSE_BODY, beha, hitting, as, nas, god,
actual, true) > 0)
{
number_raised++;
@@ -1133,7 +1136,7 @@ bool cast_simulacrum(int pow, god_type god)
{
const int monster =
create_monster(
- mgen_data(sim_type, BEH_FRIENDLY,
+ mgen_data(sim_type, BEH_FRIENDLY, &you,
6, SPELL_SIMULACRUM,
you.pos(), MHITYOU,
MG_FORCE_BEH, god, type));
@@ -1224,7 +1227,7 @@ bool cast_twisted_resurrection(int pow, god_type god)
const int monster =
create_monster(
- mgen_data(mon, BEH_FRIENDLY,
+ mgen_data(mon, BEH_FRIENDLY, &you,
0, 0,
you.pos(), MHITYOU,
MG_FORCE_BEH, god,
@@ -1306,7 +1309,7 @@ bool cast_haunt(int pow, const coord_def& where, god_type god)
const int monster =
create_monster(
mgen_data(mon,
- BEH_FRIENDLY,
+ BEH_FRIENDLY, &you,
5, SPELL_HAUNT,
where, mi, MG_FORCE_BEH, god));
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 0aac012c80..7656213bcb 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -51,11 +51,13 @@ bool receive_corpses(int pow, coord_def where);
void equip_undead(const coord_def &a, int corps, int monster, int monnum);
int animate_remains(const coord_def &a, corpse_type class_allowed,
beh_type beha, unsigned short hitting,
+ actor *as = NULL, std::string nas = "",
god_type god = GOD_NO_GOD, bool actual = true,
bool quiet = false, bool force_beh = false,
int* mon_index = NULL);
int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting,
+ actor *as = NULL, std::string nas = "",
god_type god = GOD_NO_GOD, bool actual = true);
bool cast_simulacrum(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 25c7058974..ae4c085cc4 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1705,7 +1705,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
mpr("You attempt to give life to the dead...");
if (animate_remains(you.pos(), CORPSE_SKELETON, BEH_FRIENDLY,
- MHITYOU, god) < 0)
+ MHITYOU, &you, "", god) < 0)
{
mpr("There is no skeleton here to animate!");
}
@@ -1714,7 +1714,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
case SPELL_ANIMATE_DEAD:
mpr("You call on the dead to walk for you...");
- animate_dead(&you, powc + 1, BEH_FRIENDLY, MHITYOU, god);
+ animate_dead(&you, powc + 1, BEH_FRIENDLY, MHITYOU, &you, "", god);
break;
case SPELL_SIMULACRUM:
diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc
index 5a1452e7da..511426ec09 100644
--- a/crawl-ref/source/spl-mis.cc
+++ b/crawl-ref/source/spl-mis.cc
@@ -707,7 +707,9 @@ bool MiscastEffect::_create_monster(monster_type what, int abj_deg,
(crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
: GOD_NO_GOD;
- mgen_data data = mgen_data::hostile_at(what, alert,
+ if (cause.empty())
+ cause = get_default_cause();
+ mgen_data data = mgen_data::hostile_at(what, cause, alert,
abj_deg, 0, target->pos(), 0, god);
// hostile_at() assumes the monster is hostile to the player,
diff --git a/crawl-ref/source/wiz-fsim.cc b/crawl-ref/source/wiz-fsim.cc
index 1e3b784ce8..31d052a268 100644
--- a/crawl-ref/source/wiz-fsim.cc
+++ b/crawl-ref/source/wiz-fsim.cc
@@ -32,7 +32,8 @@ static int _create_fsim_monster(int mtype, int hp)
const int mi =
create_monster(
mgen_data::hostile_at(
- static_cast<monster_type>(mtype), false, 0, 0, you.pos()));
+ static_cast<monster_type>(mtype),
+ "the fight simulator", false, 0, 0, you.pos()));
if (mi == -1)
return (mi);
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 8ceda15fb7..f7a694d840 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1262,12 +1262,14 @@ static int _xom_send_allies(int sever, bool debug = false)
{
monster_type mon_type = _xom_random_demon(sever);
- summons[i] =
- create_monster(
- mgen_data(mon_type, BEH_FRIENDLY,
- 3, MON_SUMM_AID,
- you.pos(), MHITYOU,
- MG_FORCE_BEH, GOD_XOM));
+ mgen_data mg(mon_type, BEH_FRIENDLY, &you, 3, MON_SUMM_AID,
+ you.pos(), MHITYOU, MG_FORCE_BEH, GOD_XOM);
+
+ // Even though the friendlies are charged to you for accounting,
+ // they should still show as Xom's fault if one of them kills you.
+ mg.non_actor_summoner = "Xom";
+
+ summons[i] = create_monster(mg);
if (summons[i] != -1)
{
@@ -1325,6 +1327,7 @@ static int _xom_send_allies(int sever, bool debug = false)
|| (!is_demonic[i] && hostiletype == 2))
{
mon->attitude = ATT_HOSTILE;
+ // XXX need to reset summon quota here?
behaviour_event(mon, ME_ALERT, MHITYOU);
}
}
@@ -1367,10 +1370,12 @@ static int _xom_send_one_ally(int sever, bool debug = false)
if (different && one_chance_in(4))
beha = BEH_HOSTILE;
- const int summons =
- create_monster(
- mgen_data(mon_type, beha, 6, MON_SUMM_AID, you.pos(), MHITYOU,
- MG_FORCE_BEH, GOD_XOM));
+ mgen_data mg(mon_type, beha, (beha == BEH_FRIENDLY) ? &you : 0, 6,
+ MON_SUMM_AID, you.pos(), MHITYOU, MG_FORCE_BEH, GOD_XOM);
+
+ mg.non_actor_summoner = "Xom";
+
+ const int summons = create_monster(mg);
if (summons != -1)
{
@@ -1763,10 +1768,14 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false)
ASSERT(wpn != NON_ITEM);
const int dur = std::min(2 + (random2(sever) / 5), 6);
- const int monster = create_monster(
- mgen_data(MONS_DANCING_WEAPON, BEH_FRIENDLY,
- dur, SPELL_TUKIMAS_DANCE,
- mon->pos(), mon->mindex(), 0, GOD_XOM));
+
+ mgen_data mg(MONS_DANCING_WEAPON, BEH_FRIENDLY, &you, dur,
+ SPELL_TUKIMAS_DANCE, mon->pos(), mon->mindex(),
+ 0, GOD_XOM);
+
+ mg.non_actor_summoner = "Xom";
+
+ const int monster = create_monster(mg);
if (monster == -1)
return (XOM_DID_NOTHING);
@@ -1853,10 +1862,13 @@ static int _xom_send_major_ally(int sever, bool debug = false)
if (!is_demonic && one_chance_in(4))
beha = BEH_HOSTILE;
- const int summons =
- create_monster(
- mgen_data(_xom_random_demon(sever, one_chance_in(8)), beha,
- 0, 0, you.pos(), MHITYOU, MG_FORCE_BEH, GOD_XOM));
+ mgen_data mg(_xom_random_demon(sever, one_chance_in(8)), beha,
+ (beha == BEH_FRIENDLY) ? &you : 0,
+ 0, 0, you.pos(), MHITYOU, MG_FORCE_BEH, GOD_XOM);
+
+ mg.non_actor_summoner = "Xom";
+
+ const int summons = create_monster(mg);
if (summons != -1)
{
@@ -3180,7 +3192,7 @@ static int _xom_summon_hostiles(int sever, bool debug = false)
{
if (create_monster(
mgen_data::hostile_at(
- _xom_random_demon(sever),
+ _xom_random_demon(sever), "Xom",
true, 4, MON_SUMM_WRATH, you.pos(), 0,
GOD_XOM)) != -1)
{