From f2e1abc584a801b0ebf3c595d63752f5eda7708b Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 19 Jan 2009 21:59:56 +0000 Subject: Expand immolation and cleansing flame as well, so that monsters may be able to use scrolls of immolation or holy word in the future. Also, add a power parameter to immolation, so that it can be reused for an exploding Tome of Destruction. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8599 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/effects.cc | 58 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'crawl-ref/source/effects.cc') diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 5ffd192a96..e35c802bfa 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -290,7 +290,8 @@ int torment(int caster, const coord_def& where) return apply_area_within_radius(torment_monsters, where, 0, 8, caster); } -void immolation(int caster, bool known) +void immolation(int pow, int caster, coord_def where, bool known, + actor *attacker) { ASSERT(!crawl_state.arena); @@ -309,27 +310,49 @@ void immolation(int caster, bool known) case IMMOLATION_SPELL: aux = "a fiery explosion"; break; + + case IMMOLATION_TOME: + aux = "an exploding Tome of Destruction"; + break; } } beam.flavour = BEAM_FIRE; beam.type = dchar_glyph(DCHAR_FIRED_BURST); - beam.damage = dice_def(3, 10); - beam.target = you.pos(); + beam.damage = dice_def(3, pow); + beam.target = where; beam.name = "fiery explosion"; beam.colour = RED; - beam.beam_source = NON_MONSTER; - beam.thrower = (caster == IMMOLATION_GENERIC) ? KILL_MISC : KILL_YOU; beam.aux_source = aux; beam.ex_size = 2; beam.is_explosion = true; beam.effect_known = known; beam.affects_items = (caster != IMMOLATION_SCROLL); + const monsters *atk = (attacker->atype() == ACT_PLAYER ? NULL : + dynamic_cast(attacker)); + + if (caster == IMMOLATION_GENERIC) + { + beam.thrower = KILL_MISC; + beam.beam_source = NON_MONSTER; + } + else if (attacker == NULL) + { + beam.thrower = KILL_YOU; + beam.beam_source = NON_MONSTER; + } + else + { + beam.thrower = KILL_MON; + beam.beam_source = monster_index(atk); + } + beam.explode(); } -void cleansing_flame(int pow, int caster) +void cleansing_flame(int pow, int caster, coord_def where, + actor *attacker) { ASSERT(!crawl_state.arena); @@ -353,14 +376,29 @@ void cleansing_flame(int pow, int caster) beam.target = you.pos(); beam.name = "golden flame"; beam.colour = YELLOW; - beam.thrower = (caster == CLEANSING_FLAME_GENERIC - || caster == CLEANSING_FLAME_TSO) ? KILL_MISC - : KILL_YOU; - beam.beam_source = NON_MONSTER; beam.aux_source = aux; beam.ex_size = 2; beam.is_explosion = true; + const monsters *atk = (attacker->atype() == ACT_PLAYER ? NULL : + dynamic_cast(attacker)); + + if (caster == CLEANSING_FLAME_GENERIC || caster == CLEANSING_FLAME_TSO) + { + beam.thrower = KILL_MISC; + beam.beam_source = NON_MONSTER; + } + else if (attacker == NULL) + { + beam.thrower = KILL_YOU; + beam.beam_source = NON_MONSTER; + } + else + { + beam.thrower = KILL_MON; + beam.beam_source = monster_index(atk); + } + beam.explode(); } -- cgit v1.2.3-54-g00ecf