diff options
author | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-06-03 20:58:47 -0700 |
---|---|---|
committer | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-06-03 20:58:47 -0700 |
commit | f257b78660c846345a10cc5de2c823867b8a16e6 (patch) | |
tree | d706dd14c06f0c51ad7f2cfde60951f74c9144fa /crawl-ref/source/spl-damage.cc | |
parent | efcbf97b9c23ec216848f4fe1257b437097dd15b (diff) | |
download | crawl-ref-f257b78660c846345a10cc5de2c823867b8a16e6.tar.gz crawl-ref-f257b78660c846345a10cc5de2c823867b8a16e6.zip |
Future-proof some shatter code
Diffstat (limited to 'crawl-ref/source/spl-damage.cc')
-rw-r--r-- | crawl-ref/source/spl-damage.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc index d89cdcf764..736d77cc3f 100644 --- a/crawl-ref/source/spl-damage.cc +++ b/crawl-ref/source/spl-damage.cc @@ -1239,6 +1239,26 @@ static int _shatter_walls(coord_def where, int pow, actor *agent) return 0; } +static int _shatter_player_dice() +{ + if (you.is_insubstantial()) + return 0; + else if (you.petrified()) + return 12; // reduced later + else if (you.petrifying()) + return 6; // reduced later + // Same order as for monsters -- petrified flyers get hit hard, skeletal + // flyers get no extra damage. + else if (you.airborne()) + return 1; + else if (you.form == TRAN_STATUE || you.species == SP_GARGOYLE) + return 6; + else if (you.form == TRAN_ICE_BEAST) + return coinflip() ? 5 : 4; + else + return 3; +} + /** * Is this a valid target for shatter? * @@ -1248,7 +1268,7 @@ static int _shatter_walls(coord_def where, int pow, actor *agent) static bool _shatterable(const actor *act) { if (act->is_player()) - return !you.is_insubstantial(); + return _shatter_player_dice(); return _shatter_mon_dice(act->as_monster()); } @@ -1291,26 +1311,6 @@ spret_type cast_shatter(int pow, bool fail) return SPRET_SUCCESS; } -static int _shatter_player_dice() -{ - if (you.is_insubstantial()) - return 0; - else if (you.petrified()) - return 12; // reduced later - else if (you.petrifying()) - return 6; // reduced later - // Same order as for monsters -- petrified flyers get hit hard, skeletal - // flyers get no extra damage. - else if (you.airborne()) - return 1; - else if (you.form == TRAN_STATUE || you.species == SP_GARGOYLE) - return 6; - else if (you.form == TRAN_ICE_BEAST) - return coinflip() ? 5 : 4; - else - return 3; -} - static int _shatter_player(int pow, actor *wielder, bool devastator = false) { if (wielder->is_player()) |