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-selfench.h | |
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-selfench.h')
-rw-r--r-- | crawl-ref/source/spl-selfench.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/crawl-ref/source/spl-selfench.h b/crawl-ref/source/spl-selfench.h index 02fb7b0b9a..4f479456b6 100644 --- a/crawl-ref/source/spl-selfench.h +++ b/crawl-ref/source/spl-selfench.h @@ -1,25 +1,30 @@ #ifndef SPL_SELFENCH_H #define SPL_SELFENCH_H +#include "spl-cast.h" + int allowed_deaths_door_hp(void); -bool cast_deaths_door(int pow); +spret_type cast_deaths_door(int pow, bool fail); void remove_ice_armour(); -bool ice_armour(int pow); -void missile_prot(int pow); -void deflection(int pow); +spret_type ice_armour(int pow, bool fail); +spret_type missile_prot(int pow, bool fail); +spret_type deflection(int pow, bool fail); void remove_regen(bool divine_ability = false); -void cast_regen(int pow, bool divine_ability = false); +spret_type cast_regen(int pow, bool divine_ability = false, bool fail = false); +spret_type cast_revivification(int pow, bool fail); -bool cast_swiftness(int power); -void cast_fly(int power); -void cast_insulation(int power); +spret_type cast_swiftness(int power, bool fail = false); +spret_type cast_levitation(int power, bool fail); +spret_type cast_fly(int power, bool fail = false); +spret_type cast_insulation(int power, bool fail); -void cast_teleport_control(int power); +spret_type cast_teleport_control(int power, bool fail); int cast_selective_amnesia(std::string *pre_msg = NULL); -void cast_see_invisible(int pow); -void cast_silence(int pow); -void cast_liquefaction(int pow); -void cast_shroud_of_golubria(int pow); +spret_type cast_see_invisible(int pow, bool fail); +spret_type cast_silence(int pow, bool fail = false); +spret_type cast_liquefaction(int pow, bool fail); +spret_type cast_shroud_of_golubria(int pow, bool fail); +spret_type cast_transform(int pow, transformation_type which_trans, bool fail); #endif |