summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-16 22:02:06 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-16 22:02:06 +0000
commitb01c84211a1f8bb59391dff857c2dd6c1a74c23a (patch)
tree0f8bd339fa2acc88e84934ac58ae3fb50813766b /crawl-ref/source/spells3.cc
parent8d408bcec276c6900302ddb079f17da88456acd3 (diff)
downloadcrawl-ref-b01c84211a1f8bb59391dff857c2dd6c1a74c23a.tar.gz
crawl-ref-b01c84211a1f8bb59391dff857c2dd6c1a74c23a.zip
Fixed a bug where entomb() wasn't checking DNGN_SPECIAL_FLOOR.
entomb() now has a power which determines the probability of building a wall at each square (capped at 95%.) You should hit the cap at Evoc 21 on a plain deck with no Nemelex support, maybe this is too soon (but maybe not.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2115 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc52
1 files changed, 24 insertions, 28 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 1ea5f76ee5..2f260ca6a2 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -735,34 +735,26 @@ void you_teleport_now( bool allow_control, bool new_abyss_area )
xom_is_stimulated(255);
}
-bool entomb(void)
+bool entomb(int powc)
{
- int loopy = 0; // general purpose loop variable {dlb}
- bool proceed = false; // loop management varaiable {dlb}
- int which_trap = 0; // used in clearing out certain traps {dlb}
- char srx = 0, sry = 0;
- char number_built = 0;
-
- FixedVector < unsigned char, 8 > safe_to_overwrite;
-
- // hack - passing chars through '...' promotes them to ints, which
- // barfs under gcc in fixvec.h. So don't.
- safe_to_overwrite[0] = DNGN_FLOOR;
- safe_to_overwrite[1] = DNGN_SHALLOW_WATER;
- safe_to_overwrite[2] = DNGN_OPEN_DOOR;
- safe_to_overwrite[3] = DNGN_TRAP_MECHANICAL;
- safe_to_overwrite[4] = DNGN_TRAP_MAGICAL;
- safe_to_overwrite[5] = DNGN_TRAP_III;
- safe_to_overwrite[6] = DNGN_UNDISCOVERED_TRAP;
- safe_to_overwrite[7] = DNGN_FLOOR_SPECIAL;
-
-
- for (srx = you.x_pos - 1; srx < you.x_pos + 2; srx++)
+ int number_built = 0;
+
+ const dungeon_feature_type safe_to_overwrite[] = {
+ DNGN_FLOOR, DNGN_SHALLOW_WATER, DNGN_OPEN_DOOR,
+ DNGN_TRAP_MECHANICAL, DNGN_TRAP_MAGICAL, DNGN_TRAP_III,
+ DNGN_UNDISCOVERED_TRAP,
+ DNGN_FLOOR_SPECIAL
+ };
+
+ if ( powc > 95 )
+ powc = 95;
+ if ( powc < 25 )
+ powc = 25;
+
+ for (int srx = you.x_pos - 1; srx < you.x_pos + 2; srx++)
{
- for (sry = you.y_pos - 1; sry < you.y_pos + 2; sry++)
+ for (int sry = you.y_pos - 1; sry < you.y_pos + 2; sry++)
{
- proceed = false;
-
// tile already occupied by monster or yourself {dlb}:
if (mgrd[srx][sry] != NON_MONSTER
|| (srx == you.x_pos && sry == you.y_pos))
@@ -770,10 +762,13 @@ bool entomb(void)
continue;
}
- // the break here affects innermost containing loop {dlb}:
- for (loopy = 0; loopy < 7; loopy++)
+ if ( random2(100) > powc )
+ continue;
+
+ bool proceed = false;
+ for (int i = 0; i < ARRAYSIZE(safe_to_overwrite); ++i)
{
- if (grd[srx][sry] == safe_to_overwrite[loopy])
+ if (grd[srx][sry] == safe_to_overwrite[i])
{
proceed = true;
break;
@@ -819,6 +814,7 @@ bool entomb(void)
delete_cloud( env.cgrid[srx][sry] );
// mechanical traps are destroyed {dlb}:
+ int which_trap;
if ((which_trap = trap_at_xy(srx, sry)) != -1)
{
if (trap_category(env.trap[which_trap].type)