diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-04 13:14:08 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-04 13:14:08 +0000 |
commit | 59b053efd22ccd197d042ed5731b117e4846599b (patch) | |
tree | ea7803c17c786ba173a4c938f999ea3815919188 /crawl-ref/source/spells3.cc | |
parent | f5e55fd944784181102ecdf93c6eca2da4e509b2 (diff) | |
download | crawl-ref-59b053efd22ccd197d042ed5731b117e4846599b.tar.gz crawl-ref-59b053efd22ccd197d042ed5731b117e4846599b.zip |
Apply the first part of the labyrinth tweaks:
* labyrinths are bordered by (undiggable) metal walls
* teleporting inside a labyrinth will always send you away from the centre
(as the crow flies: you'll end somewhere in the stone or rock area)
Also make sure melded equipment cannot corrode.
(I'm still undecided about whether curses should affect melded items.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7383 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r-- | crawl-ref/source/spells3.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index a368510a34..af2330a23a 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1350,6 +1350,33 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area ) { coord_def newpos; + // If in a labyrinth, always teleport well away from the centre. + // (Check done for the straight line, no pathfinding involved.) + bool need_distance_check = false; + coord_def centre; + if (you.level_type == LEVEL_LABYRINTH) + { + bool success = false; + for (int xpos = 0; xpos < GXM; xpos++) + { + for (int ypos = 0; ypos < GYM; ypos++) + { + centre = coord_def(xpos, ypos); + if (!in_bounds(centre)) + continue; + + if (grd(centre) == DNGN_ESCAPE_HATCH_UP) + { + success = true; + break; + } + } + if (success) + break; + } + need_distance_check = success; + } + do { newpos.set( random_range(X_BOUND_1 + 1, X_BOUND_2 - 1), @@ -1358,7 +1385,8 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area ) while (grd(newpos) != DNGN_FLOOR && grd(newpos) != DNGN_SHALLOW_WATER || mgrd(newpos) != NON_MONSTER - || env.cgrid(newpos) != EMPTY_CLOUD); + || env.cgrid(newpos) != EMPTY_CLOUD + || need_distance_check && (newpos - centre).abs() < 34*34); // no longer held in net if (newpos != you.pos()) |