summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-damage.h
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2011-07-21 12:44:28 +0000
committerRaphael Langella <raphael.langella@gmail.com>2011-07-21 22:25:43 +0200
commit17dfbce6f42ff75dfefd63ace016e51d9f493aa5 (patch)
tree3a2819a7823c305f8410711a984a46410cf4c8a7 /crawl-ref/source/spl-damage.h
parent6056fee300d2862993780b1bbbc1e9476ac70070 (diff)
downloadcrawl-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-damage.h')
-rw-r--r--crawl-ref/source/spl-damage.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/crawl-ref/source/spl-damage.h b/crawl-ref/source/spl-damage.h
index 9c41aa0f61..c04dbbe59e 100644
--- a/crawl-ref/source/spl-damage.h
+++ b/crawl-ref/source/spl-damage.h
@@ -2,32 +2,34 @@
#define SPL_DAMAGE_H
#include "enum.h"
+#include "spl-cast.h"
struct bolt;
class dist;
-bool fireball(int pow, bolt &beam);
+spret_type fireball(int pow, bolt &beam, bool fail = false);
+spret_type cast_delayed_fireball(bool fail);
void setup_fire_storm(const actor *source, int pow, bolt &beam);
-bool cast_fire_storm(int pow, bolt &beam);
+spret_type cast_fire_storm(int pow, bolt &beam, bool fail);
bool cast_hellfire_burst(int pow, bolt &beam);
-void cast_chain_lightning(int pow, const actor *caster);
+spret_type cast_chain_lightning(int pow, const actor *caster, bool fail = false);
-void cast_toxic_radiance(bool non_player = false);
-void cast_refrigeration(int pow, bool non_player = false,
- bool freeze_potions = true);
+spret_type cast_toxic_radiance(bool non_player = false, bool fail = false);
+spret_type cast_refrigeration(int pow, bool non_player = false,
+ bool freeze_potions = true, bool fail = false);
void sonic_damage(bool scream);
-bool vampiric_drain(int pow, monster* mons);
-bool cast_freeze(int pow, monster* mons);
-bool cast_airstrike(int pow, const dist &beam);
-void cast_shatter(int pow);
-void cast_ignite_poison(int pow);
-void cast_discharge(int pow);
+spret_type vampiric_drain(int pow, monster* mons, bool fail);
+spret_type cast_freeze(int pow, monster* mons, bool fail);
+spret_type cast_airstrike(int pow, const dist &beam, bool fail);
+spret_type cast_shatter(int pow, bool fail);
+spret_type cast_ignite_poison(int pow, bool fail);
+spret_type cast_discharge(int pow, bool fail);
int disperse_monsters(coord_def where, int pow);
-void cast_dispersal(int pow);
-bool cast_fragmentation(int powc, const dist& spd);
+spret_type cast_dispersal(int pow, bool fail = false);
+spret_type cast_fragmentation(int powc, const dist& spd, bool fail);
int wielding_rocks();
-bool cast_sandblast(int powc, bolt &beam);
-bool cast_tornado(int powc);
+spret_type cast_sandblast(int powc, bolt &beam, bool fail);
+spret_type cast_tornado(int powc, bool fail);
void tornado_damage(actor *caster, int dur);
void cancel_tornado(bool tloc = false);
void tornado_move(const coord_def &pos);