Index: src/monster2.c =================================================================== --- src/monster2.c (revision 694) +++ src/monster2.c (working copy) @@ -404,8 +404,18 @@ */ s16b get_mon_num(int level) { - int i, j, p; + // Tune locally for now + int MAX_UNDER_DEPTH = -5; + int MAX_UNDER_DEPTH_PENALTY = 90; + int MAX_OVER_DEPTH1 = 30; + int MAX_OVER_DEPTH1_PENALTY = 50; + int MAX_OVER_DEPTH2 = 50; + int MAX_OVER_DEPTH2_PENALTY = 75; + int MAX_OVER_DEPTH3 = 70; + int MAX_OVER_DEPTH3_PENALTY = 99; + int i, j, p, ood; + int r_idx; long value, total; @@ -447,7 +457,7 @@ for (i = 0; i < alloc_race_size; i++) { /* Monsters are sorted by depth */ - if (table[i].level > level) break; + if (table[i].level - MAX_UNDER_DEPTH >= level) break; /* Default */ table[i].prob3 = 0; @@ -474,8 +484,46 @@ continue; } + ood = level - table[i].level; + /* Accept */ - table[i].prob3 = table[i].prob2; + if ( ood > MAX_UNDER_DEPTH && ood < 0) + { + //Just a little out of depth + table[i].prob3 = table[i].prob2 * ( MAX_UNDER_DEPTH_PENALTY / ood ); + table[i].prob3 /= 100; + } + if ( ood >= 0 && ood < MAX_OVER_DEPTH1 ) + { + //a little deeper than natural + table[i].prob3 = table[i].prob2 * + (( MAX_OVER_DEPTH1_PENALTY - 0 ) / + ( MAX_OVER_DEPTH1 - ood ) + ); + table[i].prob3 /= 100; + } + if ( ood >= MAX_OVER_DEPTH1 && ood < MAX_OVER_DEPTH2 ) + { + // a good deal deeper than natural + table[i].prob3 = table[i].prob2 * + (( MAX_OVER_DEPTH2_PENALTY - MAX_OVER_DEPTH1_PENALTY) / + ( MAX_OVER_DEPTH2 - ood) + ); + table[i].prob3 /= 100; + } + if ( ood >= MAX_OVER_DEPTH2 && ood < MAX_OVER_DEPTH3 ) + { + // Way deeper than you should be + table[i].prob3 = table[i].prob2 * + (( MAX_OVER_DEPTH3_PENALTY - MAX_OVER_DEPTH2_PENALTY) / + ( MAX_OVER_DEPTH3 - ood) + ); + table[i].prob3 /= 100; + } + if ( ood >= MAX_OVER_DEPTH3 ) + { + table[i].prob3 = table[i].prob2 * MAX_OVER_DEPTH3_PENALTY / 100; + } /* Total */ total += table[i].prob3;