diff options
author | gammafunk <gammafunk@gmail.com> | 2014-03-05 22:39:13 -0600 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-03-06 11:47:33 -0600 |
commit | 2f0dee958f5c89741639812ce72daf06e96ad4f0 (patch) | |
tree | 7a16e63e5661598b38c2a2bb7f1858dadffca19b /crawl-ref/source/spl-damage.cc | |
parent | 5a102a04c5b39f33ebbe846f20f302ec80e34798 (diff) | |
download | crawl-ref-2f0dee958f5c89741639812ce72daf06e96ad4f0.tar.gz crawl-ref-2f0dee958f5c89741639812ce72daf06e96ad4f0.zip |
Allow ghost casting of dazzling spray (Grunt).
Player ghosts can now have dazzling spray, which sets confusion based
on an XL check that's the same as used when blinding monsters.
This commit is mostly based on Grunt's commit 0d12a004 in the
glaciate-testing branch and cleaned up some for trunk, with some
aspects reorganized.
Diffstat (limited to 'crawl-ref/source/spl-damage.cc')
-rw-r--r-- | crawl-ref/source/spl-damage.cc | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc index 3212dcc786..9b4b908284 100644 --- a/crawl-ref/source/spl-damage.cc +++ b/crawl-ref/source/spl-damage.cc @@ -2615,7 +2615,8 @@ vector<bolt> get_spray_rays(const actor *caster, coord_def aim, int range, bolt base_beam; base_beam.set_agent(const_cast<actor *>(caster)); - base_beam.attitude = ATT_FRIENDLY; + base_beam.attitude = caster->is_player() ? ATT_FRIENDLY + : caster->as_monster()->attitude; base_beam.is_tracer = true; base_beam.is_targeting = true; base_beam.dont_stop_player = true; @@ -2705,9 +2706,7 @@ static bool _dazzle_can_hit(const actor *act) testbeam.thrower = KILL_YOU; zappy(ZAP_DAZZLING_SPRAY, 100, testbeam); - return mons->type != MONS_BATTLESPHERE - && mons->type != MONS_ORB_OF_DESTRUCTION - && mons->type != MONS_GRAND_AVATAR + return !mons_is_avatar(mons->type) && mons_species(mons->type) != MONS_BUSH && !fedhas_shoot_through(testbeam, mons); } @@ -2715,34 +2714,27 @@ static bool _dazzle_can_hit(const actor *act) return false; } -spret_type cast_dazzling_spray(actor *caster, int pow, coord_def aim, bool fail) +spret_type cast_dazzling_spray(int pow, coord_def aim, bool fail) { int range = spell_range(SPELL_DAZZLING_SPRAY, pow); targetter_spray hitfunc(&you, range, ZAP_DAZZLING_SPRAY); - hitfunc.set_aim(aim); - - if (caster->is_player()) - { - if (stop_attack_prompt(hitfunc, "fire towards", _dazzle_can_hit)) - return SPRET_ABORT; - } + if (stop_attack_prompt(hitfunc, "fire towards", _dazzle_can_hit)) + return SPRET_ABORT; fail_check(); - vector<bolt> beams = get_spray_rays(caster, aim, range, 3); - - if (beams.size() == 0) + if (hitfunc.beams.size() == 0) { mpr("You can't see any targets in that direction!"); return SPRET_ABORT; } - for (unsigned int i = 0; i < beams.size(); ++i) + for (unsigned int i = 0; i < hitfunc.beams.size(); ++i) { - zappy(ZAP_DAZZLING_SPRAY, pow, beams[i]); - beams[i].fire(); + zappy(ZAP_DAZZLING_SPRAY, pow, hitfunc.beams[i]); + hitfunc.beams[i].fire(); } return SPRET_SUCCESS; |