diff options
author | Neil Moore <neil@s-z.org> | 2014-06-12 02:30:47 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-06-12 02:36:19 -0400 |
commit | 352b8da163952f4bd56d7940e0f86cce3ac13709 (patch) | |
tree | 10a22fca9d1b2855b1dd925019d5df12ff2f1473 /crawl-ref/source/mon-act.cc | |
parent | 839c364f86fcf7fc7ac1f896c97b3a352e247bd4 (diff) | |
download | crawl-ref-352b8da163952f4bd56d7940e0f86cce3ac13709.tar.gz crawl-ref-352b8da163952f4bd56d7940e0f86cce3ac13709.zip |
Make monsters target lightning/cloud rod reasonably.
We were calculating (with _thunderbolt_tracer or mons_should_cloud_cone)
whether the monster should fire---then ignoring the result for those two
spells and always firing. Furthermore, mons_should_cloud_cone used a
foe_ratio of zero, meaning it wouldn't care about collateral hits at all.
Always use the result of the tracer to decide whether to zap,
refactoring the surrounding code a bit in the process. Also, have
mons_should_cloud_cone set a foe_ratio (the default 80), as well as a
few other bolt members used by mons_should_fire.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r-- | crawl-ref/source/mon-act.cc | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 452f229127..355f2506fc 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -1240,7 +1240,6 @@ static bool _handle_rod(monster *mons, bolt &beem) bool was_visible = you.can_see(mons); bool check_validity = true; - bool is_direct_effect = false; spell_type mzap = SPELL_NO_SPELL; int rate = 0; @@ -1315,32 +1314,19 @@ static bool _handle_rod(monster *mons, bolt &beem) zap = mons_should_fire(beem); } - if (is_direct_effect) - { - actor* foe = mons->get_foe(); - if (!foe) - return false; - _rod_fired_pre(mons); - direct_effect(mons, mzap, beem, foe); - return _rod_fired_post(mons, rod, weapon, beem, rate, was_visible); - } - else if (mzap == SPELL_THUNDERBOLT) + + if (zap) { _rod_fired_pre(mons); - cast_thunderbolt(mons, power, beem.target); - return _rod_fired_post(mons, rod, weapon, beem, rate, was_visible); - } - else if (mzap == SPELL_CLOUD_CONE) - { - _rod_fired_pre(mons); - cast_cloud_cone(mons, power, beem.target); - return _rod_fired_post(mons, rod, weapon, beem, rate, was_visible); - } - else if (zap) - { - _rod_fired_pre(mons); - beem.is_tracer = false; - beem.fire(); + if (mzap == SPELL_THUNDERBOLT) + cast_thunderbolt(mons, power, beem.target); + else if (mzap == SPELL_CLOUD_CONE) + cast_cloud_cone(mons, power, beem.target); + else + { + beem.is_tracer = false; + beem.fire(); + } return _rod_fired_post(mons, rod, weapon, beem, rate, was_visible); } |