diff options
author | gammafunk <gammafunk@gmail.com> | 2014-02-08 23:00:37 -0600 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-02-19 14:10:28 -0500 |
commit | 8ffe610920d44e5fe190486d4474423c4873d4bf (patch) | |
tree | b0d7d26a05e5e84a648bafd5452ec4b92c8077c4 /crawl-ref/source/mon-ench.cc | |
parent | 505844037e126713064bddb149652d0ae7f3d042 (diff) | |
download | crawl-ref-8ffe610920d44e5fe190486d4474423c4873d4bf.tar.gz crawl-ref-8ffe610920d44e5fe190486d4474423c4873d4bf.zip |
Convert alignment of a monster avatar when its summoner's alignment changes.
When the alignment of the summoner of a spectral weapon, battlesphere,
or grand avatar changes, previously these avatars were not changing
alignment along with the summoner. This adds monster::align_avatars()
which is called appropriately in mons_att_changed() and in
monster::add_ench() for the case of ENCH_CHARM. When summoners go to
any form of ATT_*NEUTRAL, we remove all their avatars. For grand
avatars, I've added an end_grand_avatar() function to help with this.
Monsters with ENCH_GRAND_AVATAR that change attitude but who are not the
summoner also lose that enchantment. This also adds
monster::remove_avatars() which is called by ::align_avatars() when
necessary as well as when a monster's soul is enslaved.
There is also a bugfix in setting of ENCH_GRAND_AVATAR upon casting
where it would skip setting enchantment on the summoner if summoner was
charmed. Always set the enchant on the owner, and never set the enchant
on any kind of avatar to avoid having an avatar of an avatar.
Diffstat (limited to 'crawl-ref/source/mon-ench.cc')
-rw-r--r-- | crawl-ref/source/mon-ench.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc index c2cfb58ecd..c2160955ef 100644 --- a/crawl-ref/source/mon-ench.cc +++ b/crawl-ref/source/mon-ench.cc @@ -151,6 +151,8 @@ bool monster::add_ench(const mon_enchant &ench) if (new_enchantment) add_enchantment_effect(ench); + if (ench.ench == ENCH_CHARM) + this->align_avatars(true); return true; } @@ -1726,6 +1728,7 @@ void monster::apply_enchantment(const mon_enchant &me) // Severed tentacles immediately become "hostile" to everyone (or insane) attitude = ATT_NEUTRAL; + mons_att_changed(this); behaviour_event(this, ME_ALERT); } } @@ -1750,6 +1753,7 @@ void monster::apply_enchantment(const mon_enchant &me) } attitude = ATT_HOSTILE; + mons_att_changed(this); behaviour_event(this, ME_ALERT, &you); } } |