summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-06 05:19:06 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-06 05:19:06 +0000
commit30bbc25a50b9c7ab64c013370382c69b9c671f3a (patch)
treef71600420f40232be61cbb305c76be6f3f191a92 /crawl-ref/source/monstuff.cc
parent8929d6cdc7458d79d4ac46751ac0a4851febcf5e (diff)
downloadcrawl-ref-30bbc25a50b9c7ab64c013370382c69b9c671f3a.tar.gz
crawl-ref-30bbc25a50b9c7ab64c013370382c69b9c671f3a.zip
Preserve a monster's god and god gift status when applicable, and
discard them otherwise (when the form the monster is polymorphed into angers its god, or when the monster is a Beoghite orc and is polymorphed into a non-orc). Note that Beoghite orcs polymorphed into non-orcs will still remain friendly if they were friendly before and the force_beh parameter in monster_polymorph() isn't set, but they will no longer count as gifts of Beogh, meaning that Beogh will no longer accept their kills. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9736 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 125739af66..1d8caadf15 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1967,7 +1967,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
relax++;
if (relax > 50)
- return (simple_monster_message( monster, " shudders."));
+ return (simple_monster_message(monster, " shudders."));
}
while (tries-- && (!_valid_morph(monster, targetc)
|| _is_poly_power_unsuitable(power, source_power,
@@ -1975,7 +1975,10 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
}
if (!_valid_morph(monster, targetc))
- return simple_monster_message(monster, " looks momentarily different.");
+ {
+ return (simple_monster_message(monster,
+ " looks momentarily different."));
+ }
// Messaging.
bool can_see = you.can_see(monster);
@@ -2035,6 +2038,15 @@ 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.
@@ -2062,9 +2074,9 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
name = name.substr(0, the_pos);
}
- 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);
+ 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);
const char old_ench_countdown = monster->ench_countdown;
mon_enchant abj = monster->get_ench(ENCH_ABJ);
@@ -2080,10 +2092,11 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
monster->base_monster = MONS_PROGRAM_BUG;
monster->number = 0;
- // Note: define_monster() will clear out all enchantments! -- bwr
- define_monster( monster_index(monster) );
+ // Note: define_monster() will clear out all enchantments! - bwr
+ define_monster(monster_index(monster));
monster->flags = flags;
+ monster->god = god;
monster->mname = name;
monster->add_ench(abj);