From 89841b59408fd59cf9b5b6c06b727df27df486f9 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 6 May 2009 05:54:17 +0000 Subject: 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 --- crawl-ref/source/monstuff.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') 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); -- cgit v1.2.3-54-g00ecf