summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coord.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-09-15 23:24:07 +0200
committerRaphael Langella <raphael.langella@gmail.com>2012-09-15 23:24:29 +0200
commitd66b1aea3f269e2140d79b5d32f7174694f5fb92 (patch)
tree5b514bbd4dda3974dbcf66607a5a662c628be36e /crawl-ref/source/coord.cc
parent3fab5e45499609b4aeb6150ad2dda39305a740fe (diff)
downloadcrawl-ref-d66b1aea3f269e2140d79b5d32f7174694f5fb92.tar.gz
crawl-ref-d66b1aea3f269e2140d79b5d32f7174694f5fb92.zip
Cleave effect for Axes.
* Additional targets are acquired by rotating from the main target in both directions but no more than 3 cells. Solid features block cleaving. On open grounds, it attacks 7 cells (all but the opposite one from the main target). A single wall on the side can block one or two targets since it doesn't go all around. * Additional attacks do 75% damage. Main target still takes full damage. * Allies don't block cleaving and are not harmed by it unless attacker is confused. * Monsters wielding axes get cleaving too. * Broad axe, battleaxe and executioner's axe base damage is reduced by 1. More nerfing might be needed for the latter 2. * Cleaving works when attacking empty spaces (useful against invisible monsters) * Monsters dual wielding axes should work. Thanks to LexAckson for helping with this implementation (especially rotate_adjacent).
Diffstat (limited to 'crawl-ref/source/coord.cc')
-rw-r--r--crawl-ref/source/coord.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/coord.cc b/crawl-ref/source/coord.cc
index dfd6c20645..144420e6c2 100644
--- a/crawl-ref/source/coord.cc
+++ b/crawl-ref/source/coord.cc
@@ -80,3 +80,16 @@ coord_def grid2player(const coord_def &gc)
{
return (gc - you.pos());
}
+
+//rotates a coord_def that points to an adjacent square
+//clockwise (direction > 0), or counter-clockwise (direction < 0)
+coord_def rotate_adjacent(coord_def vector, int direction)
+{
+ int xn, yn;
+
+ xn = vector.x - sgn(direction) * vector.y;
+ yn = sgn(direction) * vector.x + vector.y;
+ vector.x = xn;
+ vector.y = yn;
+ return vector.sgn();
+}