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/abl-show.cc | 2 +- crawl-ref/source/effects.cc | 58 ++++++++++++++++++++++++++++++++++++-------- crawl-ref/source/effects.h | 6 +++-- crawl-ref/source/enum.h | 3 ++- crawl-ref/source/it_use3.cc | 16 +----------- crawl-ref/source/item_use.cc | 4 +-- crawl-ref/source/religion.cc | 2 +- crawl-ref/source/spl-cast.cc | 2 +- 8 files changed, 60 insertions(+), 33 deletions(-) diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 39e1874f49..b64bb41064 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1504,7 +1504,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_TSO_CLEANSING_FLAME: cleansing_flame(10 + (you.skills[SK_INVOCATIONS] * 7) / 6, - CLEANSING_FLAME_INVOCATION); + CLEANSING_FLAME_INVOCATION, you.pos(), &you); exercise(SK_INVOCATIONS, 3 + random2(6)); break; 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(); } diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h index 5b17185d33..2249572fe5 100644 --- a/crawl-ref/source/effects.h +++ b/crawl-ref/source/effects.h @@ -115,9 +115,11 @@ int torment_player(int pow, int caster); int torment_monsters(coord_def where, int pow, int caster, actor *attacker = NULL); -void immolation(int caster, bool known = false); +void immolation(int pow, int caster, coord_def where, bool known = false, + actor *attacker = NULL); -void cleansing_flame(int pow, int caster); +void cleansing_flame(int pow, int caster, coord_def where, + actor *attacker = NULL); // called from: debug void change_labyrinth(bool msg = false); diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 73809b4a37..3d3112240e 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1351,7 +1351,8 @@ enum immolation_source_type { IMMOLATION_GENERIC = -1, IMMOLATION_SCROLL = -2, - IMMOLATION_SPELL = -3 // effect when fixing fire brand + IMMOLATION_SPELL = -3, // effect when fixing fire brand + IMMOLATION_TOME = -4 // exploding Tome of Destruction }; enum item_status_flag_type // per item flags: ie. ident status, cursed status diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 05163765e5..29ca64e595 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -885,21 +885,7 @@ void tome_of_power(int slot) dec_inv_item_quantity( slot, 1 ); } - bolt beam; - - beam.flavour = BEAM_FIRE; - beam.type = dchar_glyph(DCHAR_FIRED_BURST); - beam.damage = dice_def(3, 15); - beam.target = you.pos(); - beam.name = "fiery explosion"; - beam.colour = RED; - beam.beam_source = NON_MONSTER; - beam.thrower = KILL_YOU; - beam.aux_source = "an exploding Tome of Destruction"; - beam.ex_size = 2; - beam.is_explosion = true; - - beam.explode(); + immolation(15, IMMOLATION_TOME, you.pos(), false, &you); xom_is_stimulated(255); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 882845c031..0dd08b3ef8 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4290,7 +4290,7 @@ static bool _vorpalise_weapon() case SPWPN_FLAMING: mprf("%s is engulfed in an explosion of flames!", itname.c_str()); - immolation(IMMOLATION_SPELL); + immolation(10, IMMOLATION_SPELL, you.pos(), true, &you); break; case SPWPN_FREEZING: @@ -4908,7 +4908,7 @@ void read_scroll(int slot) set_ident_type(scroll, ID_KNOWN_TYPE); dec_inv_item_quantity(item_slot, 1); - immolation(IMMOLATION_SCROLL, alreadyknown); + immolation(10, IMMOLATION_SCROLL, you.pos(), alreadyknown, &you); break; } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 5ffde17d8f..72b698999b 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -5562,7 +5562,7 @@ static void _tso_blasts_cleansing_flame(const char *message) GOD_SHINING_ONE); cleansing_flame(20 + (you.experience_level * 7) / 3, - CLEANSING_FLAME_TSO); + CLEANSING_FLAME_TSO, you.pos()); } } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 6874c78590..5666a7ffc5 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1354,7 +1354,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) break; case SPELL_FLAME_OF_CLEANSING: - cleansing_flame(powc, CLEANSING_FLAME_SPELL); + cleansing_flame(powc, CLEANSING_FLAME_SPELL, you.pos(), &you); break; case SPELL_HOLY_WORD: -- cgit v1.2.3-54-g00ecf