diff options
-rw-r--r-- | crawl-ref/source/spells4.cc | 23 | ||||
-rw-r--r-- | crawl-ref/source/spells4.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/spl-data.h | 2 |
4 files changed, 12 insertions, 24 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 31b1ad7c4c..d9be443673 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1705,25 +1705,15 @@ void cast_snake_charm(int pow) apply_one_neighbouring_square(_snake_charm_monsters, pow); } -void cast_fragmentation(int pow) // jmf: ripped idea from airstrike +bool cast_fragmentation(int pow, const dist& spd) { bolt beam; - dist spd; int debris = 0; int trap; bool explode = false; bool hole = true; const char *what = NULL; - mpr("Fragment what (e.g. a wall or monster)?", MSGCH_PROMPT); - direction(spd, DIR_TARGET, TARG_ENEMY); - - if (!spd.isValid) - { - canned_msg(MSG_SPELL_FIZZLES); - return; - } - //FIXME: If (player typed '>' to attack floor) goto do_terrain; beam.beam_source = MHITYOU; beam.thrower = KILL_YOU; @@ -1745,12 +1735,8 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike if (mon != NON_MONSTER) { - // This needs its own hand_buff... we also need to do it first - // in case the target dies. -- bwr - char explode_msg[INFO_SIZE]; - - snprintf(explode_msg, sizeof(explode_msg), "%s explodes!", - menv[mon].name(DESC_CAP_THE).c_str()); + // Save this message in case the monster isn't available later. + std::string explode_msg = menv[mon].name(DESC_CAP_THE) + " explodes!"; switch (menv[mon].type) { @@ -1872,7 +1858,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike goto do_terrain; } - mpr(explode_msg); + mpr(explode_msg.c_str()); goto all_done; } @@ -2046,6 +2032,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike // If damage dice are zero we assume that nothing happened at all. canned_msg(MSG_SPELL_FIZZLES); } + return true; } void cast_twist(int pow) diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h index 74119aa1b4..e4ed0d3977 100644 --- a/crawl-ref/source/spells4.h +++ b/crawl-ref/source/spells4.h @@ -33,7 +33,7 @@ void cast_discharge(int pow); bool cast_evaporate(int pow, bolt& beem, int potion); void cast_fulsome_distillation(int powc); void cast_forescry(int pow); -void cast_fragmentation(int powc); +bool cast_fragmentation(int powc, const dist& spd); void cast_twist(int powc); void cast_far_strike(int powc); void cast_swap(int powc); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 3997032251..8416d55c61 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -989,8 +989,8 @@ static void _try_monster_cast(spell_type spell, int powc, // Others are currently unused or unimplemented. spret_type your_spells(spell_type spell, int powc, bool allow_fail) { - struct dist spd; - struct bolt beam; + dist spd; + bolt beam; // [dshaligram] Any action that depends on the spellcasting attempt to have // succeeded must be performed after the switch(). @@ -1009,7 +1009,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) if ((flags & SPFLAG_TARGETING_MASK) && spell != SPELL_BURN && spell != SPELL_FREEZE && spell != SPELL_CRUSH && spell != SPELL_ARC - && spell != SPELL_FRAGMENTATION && spell != SPELL_PORTAL_PROJECTILE) + && spell != SPELL_PORTAL_PROJECTILE) { targ_mode_type targ = (testbits(flags, SPFLAG_HELPFUL) ? TARG_FRIEND : TARG_ENEMY); @@ -1447,7 +1447,8 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) break; case SPELL_FRAGMENTATION: - cast_fragmentation(powc); + if (!cast_fragmentation(powc, spd)) + return (SPRET_ABORT); break; case SPELL_FAR_STRIKE: diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h index 300b8b123c..976c18f506 100644 --- a/crawl-ref/source/spl-data.h +++ b/crawl-ref/source/spl-data.h @@ -2085,7 +2085,7 @@ SPFLAG_GRID, 5, 200, - NULL, + "Fragment what (e.g. a wall or monster)?", false, false }, |