Index: src/monster2.c =================================================================== --- src/monster2.c (revision 694) +++ src/monster2.c (working copy) @@ -404,8 +404,24 @@ */ 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 = 33; + int MAX_OVER_DEPTH2 = 50; + int MAX_OVER_DEPTH2_PENALTY = 66; + int MAX_OVER_DEPTH3 = 60; + int MAX_OVER_DEPTH3_PENALTY = 99; + // We're going to give Uniques a bonus as we + // get deeper than their base level + int UNIQUE_BONUS_DEPTH_MIN = 0; + int UNIQUE_BONUS_DEPTH_MAX = 50; + int UNIQUE_BONUS = 25; + + int i, j, p, ood; + int r_idx; long value, total; @@ -447,7 +463,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,9 +490,66 @@ continue; } + ood = level - table[i].level; + /* Accept */ - table[i].prob3 = table[i].prob2; + if (!(r_ptr->flags1 & (RF1_UNIQUE))) + { + 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; + } + else if ( ood == 0 ) + { + table[i].prob3 = table[i].prob2; + } + else 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; + } + else 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; + } + else 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; + } + else if ( ood >= MAX_OVER_DEPTH3 ) + { + table[i].prob3 = table[i].prob2 * MAX_OVER_DEPTH3_PENALTY / 100; + } + } else { + if ( ood >= UNIQUE_BONUS_DEPTH_MIN && + ood <= UNIQUE_BONUS_DEPTH_MAX ) + { + table[i].prob3 = table[i].prob2 * UNIQUE_BONUS / + (UNIQUE_BONUS_DEPTH_MAX - ood); + table[i].prob3 /= 100; + } else if ( ood > UNIQUE_BONUS_DEPTH_MAX ) { + table[i].prob3 = table[i].prob2 * UNIQUE_BONUS / 100; + + } + } + /* Total */ total += table[i].prob3; }