summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/decks.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/decks.cc')
-rw-r--r--crawl-ref/source/decks.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index fdcf348bf8..6797a503ed 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1362,6 +1362,15 @@ static void _swap_monster_card(int power, deck_rarity_type rarity)
{
monsters& mon(*mon_to_swap);
const coord_def newpos = mon.pos();
+
+ // Be nice: no swapping into uninhabitable environments.
+ if (is_grid_dangerous(grd(newpos))
+ || !monster_habitable_grid(mon_to_swap, grd(you.pos())))
+ {
+ mpr("You spin around.");
+ return;
+ }
+
bool mon_caught = mons_is_caught(&mon);
bool you_caught = you.attribute[ATTR_HELD];
@@ -1382,6 +1391,7 @@ static void _swap_monster_card(int power, deck_rarity_type rarity)
}
// Move you to its previous location.
+ // FIXME: this should also handle merfolk swimming, etc.
you.moveto(newpos);
if (mon_caught)