diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-03 20:48:58 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-12-03 20:48:58 +1000 |
commit | 9dc6a97ec5369d54c9c46c6bdced240ee56b1763 (patch) | |
tree | 8b37fbfeffd48125bcae1e69ce226ca19cb57a8c /crawl-ref | |
parent | 1621cc868eac53bb4f239b056cc49068b56f52c9 (diff) | |
download | crawl-ref-9dc6a97ec5369d54c9c46c6bdced240ee56b1763.tar.gz crawl-ref-9dc6a97ec5369d54c9c46c6bdced240ee56b1763.zip |
Don't assume a square is safe if there are a monster there.
Could be a lava snake, swamp worm, etc.
Diffstat (limited to 'crawl-ref')
-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); |