diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-18 13:14:51 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-18 13:14:51 +0000 |
commit | 388fa4e558e71b1455cce865c1a8b62ace0aaba9 (patch) | |
tree | 416e974c180f6666479d8fd5f0c023e780839af3 /crawl-ref/source/traps.cc | |
parent | 184db9c1a6ecba9bb3cb961447a386e1b593d7a0 (diff) | |
download | crawl-ref-388fa4e558e71b1455cce865c1a8b62ace0aaba9.tar.gz crawl-ref-388fa4e558e71b1455cce865c1a8b62ace0aaba9.zip |
Fix 1996770: shafts being capable of disarming.
Fix 1996304: the Swap card incorrectly swapping monsters/player caught in a net
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5941 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r-- | crawl-ref/source/traps.cc | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index d399ae7cd1..c1f5c76023 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -179,6 +179,48 @@ void player_caught_in_net() } } +void check_net_will_hold_monster(monsters *mons) +{ + if (mons->body_size(PSIZE_BODY) >= SIZE_GIANT) + { + int net = get_trapping_net(mons->x, mons->y); + if (net != NON_ITEM) + destroy_item(net); + + if (see_grid(mons->x, mons->y)) + { + if (player_monster_visible(mons)) + { + mprf("The net rips apart, and %s comes free!", + mons->name(DESC_NOCAP_THE).c_str()); + } + else + mpr("All of a sudden the net rips apart!"); + } + } + else if (mons_is_insubstantial(mons->type) + || mons->type == MONS_OOZE + || mons->type == MONS_PULSATING_LUMP) + { + const int net = get_trapping_net(mons->x, mons->y); + if (net != NON_ITEM) + remove_item_stationary(mitm[net]); + + if (mons_is_insubstantial(mons->type)) + { + simple_monster_message(mons, + " drifts right through the net!"); + } + else + { + simple_monster_message(mons, + " oozes right through the net!"); + } + } + else + mons->add_ench(ENCH_HELD); +} + static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison) { int damage_taken = 0; @@ -509,10 +551,17 @@ void disarm_trap( struct dist &disa ) } } - if (trap_category(env.trap[i].type) == DNGN_TRAP_MAGICAL) + switch (trap_category(env.trap[i].type)) { + case DNGN_TRAP_MECHANICAL: mpr("You can't disarm that trap."); return; + case DNGN_TRAP_NATURAL: + // Only shafts for now. + mpr("You can't disarm a shaft."); + return; + default: + break; } if (random2(you.skills[SK_TRAPS_DOORS] + 2) <= random2(you.your_level + 5)) |