summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 13:14:51 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 13:14:51 +0000
commit388fa4e558e71b1455cce865c1a8b62ace0aaba9 (patch)
tree416e974c180f6666479d8fd5f0c023e780839af3 /crawl-ref/source/decks.cc
parent184db9c1a6ecba9bb3cb961447a386e1b593d7a0 (diff)
downloadcrawl-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/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 395e2032eb..9a4b1a25d5 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1354,6 +1354,8 @@ static void _swap_monster_card(int power, deck_rarity_type rarity)
{
monsters& mon(*mon_to_swap);
const coord_def newpos = mon.pos();
+ bool mon_caught = mons_is_caught(&mon);
+ bool you_caught = you.attribute[ATTR_HELD];
// Pick the monster up.
mgrd(newpos) = NON_MONSTER;
@@ -1361,11 +1363,38 @@ static void _swap_monster_card(int power, deck_rarity_type rarity)
mon.x = you.x_pos;
mon.y = you.y_pos;
- // plunk it down
+ // Plunk it down
mgrd(mon.pos()) = monster_index(mon_to_swap);
- // move you to its previous location
+ if (you_caught)
+ {
+ check_net_will_hold_monster(&mon);
+ if (!mon_caught)
+ you.attribute[ATTR_HELD] = 0;
+ }
+
+ // Move you to its previous location.
you.moveto(newpos);
+
+ if (mon_caught)
+ {
+ if (you.body_size(PSIZE_BODY) >= SIZE_GIANT)
+ {
+ mpr("The net rips apart!");
+ you.attribute[ATTR_HELD] = 0;
+ int net = get_trapping_net(you.x_pos, you.y_pos);
+ if (net != NON_ITEM)
+ destroy_item(net);
+ }
+ else
+ {
+ you.attribute[ATTR_HELD] = 10;
+ mpr("You become entangled in the net!");
+ }
+
+ if (!you_caught)
+ mon.del_ench(ENCH_HELD, true);
+ }
}
}