diff options
author | Adam Borowski <kilobyte@angband.pl> | 2009-12-30 14:31:12 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2009-12-30 14:31:12 +0100 |
commit | d8190f4c633d2c4065e92c61894f85f506d5246a (patch) | |
tree | 887402a9869486e5a23386bc41dec9fae1987d39 /crawl-ref/source/mon-act.cc | |
parent | 1d0cbf5f8be4dcb3d78167d3a1f29691779298f8 (diff) | |
parent | 30ad58ea18d6e4e2132d235e60f66f11131e17dc (diff) | |
download | crawl-ref-d8190f4c633d2c4065e92c61894f85f506d5246a.tar.gz crawl-ref-d8190f4c633d2c4065e92c61894f85f506d5246a.zip |
Merge branch 'master' into iood
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r-- | crawl-ref/source/mon-act.cc | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 62df9c963b..8112618b0f 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -333,6 +333,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 @@ -379,8 +397,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() @@ -1123,7 +1140,12 @@ static bool _mons_throw(struct monsters *monster, struct bolt &pbolt, { const mon_attack_def attk = mons_attack_spec(monster, 0); if (attk.type == AT_SHOOT) - ammoDamBonus += random2avg(attk.damage, 2); + { + if (projected == LRET_THROWN && wepClass == OBJ_MISSILES) + ammoHitBonus += random2avg(attk.damage, 2); + else + ammoDamBonus += random2avg(attk.damage, 2); + } } if (projected == LRET_THROWN) @@ -1392,7 +1414,7 @@ static bool _mons_throw(struct monsters *monster, struct bolt &pbolt, pbolt.fire(); // The item can be destroyed before returning. - if (really_returns && thrown_object_destroyed(&item, pbolt.target, true)) + if (really_returns && thrown_object_destroyed(&item, pbolt.target)) { really_returns = false; } @@ -1858,6 +1880,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 @@ -2169,6 +2192,7 @@ static bool _monster_eat_item(monsters *monster, bool nearby) bool death_ooze_ate_good = false; bool death_ooze_ate_corpse = false; + // Jellies can swim, so don't check water for (stack_iterator si(monster->pos()); si && eaten < max_eat && hps_changed < 50; ++si) { @@ -2452,6 +2476,14 @@ static bool _handle_pickup(monsters *monster) if (monster->asleep() || monster->submerged()) return (false); + // Hack - Harpies fly over water, but we don't have a general + // system for monster igrd yet. Flying intelligent monsters + // (kenku!) would also count here. + dungeon_feature_type feat = grd(monster->pos()); + + if ((feat == DNGN_LAVA || feat == DNGN_DEEP_WATER) && !monster->flight_mode()) + return (false); + const bool nearby = mons_near(monster); int count_pickup = 0; @@ -2770,7 +2802,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, // The kraken is so large it cannot enter shallow water. // Its tentacles can, and will, though. - if (monster->type == MONS_KRAKEN && target_grid == DNGN_SHALLOW_WATER) + if (mons_base_type(monster) == MONS_KRAKEN && target_grid == DNGN_SHALLOW_WATER) return (false); // Effectively slows down monster movement across water. |