diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-08 19:36:11 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-08 19:36:11 -0600 |
commit | f56ece6c5f981cc67d2f4f492cb5395e5f08c444 (patch) | |
tree | 92f5b7491c90902d7a78f6e830d66927221e9187 /crawl-ref/source/fineff.cc | |
parent | 6dece555467dd88867af88096edc12507507293e (diff) | |
download | crawl-ref-f56ece6c5f981cc67d2f4f492cb5395e5f08c444.tar.gz crawl-ref-f56ece6c5f981cc67d2f4f492cb5395e5f08c444.zip |
Make rakshasa defense cloning a fineff and take energy (elliptic).
Prevents crashes related to tornado and monster positioning.
Diffstat (limited to 'crawl-ref/source/fineff.cc')
-rw-r--r-- | crawl-ref/source/fineff.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc index 6b0a743efa..0f0eee2ba5 100644 --- a/crawl-ref/source/fineff.cc +++ b/crawl-ref/source/fineff.cc @@ -14,6 +14,7 @@ #include "mgen_data.h" #include "misc.h" #include "mon-abil.h" +#include "mon-cast.h" #include "mon-place.h" #include "ouch.h" #include "religion.h" @@ -99,6 +100,13 @@ bool delayed_action_fineff::mergeable(const final_effect &fe) const return false; } +bool rakshasa_clone_fineff::mergeable(const final_effect &fe) const +{ + const rakshasa_clone_fineff *o = + dynamic_cast<const rakshasa_clone_fineff *>(&fe); + return o && att == o->att && def == o->def && posn == o->posn; +} + void mirror_damage_fineff::merge(const final_effect &fe) { const mirror_damage_fineff *mdfe = @@ -328,6 +336,28 @@ void kirke_death_fineff::fire() untransform(); } +void rakshasa_clone_fineff::fire() +{ + actor *defend = defender(); + if (!defend) + return; + + monster *rakshasa = defend->as_monster(); + ASSERT(rakshasa); + + // Using SPELL_NO_SPELL to prevent overwriting normal clones + cast_phantom_mirror(rakshasa, rakshasa, 50, SPELL_NO_SPELL); + cast_phantom_mirror(rakshasa, rakshasa, 50, SPELL_NO_SPELL); + rakshasa->lose_energy(EUT_SPELL); + + if (you.can_see(rakshasa)) + { + mprf(MSGCH_MONSTER_SPELL, + "The injured %s weaves a defensive illusion!", + rakshasa->name(DESC_PLAIN).c_str()); + } +} + // Effects that occur after all other effects, even if the monster is dead. // For example, explosions that would hit other creatures, but we want // to deal with only one creature at a time, so that's handled last. |