diff options
author | Robert Burnham <burnhamrobertp@gmail.com> | 2011-04-26 08:47:05 -0500 |
---|---|---|
committer | Robert Burnham <burnhamrobertp@gmail.com> | 2011-04-26 08:47:05 -0500 |
commit | 809ea63fb87708fcb763492e2da99188679ed0f4 (patch) | |
tree | de25799e8538d30d4eb5dcfa37a7bc328ea491c3 /crawl-ref/source/dgn-shoals.cc | |
parent | 77b621a0ace27951fc2f24ab357f69430bcbfd67 (diff) | |
parent | 96f00b85b9271dade59c577353651eca1e88e0cd (diff) | |
download | crawl-ref-809ea63fb87708fcb763492e2da99188679ed0f4.tar.gz crawl-ref-809ea63fb87708fcb763492e2da99188679ed0f4.zip |
Merge branch 'master' into unified_combat_control
Conflicts:
crawl-ref/source/actor.cc
crawl-ref/source/delay.cc
crawl-ref/source/directn.cc
crawl-ref/source/directn.h
crawl-ref/source/fight.cc
crawl-ref/source/files.cc
crawl-ref/source/mon-act.cc
crawl-ref/source/monster.cc
crawl-ref/source/mpr.h
crawl-ref/source/player.cc
crawl-ref/source/shopping.cc
Diffstat (limited to 'crawl-ref/source/dgn-shoals.cc')
-rw-r--r-- | crawl-ref/source/dgn-shoals.cc | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc index aa4f019b1c..bee670c762 100644 --- a/crawl-ref/source/dgn-shoals.cc +++ b/crawl-ref/source/dgn-shoals.cc @@ -22,6 +22,7 @@ #include "mon-util.h" #include "random.h" #include "terrain.h" +#include "traps.h" #include "view.h" #include <algorithm> @@ -231,7 +232,9 @@ static std::vector<coord_def> _shoals_water_depth_change_points() coord_def c(*ri); if (grd(c) == DNGN_DEEP_WATER && dgn_has_adjacent_feat(c, DNGN_SHALLOW_WATER)) + { points.push_back(c); + } } return points; } @@ -628,7 +631,9 @@ static std::vector<coord_def> _shoals_windshadows(grid_bool &windy) if (!windy(p) && grd(p) == DNGN_FLOOR && (dgn_has_adjacent_feat(p, DNGN_STONE_WALL) || dgn_has_adjacent_feat(p, DNGN_ROCK_WALL))) + { wind_shadows.push_back(p); + } } return wind_shadows; } @@ -780,6 +785,26 @@ static coord_def _shoals_escape_place_from(coord_def bad_place, return chosen; } +static void _clear_net_trapping_status(coord_def c) +{ + actor *victim = actor_at(c); + if (!victim) + return; + + if (victim->atype() == ACT_MONSTER) + { + monster* mvictim = victim->as_monster(); + if (you.can_see(mvictim)) + mprf("The net is swept off %s.", mvictim->name(DESC_THE).c_str()); + mons_clear_trapping_net(mvictim); + } + else + { + mpr("The tide washes the net away!"); + clear_trapping_net(); + } +} + static bool _shoals_tide_sweep_items_clear(coord_def c) { int link = igrd(c); @@ -792,13 +817,20 @@ static bool _shoals_tide_sweep_items_clear(coord_def c) // item clear here, let dungeon_terrain_changed teleport the item // to the nearest safe square. item_def &item(*si); + // Let the tide break up stacks if (!item_is_rune(item) && coinflip()) continue; + if (item_is_stationary(item) && !one_chance_in(5)) + continue; + const coord_def target(_shoals_escape_place_from(c, NULL, &item)); if (!target.origin()) { + if (item_is_stationary(item)) + _clear_net_trapping_status(c); + int id = si.link(); move_item_to_grid(&id, target); } @@ -831,7 +863,14 @@ static bool _shoals_tide_sweep_actors_clear(coord_def c) if (evacuation_point.origin()) return false; - victim->move_to_pos(evacuation_point); + bool clear_net = false; + if (victim->caught()) + { + int net = get_trapping_net(c); + if (net != NON_ITEM) + clear_net = !move_item_to_grid(&net, evacuation_point); + } + victim->move_to_pos(evacuation_point, clear_net); return true; } |