summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-07 07:20:54 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-07 07:20:54 +0000
commit40d45085f0e6ee4f9c4331c7a630ff6e5d3b1b30 (patch)
treee9e472275715aa0de58fe51c89ec34bbbf89e74e /crawl-ref
parent4f955d1dd5e8fda4fb45b09fbbfcab138e26a75b (diff)
downloadcrawl-ref-40d45085f0e6ee4f9c4331c7a630ff6e5d3b1b30.tar.gz
crawl-ref-40d45085f0e6ee4f9c4331c7a630ff6e5d3b1b30.zip
Properly handle the gods of monsters created by monster spells. If the
monster that created them is a priest, assume they're from priestly abilities, and if the monster that created them is neither a priest nor a wizard, assume they're from intrinsic abilities; in both cases, they'll have the same god as the monster. The latter should cover cases such as god-summoned shadow imps' casting Animate Dead; if the imp abandons you due to your abandoning its god, its zombies will abandon you too. Also, mark skeletal warriors as no longer being wizards, so that their casting Animate Dead is an intrinsic ability, and the above rule will apply when the skeletal warrior is a gift of Yredelemnul; if the skeletal warrior abandons you due to your abandoning Yredelemnul, its zombies will abandon you too. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8951 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/mon-data.h2
-rw-r--r--crawl-ref/source/mstuff2.cc49
2 files changed, 33 insertions, 18 deletions
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index c0cd01af09..6895e96b81 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -1615,7 +1615,7 @@ static monsterentry mondata[] = {
{
MONS_SKELETAL_WARRIOR, 'z', CYAN, "skeletal warrior",
- M_FIGHTER | M_SPELLCASTER | M_ACTUAL_SPELLS | M_EVIL,
+ M_FIGHTER | M_SPELLCASTER | M_EVIL,
MR_RES_POISON | MR_RES_COLD,
0, 10, MONS_SKELETAL_WARRIOR, MONS_SKELETAL_WARRIOR, MH_UNDEAD, -7,
{ {AT_HIT, AF_PLAIN, 25}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index e37c461e8a..3ce480cd8a 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -176,6 +176,15 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
if (do_noise)
mons_cast_noise(monster, pbolt, spell_cast);
+ // If the monster's a priest, assume summons come from priestly
+ // abilities, in which case they'll have the same god. If the
+ // monster is neither a priest nor a wizard, assume summons come
+ // from intrinsic abilities, in which case they'll also have the
+ // same god.
+ const bool priest = mons_class_flag(monster->type, M_PRIEST);
+ const bool wizard = mons_class_flag(monster->type, M_ACTUAL_SPELLS);
+ god_type god = (priest || !(priest || wizard)) ? monster->god : GOD_NO_GOD;
+
switch (spell_cast)
{
default:
@@ -217,7 +226,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(mon, SAME_ATTITUDE(monster),
- 5, spell_cast, monster->pos(), monster->foe));
+ 5, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -231,7 +240,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(RANDOM_MONSTER, SAME_ATTITUDE(monster),
- 5, spell_cast, monster->pos(), monster->foe));
+ 5, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -244,8 +253,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
create_monster(
- mgen_data(MONS_WATER_ELEMENTAL, SAME_ATTITUDE(monster), 3,
- spell_cast, monster->pos(), monster->foe));
+ mgen_data(MONS_WATER_ELEMENTAL, SAME_ATTITUDE(monster),
+ 3, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -256,7 +265,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_RAKSHASA_FAKE, SAME_ATTITUDE(monster),
- 3, spell_cast, monster->pos(), monster->foe));
+ 3, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
@@ -272,7 +281,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,
- monster->pos(), monster->foe));
+ monster->pos(), monster->foe, 0, god));
}
return;
@@ -291,14 +300,15 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(mon, SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe, 0,
+ god));
}
return;
case SPELL_ANIMATE_DEAD:
// see special handling in monstuff::handle_spell() {dlb}
animate_dead(monster, 5 + random2(5), SAME_ATTITUDE(monster),
- monster->foe);
+ monster->foe, god);
return;
case SPELL_CALL_IMP: // class 5 demons
@@ -310,7 +320,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(summon_any_demon(DEMON_LESSER),
SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe, 0,
+ god));
}
return;
@@ -325,7 +336,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_SCORPION, SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe, 0,
+ god));
}
return;
@@ -338,20 +350,21 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
{
create_monster(
mgen_data(MONS_UFETUBUS, SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe, 0,
+ god));
}
return;
case SPELL_SUMMON_BEAST: // Geryon
create_monster(
mgen_data(MONS_BEAST, SAME_ATTITUDE(monster),
- 4, spell_cast, monster->pos(), monster->foe));
+ 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),
- 5, spell_cast, monster->pos(), monster->foe));
+ 5, spell_cast, monster->pos(), monster->foe, 0, god));
return;
case SPELL_SUMMON_MUSHROOMS: // Summon swarms of icky crawling fungi.
@@ -365,7 +378,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));
+ duration, spell_cast, monster->pos(), monster->foe, 0,
+ god));
}
return;
@@ -386,7 +400,7 @@ 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));
+ 2, spell_cast, monster->pos(), monster->foe, 0, god));
}
return;
}
@@ -417,7 +431,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(summon_any_demon(DEMON_GREATER),
SAME_ATTITUDE(monster),
- duration, spell_cast, monster->pos(), monster->foe));
+ duration, spell_cast, monster->pos(), monster->foe,
+ 0, god));
}
return;
@@ -452,7 +467,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
create_monster(
mgen_data(monsters[i], SAME_ATTITUDE(monster),
duration, spell_cast,
- monster->pos(), monster->foe));
+ monster->pos(), monster->foe, 0, god));
}
}
return;