summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-22 16:13:06 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-22 16:13:06 +0000
commitd2adf58f0e800c6f1b51f94e9ea96db61b026bf5 (patch)
tree18ef425750f6d3b85ccd9a61b149fe802f8e8831 /crawl-ref/source
parent5ebdb32ce6998eb6e38956b01e63e9f472e9bb5b (diff)
downloadcrawl-ref-d2adf58f0e800c6f1b51f94e9ea96db61b026bf5.tar.gz
crawl-ref-d2adf58f0e800c6f1b51f94e9ea96db61b026bf5.zip
's'earching will now check in a radius up to 5 around you,
with decreasing skill (effective skill = skill/(2*dist-1).) Walking around will also search, with probability (skill in 30) (but only adjacent squares.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@695 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc14
-rw-r--r--crawl-ref/source/misc.cc60
-rw-r--r--crawl-ref/source/misc.h2
3 files changed, 45 insertions, 31 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index b2f7bad7bb..d3f491f4a8 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2091,7 +2091,10 @@ static void world_reacts()
run_environment_effects();
- //if (random2(10) < you.skills [SK_TRAPS_DOORS] + 2) search_around();
+ if ( !you.paralysis && !you.mutation[MUT_BLURRY_VISION] &&
+ (you.mutation[MUT_ACUTE_VISION] >= 2 ||
+ random2(30) < you.skills[SK_TRAPS_DOORS]) )
+ search_around(true); // only check adjacent squares
stealth = check_stealth();
@@ -2977,15 +2980,6 @@ static void move_player(int move_x, int move_y)
you.time_taken /= 10;
move_player_to_grid(targ_x, targ_y, true, false, swap);
- // Returning the random trap scans as a way to get more use from the
- // skill and acute mutations.
- if (you.mutation[MUT_ACUTE_VISION] >= 2
- || (!you.mutation[MUT_BLURRY_VISION]
- && random2(100) <
- stat_mult(you.intel, skill_bump(SK_TRAPS_DOORS))))
- {
- search_around();
- }
move_x = 0;
move_y = 0;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index a01640aede..eda5a0f8b2 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -248,34 +248,54 @@ const char *grid_item_destruction_message( unsigned char grid )
: "You hear an empty echo.";
}
-void search_around(void)
+void search_around( bool only_adjacent )
{
char srx = 0;
char sry = 0;
int i;
- for (srx = you.x_pos - 1; srx < you.x_pos + 2; srx++)
+ // Traps and doors stepdown skill:
+ // skill/(2x-1) for squares at distance x
+ int max_dist = (you.skills[SK_TRAPS_DOORS] + 1) / 2;
+ if ( max_dist > 5 )
+ max_dist = 5;
+ if ( max_dist > 1 && only_adjacent )
+ max_dist = 1;
+
+ for ( int srx = you.x_pos - max_dist; srx <= you.x_pos + max_dist; ++srx )
{
- for (sry = you.y_pos - 1; sry < you.y_pos + 2; sry++)
+ for ( int sry=you.y_pos - max_dist; sry<=you.y_pos + max_dist; ++sry )
{
- // don't exclude own square; may be levitating
- if (grd[srx][sry] == DNGN_SECRET_DOOR
- && random2(17) <= 1 + you.skills[SK_TRAPS_DOORS])
- {
- grd[srx][sry] = DNGN_CLOSED_DOOR;
- mpr("You found a secret door!");
- exercise(SK_TRAPS_DOORS, ((coinflip())? 2 : 1));
- }
-
- if (grd[srx][sry] == DNGN_UNDISCOVERED_TRAP
- && random2(17) <= 1 + you.skills[SK_TRAPS_DOORS])
+ if ( see_grid(srx,sry) ) // must have LOS
{
- i = trap_at_xy(srx, sry);
-
- if (i != -1)
- grd[srx][sry] = trap_category(env.trap[i].type);
-
- mpr("You found a trap!");
+ // maybe we want distance() instead of grid_distance()?
+ int dist = grid_distance(srx, sry, you.x_pos, you.y_pos);
+
+ // don't exclude own square; may be levitating
+ if (dist == 0)
+ ++dist;
+
+ // making this harsher by removing the old +1
+ int effective = you.skills[SK_TRAPS_DOORS] / (2*dist - 1);
+
+ if (grd[srx][sry] == DNGN_SECRET_DOOR &&
+ random2(17) <= effective)
+ {
+ grd[srx][sry] = DNGN_CLOSED_DOOR;
+ mpr("You found a secret door!");
+ exercise(SK_TRAPS_DOORS, ((coinflip()) ? 2 : 1));
+ }
+
+ if (grd[srx][sry] == DNGN_UNDISCOVERED_TRAP &&
+ random2(17) <= effective)
+ {
+ i = trap_at_xy(srx, sry);
+
+ if (i != -1)
+ grd[srx][sry] = trap_category(env.trap[i].type);
+
+ mpr("You found a trap!");
+ }
}
}
}
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index fd9e7d34de..74065c561a 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -29,7 +29,7 @@ bool go_berserk(bool intentional);
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
-void search_around(void);
+void search_around( bool only_adjacent = false );
// last updated 12may2000 {dlb}