summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-act.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2009-12-29 00:01:37 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-12-29 01:09:18 +0530
commite9017206fd30a9cb7981d42ee6f8f1809f2f2933 (patch)
treeafd4f705d6bcd1cdd96f96e5a2d9e2f8a8ba1b0c /crawl-ref/source/mon-act.cc
parentbad09911df71edf9399974fb619ff79e4797fa5e (diff)
downloadcrawl-ref-e9017206fd30a9cb7981d42ee6f8f1809f2f2933.tar.gz
crawl-ref-e9017206fd30a9cb7981d42ee6f8f1809f2f2933.zip
Experimental kraken adjustments.
Boost kraken and tentacle damage. Force the tentacles to stay close to the body of the kraken to make the creature look more like a unit. Tentacles are now amphibious and can reach out onto land, although they cannot stray too far from the main body.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r--crawl-ref/source/mon-act.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 16c025e217..3fc1cea5a0 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -332,6 +332,24 @@ static void _maybe_set_patrol_route(monsters *monster)
}
}
+// Keep kraken tentacles from wandering too far away from the boss monster.
+static void _kraken_tentacle_movement_clamp(monsters *tentacle)
+{
+ if (tentacle->type != MONS_KRAKEN_TENTACLE)
+ return;
+
+ const int kraken_idx = tentacle->number;
+ ASSERT(!invalid_monster_index(kraken_idx));
+
+ monsters *kraken = &menv[kraken_idx];
+ const int distance_to_head =
+ grid_distance(tentacle->pos(), kraken->pos());
+ // Beyond max distance, the only move the tentacle can make is
+ // back towards the head.
+ if (distance_to_head >= KRAKEN_TENTACLE_RANGE)
+ mmov = (kraken->pos() - tentacle->pos()).sgn();
+}
+
//---------------------------------------------------------------
//
// handle_movement
@@ -378,8 +396,7 @@ static void _handle_movement(monsters *monster)
delta = monster->target - monster->pos();
// Move the monster.
- mmov.x = (delta.x > 0) ? 1 : ((delta.x < 0) ? -1 : 0);
- mmov.y = (delta.y > 0) ? 1 : ((delta.y < 0) ? -1 : 0);
+ mmov = delta.sgn();
if (mons_is_fleeing(monster) && monster->travel_target != MTRAV_WALL
&& (!monster->friendly()
@@ -1849,6 +1866,7 @@ static void _handle_monster_move(monsters *monster)
{
// Calculates mmov based on monster target.
_handle_movement(monster);
+ _kraken_tentacle_movement_clamp(monster);
if (mons_is_confused(monster)
|| monster->type == MONS_AIR_ELEMENTAL