summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/actor.cc
diff options
context:
space:
mode:
authorDracoOmega <draco_omega@live.com>2013-03-25 19:50:46 -0230
committerDracoOmega <draco_omega@live.com>2013-03-26 18:28:18 -0230
commitfe8e7753e0a0bc8a1512ad693682eae0f71f0d4f (patch)
treed4b775e6eee7445e6e887ffe54612f11b83be736 /crawl-ref/source/actor.cc
parentb325f1192e333a32ffe218480a105306f7e3bc28 (diff)
downloadcrawl-ref-fe8e7753e0a0bc8a1512ad693682eae0f71f0d4f.tar.gz
crawl-ref-fe8e7753e0a0bc8a1512ad693682eae0f71f0d4f.zip
Don't leak item information when targetting monsters with agony or hibernation
Recent changes to tracers meant that monsters whose rN+ or rC+ came solely from equipment would still be considered invalid targets for those spells, even when the player had no way to know they were immune. Now the tracer only considers intrinsic resistances when determining validity for these effects.
Diffstat (limited to 'crawl-ref/source/actor.cc')
-rw-r--r--crawl-ref/source/actor.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index bcd59d5207..2db9fa1280 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -158,7 +158,7 @@ void actor::set_position(const coord_def &c)
areas_actor_moved(this, oldpos);
}
-bool actor::can_hibernate(bool holi_only) const
+bool actor::can_hibernate(bool holi_only, bool intrinsic_only) const
{
// Undead, nonliving, and plants don't sleep.
const mon_holy_type holi = holiness();
@@ -172,11 +172,15 @@ bool actor::can_hibernate(bool holi_only) const
return false;
// The monster is cold-resistant and can't be hibernated.
- if (res_cold() > 0)
+ if (intrinsic_only && is_monster()
+ ? get_mons_resist(this->as_monster(), MR_RES_COLD)
+ : res_cold() > 0)
+ {
return false;
+ }
// The monster has slept recently.
- if (is_monster()
+ if (is_monster() && !intrinsic_only
&& static_cast<const monster* >(this)->has_ench(ENCH_SLEEP_WARY))
{
return false;