Skip to content

Commit

Permalink
Merge branch 'search-tweak'
Browse files Browse the repository at this point in the history
  • Loading branch information
tmewett committed Aug 15, 2020
2 parents def21db + eaa1e4b commit 2083868
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
3 changes: 2 additions & 1 deletion changes/searching.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Revamped the searching system. Instead of performing a strong search only after
five consecutive turns of pressing 's', you now perform a weaker, single-turn
search every time you press 's', with a stronger one on the fifth
search every time you press 's', with a stronger one on the fifth. (Control+s
will perform five searches, stopping if interrupted, just like old 'S'.)
16 changes: 14 additions & 2 deletions src/brogue/IO.c
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,19 @@ void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKe
autoRest();
break;
case SEARCH_KEY:
manualSearch();
if (controlKey) {
rogue.disturbed = false;
rogue.automationActive = true;
do {
manualSearch();
if (pauseBrogue(80)) {
rogue.disturbed = true;
}
} while (player.status[STATUS_SEARCHING] < 5 && !rogue.disturbed);
rogue.automationActive = false;
} else {
manualSearch();
}
break;
case INVENTORY_KEY:
displayInventory(ALL_ITEMS, 0, 0, true, true);
Expand Down Expand Up @@ -3775,7 +3787,7 @@ void printHelpScreen() {
"",
" z ****rest once",
" Z ****rest for 100 turns or until something happens",
" s ****search for secret doors and traps",
" s ****search for secrets (control-s: long search)",
" <, > ****travel to stairs",
" x ****auto-explore (control-x: fast forward)",
" A ****autopilot (control-A: fast forward)",
Expand Down
18 changes: 15 additions & 3 deletions src/brogue/Time.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,12 +2118,24 @@ void manualSearch() {

player.status[STATUS_SEARCHING] += 1;

// do a final, larger-radius search on the fifth search in a row
/* The search strength values were chosen based on equating the expected
number of cells discovered by 5x 80 searches (1.7.4) and 1x 200 search
(1.7.5). 1x200 discovers an average of 932 cells; 5.65 times more cells than
the 165 of 5x80. This factor is intepreted as the advantage of undelayed
searching. Hence, we chose a short radius r and a long radius s such that
4 * 5.65 * E_r + E_s ~= 932
where E_x is the expected no. of cells discovered with radius x. We choose
r=60, s=160, giving 852 < 932 (under to account for removal of 1.7.5 stealth
range doubling).
*/
short searchStrength = 0;
if (player.status[STATUS_SEARCHING] < 5) {
searchStrength = (rogue.awarenessBonus >= 0 ? 55 : 30);
searchStrength = (rogue.awarenessBonus >= 0 ? 60 : 30);
} else {
searchStrength = 170;
// Do a final, larger-radius search on the fifth search in a row
searchStrength = 160;
message("you finish your detailed search of the area.", false);
player.status[STATUS_SEARCHING] = 0;
}
Expand Down

0 comments on commit 2083868

Please sign in to comment.