summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-06 05:54:17 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-06 05:54:17 +0000
commit89841b59408fd59cf9b5b6c06b727df27df486f9 (patch)
tree91a84c5e4eb36a27bfe9171e1121b1ddeddaeff9 /crawl-ref/source/monstuff.cc
parent30bbc25a50b9c7ab64c013370382c69b9c671f3a (diff)
downloadcrawl-ref-89841b59408fd59cf9b5b6c06b727df27df486f9.tar.gz
crawl-ref-89841b59408fd59cf9b5b6c06b727df27df486f9.zip
And properly check for being a shapeshifter when looking at a
polymorphed monster's god and god gift status. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9737 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 1d8caadf15..fc5f8db6a1 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2038,15 +2038,6 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
| MF_WAS_IN_VIEW | MF_BAND_MEMBER
| MF_HONORARY_UNDEAD | MF_KNOWN_MIMIC);
- god_type god =
- (player_will_anger_monster(targetc)
- || (you.religion == GOD_BEOGH
- && mons_species(targetc) != MONS_ORC)) ? GOD_NO_GOD
- : monster->god;
-
- if (god == GOD_NO_GOD)
- flags &= ~MF_GOD_GIFT;
-
std::string name;
// Preserve the names of uniques and named monsters.
@@ -2074,6 +2065,20 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
name = name.substr(0, the_pos);
}
+ const monster_type real_targetc =
+ (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER)) ? MONS_GLOWING_SHAPESHIFTER :
+ (monster->has_ench(ENCH_SHAPESHIFTER)) ? MONS_SHAPESHIFTER
+ : targetc;
+
+ const god_type god =
+ (player_will_anger_monster(real_targetc)
+ || (you.religion == GOD_BEOGH
+ && mons_species(real_targetc) != MONS_ORC)) ? GOD_NO_GOD
+ : monster->god;
+
+ if (god == GOD_NO_GOD)
+ flags &= ~MF_GOD_GIFT;
+
const int old_hp = monster->hit_points;
const int old_hp_max = monster->max_hit_points;
const bool old_mon_caught = mons_is_caught(monster);
@@ -2095,9 +2100,9 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
// Note: define_monster() will clear out all enchantments! - bwr
define_monster(monster_index(monster));
+ monster->mname = name;
monster->flags = flags;
monster->god = god;
- monster->mname = name;
monster->add_ench(abj);
monster->add_ench(charm);