diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2011-07-21 12:44:28 +0000 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2011-07-21 22:25:43 +0200 |
commit | 17dfbce6f42ff75dfefd63ace016e51d9f493aa5 (patch) | |
tree | 3a2819a7823c305f8410711a984a46410cf4c8a7 /crawl-ref/source/spl-monench.cc | |
parent | 6056fee300d2862993780b1bbbc1e9476ac70070 (diff) | |
download | crawl-ref-17dfbce6f42ff75dfefd63ace016e51d9f493aa5.tar.gz crawl-ref-17dfbce6f42ff75dfefd63ace016e51d9f493aa5.zip |
Don't miscast when the spell can still be aborted (#4281).
This is a significant refactoring. All the spells now return a spret_type and
take a boolean which tells if the spell has actually failed.
Also some code clean up in _do_cast(). All spells have their own function now.
Also fix the following bugs:
* Properly abort fire storm if forced casting on a wall with '!'.
Also put a message for forced out of range casting (like cloud spells).
* Casting summon elemental on an invisible monster aborted with no cost.
* if a summoning spell aborts because create_monster fails, you don't lose a
turn. You still get a chance of miscast in this rare case.
* s2s, tukima and branding spells abort properly instead of consuming turn and
MP when player is not wielding appropriate object.
* s2s abort message when wielding a non-snakable.
Diffstat (limited to 'crawl-ref/source/spl-monench.cc')
-rw-r--r-- | crawl-ref/source/spl-monench.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crawl-ref/source/spl-monench.cc b/crawl-ref/source/spl-monench.cc index ac8d78dd29..63c4dfb802 100644 --- a/crawl-ref/source/spl-monench.cc +++ b/crawl-ref/source/spl-monench.cc @@ -46,9 +46,11 @@ static int _sleep_monsters(coord_def where, int pow, int, actor *) return (1); } -void cast_mass_sleep(int pow) +spret_type cast_mass_sleep(int pow, bool fail) { + fail_check(); apply_area_visible(_sleep_monsters, pow, true); + return SPRET_SUCCESS; } bool backlight_monsters(coord_def where, int pow, int garbage) @@ -116,8 +118,10 @@ bool do_slow_monster(monster* mon, const actor* agent) return (false); } -bool project_noise() +// XXX: Not sure why you can't exit map and cancel the spell. +spret_type project_noise(bool fail) { + fail_check(); bool success = false; coord_def pos(1, 0); @@ -155,5 +159,5 @@ bool project_noise() } } - return (success); + return SPRET_SUCCESS; } |