diff options
author | Charles Otto <ottochar@gmail.com> | 2009-11-06 21:31:29 -0500 |
---|---|---|
committer | Charles Otto <ottochar@gmail.com> | 2009-11-06 21:45:52 -0500 |
commit | 799b97da52e06001a68b482049ac1a72fcb16bb8 (patch) | |
tree | b9959027bf630fdcdd702c3b22627ea3e54413c2 /crawl-ref/source/monster.cc | |
parent | eef51d7a1ec7ce7e471d76f82154d2b147d6228b (diff) | |
download | crawl-ref-799b97da52e06001a68b482049ac1a72fcb16bb8.tar.gz crawl-ref-799b97da52e06001a68b482049ac1a72fcb16bb8.zip |
Simplify rain and sunlight a bit
Use dungeon_terrain_changed in rain and sunlight, inflict and remove
ENCH_AQUATIC_LAND solely in monsters::apply_location_effects.
Make sunlight alert monsters it affects.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r-- | crawl-ref/source/monster.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index e077ca32da..c04cbbc9a4 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -5262,6 +5262,12 @@ void monsters::apply_location_effects(const coord_def &oldpos) if (oldpos != pos()) dungeon_events.fire_position_event(DET_MONSTER_MOVED, pos()); + if (alive() && mons_habitat(this) == HT_WATER + && !feat_is_watery( grd(pos()) ) && !has_ench(ENCH_AQUATIC_LAND)) + { + add_ench(ENCH_AQUATIC_LAND); + } + if (alive() && has_ench(ENCH_AQUATIC_LAND)) { if (!feat_is_watery( grd(pos()) )) @@ -5271,6 +5277,11 @@ void monsters::apply_location_effects(const coord_def &oldpos) simple_monster_message(this, " dives back into the water!"); del_ench(ENCH_AQUATIC_LAND); } + // This may have been called via dungeon_terrain_changed instead + // of by the monster moving move, in that case grd(oldpos) will + // be the current position that became watery. + else + del_ench(ENCH_AQUATIC_LAND); } // Monsters stepping on traps: |