diff options
-rw-r--r-- | crawl-ref/source/dat/vaults.des | 7 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 21 |
2 files changed, 21 insertions, 7 deletions
diff --git a/crawl-ref/source/dat/vaults.des b/crawl-ref/source/dat/vaults.des index d6cf959bba..ef0c51989d 100644 --- a/crawl-ref/source/dat/vaults.des +++ b/crawl-ref/source/dat/vaults.des @@ -305,8 +305,11 @@ local function teleporter (data, triggerable, triggerer, marker, ev) monster.random_teleport() end - you.teleport_to(my_slaves[1].x, my_slaves[1].y) - crawl.mpr("Your surroundings suddenly seem different!") + if you.teleport_to(my_slaves[1].x, my_slaves[1].y, true) then + crawl.mpr("Your surroundings suddenly seem different!") + else + crawl.mpr("There is a strange hissing noise.") + end end -- Lua marker magic! diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index e0b1ca50de..1c25a5ee72 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1411,10 +1411,10 @@ void you_teleport(void) } // Should return true if we don't want anyone to teleport here. -bool _cell_vetoes_teleport (const coord_def cell) +bool _cell_vetoes_teleport (const coord_def cell, bool check_monsters = true) { // Monsters always veto teleport. - if (monster_at(cell)) + if (monster_at(cell) && check_monsters) return (true); // As do all clouds; this may change. @@ -1431,9 +1431,19 @@ bool _cell_vetoes_teleport (const coord_def cell) case DNGN_DEEP_WATER: if (you.species == SP_MERFOLK) return (false); + else + return (true); - default: + case DNGN_LAVA: return (true); + + default: + // Lava is really the only non-solid glyph above DNGN_MAXSOLID that is + // not a safe teleport location, and that's handled above. + if (cell_is_solid(cell)) + return (true); + + return (false); } } @@ -1714,7 +1724,7 @@ bool you_teleport_to (const coord_def where_to, bool move_monsters) if (_cell_vetoes_teleport(where)) { - if (monster_at(where) && move_monsters) + if (monster_at(where) && move_monsters && !_cell_vetoes_teleport(where, false)) { monsters *mons = monster_at(where); mons->teleport(true); @@ -1729,7 +1739,8 @@ bool you_teleport_to (const coord_def where_to, bool move_monsters) } else { - if (monster_at(*ai) && move_monsters) + if (monster_at(*ai) && move_monsters + && !_cell_vetoes_teleport(*ai, false)) { monsters *mons = monster_at(*ai); mons->teleport(true); |