diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-20 22:22:17 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-20 22:22:17 -0600 |
commit | b26a5055fa7c9c6c36b3310275c068ca489b1691 (patch) | |
tree | 296433a7e58a5f3ad2b5bdb7d631d8a13804ad56 /crawl-ref/source/mon-cast.cc | |
parent | 0bb430c4f6b3bdd2197d93bc43e6dfd465788ef3 (diff) | |
download | crawl-ref-b26a5055fa7c9c6c36b3310275c068ca489b1691.tar.gz crawl-ref-b26a5055fa7c9c6c36b3310275c068ca489b1691.zip |
Fix an inconsistency in Phantom Mirror target checking.
mons_is_conjured() wasn't checked when actually casting the spell; thus
rakshasas who could see, say, orbs of destruction or battlesphere while
also seeing another nearby target could clone the former.
Diffstat (limited to 'crawl-ref/source/mon-cast.cc')
-rw-r--r-- | crawl-ref/source/mon-cast.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index 804392937b..5ff6c79e28 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -1495,6 +1495,15 @@ static bool _is_breath_caster(monster_type mtyp) || mons_genus(mtyp) == MONS_DRAKE && mtyp != MONS_WIND_DRAKE; } +static bool _mirrorable(const monster* agent, const monster* mon) +{ + return mon != agent + && mons_aligned(mon, agent) + && !mon->is_stationary() + && !mon->is_summoned() + && !mons_is_conjured(mon->type); +} + // Checks to see if a particular spell is worth casting in the first place. static bool _ms_waste_of_time(const monster* mon, spell_type monspell) { @@ -1996,12 +2005,9 @@ static bool _ms_waste_of_time(const monster* mon, spell_type monspell) { for (monster_near_iterator mi(mon); mi; ++mi) { - if (*mi != mon && mons_aligned(*mi, mon) && !mi->is_stationary() - && !mi->is_summoned() && !mons_is_conjured(mi->type)) - { - // A single valid target is enough. + // A single valid target is enough. + if (_mirrorable(mon, *mi)) return false; - } } } return true; @@ -5948,11 +5954,8 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, vector<monster*> targets; for (monster_near_iterator mi(mons); mi; ++mi) { - if (*mi != mons && mons_aligned(*mi, mons) && !mi->is_stationary() - && !mi->is_summoned()) - { + if (_mirrorable(mons, *mi)) targets.push_back(*mi); - } } // If we've found something, mirror it. |