From e9017206fd30a9cb7981d42ee6f8f1809f2f2933 Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Tue, 29 Dec 2009 00:01:37 +0530 Subject: 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. --- crawl-ref/source/externs.h | 10 ++++++++++ crawl-ref/source/mon-act.cc | 22 ++++++++++++++++++++-- crawl-ref/source/mon-data.h | 8 ++++---- crawl-ref/source/mon-stuff.cc | 2 +- crawl-ref/source/monster.h | 2 ++ crawl-ref/source/stuff.h | 5 ----- 6 files changed, 37 insertions(+), 12 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 5f4f5e7e40..1c3a962d5d 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -92,6 +92,11 @@ class KillMaster; class ghost_demon; struct glyph; +template inline Z sgn(Z x) +{ + return (x < 0 ? -1 : (x > 0 ? 1 : 0)); +} + struct coord_def { int x; @@ -215,6 +220,11 @@ struct coord_def return (copy *= mul); } + coord_def sgn() const + { + return coord_def(::sgn(x), ::sgn(y)); + } + int abs() const { return (x * x + y * y); 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 diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index 5d42867f4d..ad3414acae 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -3303,7 +3303,7 @@ static monsterentry mondata[] = { M_COLD_BLOOD | M_SPELLCASTER, MR_NO_FLAGS, 1500, 20, MONS_KRAKEN, MONS_KRAKEN, MH_NATURAL, -3, - { {AT_BITE, AF_PLAIN, 15}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, + { {AT_BITE, AF_PLAIN, 65}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 20, 10, 10, 0 }, 20, 0, MST_KRAKEN, CE_NOCORPSE, Z_NOZOMBIE, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, @@ -3315,10 +3315,10 @@ static monsterentry mondata[] = { M_COLD_BLOOD | M_NO_EXP_GAIN, MR_RES_ASPHYX, 0, 10, MONS_KRAKEN_TENTACLE, MONS_KRAKEN_TENTACLE, MH_NATURAL, MAG_IMMUNE, - { {AT_TENTACLE_SLAP, AF_PLAIN, 15}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, - { 5, 3, 5, 0 }, + { {AT_TENTACLE_SLAP, AF_PLAIN, 29}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, + { 12, 3, 2, 0 }, 5, 7, MST_NO_SPELLS, CE_NOCORPSE, Z_NOZOMBIE, S_SILENT, - I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, + I_ANIMAL, HT_AMPHIBIOUS_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LARGE }, diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index 7a85194ea2..3db902c13b 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -1323,7 +1323,7 @@ static int _tentacle_too_far(monsters *head, monsters *tentacle) // If this ever changes, we'd need to check if the head and tentacle // are still in the same pool. // XXX: Actually, using Fedhas's Sunlight power you can separate pools... - return grid_distance(head->pos(), tentacle->pos()) > LOS_RADIUS; + return grid_distance(head->pos(), tentacle->pos()) > KRAKEN_TENTACLE_RANGE; } void mons_relocated(monsters *monster) diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h index 524c48b4d4..109dc876fb 100644 --- a/crawl-ref/source/monster.h +++ b/crawl-ref/source/monster.h @@ -3,6 +3,8 @@ #include "actor.h" +const int KRAKEN_TENTACLE_RANGE = 3; + class mon_enchant { public: diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 89757eb99d..684df4175d 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -83,11 +83,6 @@ inline bool testbits(unsigned long flags, unsigned long test) return ((flags & test) == test); } -template inline Z sgn(Z x) -{ - return (x < 0 ? -1 : (x > 0 ? 1 : 0)); -} - bool is_trap_square(dungeon_feature_type grid); void zap_los_monsters(bool items_also); -- cgit v1.2.3-54-g00ecf