summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-cast.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-11 21:38:55 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-04-11 21:42:03 -0600
commit43baa798a097801a07679619b9d380e2054f32cb (patch)
treea1e7f395ea35cceee25df88b4b9cffe1166bc866 /crawl-ref/source/mon-cast.cc
parent49da4dfdf67fbb3f789e802a800de63b3e4ecdc6 (diff)
downloadcrawl-ref-43baa798a097801a07679619b9d380e2054f32cb.tar.gz
crawl-ref-43baa798a097801a07679619b9d380e2054f32cb.zip
Give several area(-ish) spells tracers.
So that they can be cast without being in LOS of the player under appropriate circumstances; thus a check for being in LOS of the player for these and a few other spells are gone. The major candidate here is Symbol of Torment, which can now be used against your allies even if you're torment-immune or you're not in LOS; spells which previously didn't have a tracer of some sort that do now are Chain Lightning and Chain of Chaos (for whatever good it does), and spells that can now be cast anywhere are Ozocubu's Refrigeration, Tornado, and Shatter. Related is a fix for getting a more if Chain Lightning is cast anywhere by anyone regardless of if you saw it or not (now you only get the more if you saw the lightning arc at all).
Diffstat (limited to 'crawl-ref/source/mon-cast.cc')
-rw-r--r--crawl-ref/source/mon-cast.cc70
1 files changed, 48 insertions, 22 deletions
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 4057ce14de..afd816d0ad 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1553,7 +1553,6 @@ static bool _ms_waste_of_time(const monster* mon, spell_type monspell)
// fall through
case SPELL_BOLT_OF_DRAINING:
case SPELL_AGONY:
- case SPELL_SYMBOL_OF_TORMENT:
case SPELL_MALIGN_OFFERING:
if (!foe || _foe_should_res_negative_energy(foe))
ret = true;
@@ -2609,16 +2608,13 @@ monster* cast_phantom_mirror(monster* mons, monster* targ, int hp_perc, int summ
return mirror;
}
-static bool _should_tornado(monster* agent)
+static bool _trace_los(monster* agent, bool (*vulnerable)(actor*))
{
- if (agent->has_ench(ENCH_TORNADO) || agent->has_ench(ENCH_TORNADO_COOLDOWN))
- return false;
-
bolt tracer;
tracer.foe_ratio = 80;
for (actor_near_iterator ai(agent, LOS_NO_TRANS); ai; ++ai)
{
- if (agent == *ai || ai->res_wind() || !ai->visible_to(agent))
+ if (agent == *ai || !agent->can_see(*ai) || !vulnerable(*ai))
continue;
if (mons_aligned(agent, *ai))
@@ -2639,6 +2635,37 @@ static bool _should_tornado(monster* agent)
return mons_should_fire(tracer);
}
+static bool _tornado_vulnerable(actor* victim)
+{
+ return !victim->res_wind();
+}
+
+static bool _should_tornado(monster* agent)
+{
+ if (agent->has_ench(ENCH_TORNADO) || agent->has_ench(ENCH_TORNADO_COOLDOWN))
+ return false;
+
+ return _trace_los(agent, _tornado_vulnerable);
+}
+
+static bool _torment_vulnerable(actor* victim)
+{
+ if (victim->is_player())
+ return !player_res_torment(true, false);
+
+ return !victim->res_torment();
+}
+
+static bool _elec_vulnerable(actor* victim)
+{
+ return (victim->res_elec() < 3);
+}
+
+static bool _dummy_vulnerable(actor* victim)
+{
+ return true;
+}
+
static bool _should_ephemeral_infusion(monster* agent)
{
if (agent->has_ench(ENCH_EPHEMERAL_INFUSION)
@@ -3361,6 +3388,21 @@ bool handle_mon_spell(monster* mons, bolt &beem)
return false;
}
}
+ else if (spell_cast == SPELL_SYMBOL_OF_TORMENT)
+ {
+ if (!_trace_los(mons, _torment_vulnerable))
+ return false;
+ }
+ else if (spell_cast == SPELL_CHAIN_LIGHTNING)
+ {
+ if (!_trace_los(mons, _elec_vulnerable))
+ return false;
+ }
+ else if (spell_cast == SPELL_CHAIN_OF_CHAOS)
+ {
+ if (!_trace_los(mons, _dummy_vulnerable))
+ return false;
+ }
if (mons->type == MONS_BALL_LIGHTNING)
mons->suicide();
@@ -4249,9 +4291,6 @@ static void _mons_create_tentacles(monster* head)
static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast)
{
- // single calculation permissible {dlb}
- bool monsterNearby = mons_near(mons);
-
switch (spell_cast)
{
case SPELL_ANIMATE_DEAD:
@@ -4261,19 +4300,6 @@ static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast)
return true;
break;
- case SPELL_CHAIN_LIGHTNING:
- case SPELL_SYMBOL_OF_TORMENT:
- case SPELL_OZOCUBUS_REFRIGERATION:
- case SPELL_SHATTER:
- case SPELL_TORNADO:
- case SPELL_CHAIN_OF_CHAOS:
-#if TAG_MAJOR_VERSION == 34
- case SPELL_REARRANGE_PIECES:
-#endif
- if (!monsterNearby)
- return true;
- break;
-
default:
break;
}