Difference between revisions of "User:Ion frigate/difficulty"

From NetHackWiki
Jump to navigation Jump to search
Line 1: Line 1:
==From makedefs.c for SLASH'EM==
+
From source code found [http://www.koders.com/cpp/fid53CE3B8D7938E4B74C71CD552F97FB03DEAFA430.aspx?s=game#L1421 here], I infer that, in SLASH'EM, difficulty is computed as follows:
/*
+
We have an integer, n
ranged_attk(ptr) /* returns TRUE if monster can attack at range */
+
===Generation in groups===
register struct permonst *ptr;
+
*+1 for small groups
{
+
*+2 for large groups
register int i, j;
+
*+4 for very large groups
register int atk_mask = (1<<AT_BREA) | (1<<AT_SPIT) | (1<<AT_GAZE);
+
===Ranged attacks===
 
+
*+1 for any gaze, spit, breath, weapon or magic attack (all can be ranged)
for(i = 0; i < NATTK; i++) {
+
===Armor class===
    if((j=ptr->mattk[i].aatyp) >= AT_WEAP || (atk_mask & (1<<j)))
+
*+1 for base AC < 4
return TRUE;
+
*+1 for base AC < 0 (these two combine)
}
+
===Speed===
 
+
*+1 if speed >= 18
return(FALSE);
+
===Attacks===
}
 
 
 
/* This routine is designed to return an integer value which represents
 
* an approximation of monster strength.  It uses a similar method of
 
* determination as "experience()" to arrive at the strength.
 
*/
 
static int
 
mstrength(ptr)
 
struct permonst *ptr;
 
{
 
int i, tmp2, n, tmp = ptr->mlevel;
 
 
 
if(tmp > 49) /* special fixed hp monster */
 
    tmp = 2*(tmp - 6) / 4;
 
 
 
/* For creation in groups */
 
n = (!!(ptr->geno & G_SGROUP));
 
n += (!!(ptr->geno & G_LGROUP)) << 1;
 
n += (!!(ptr->geno & G_VLGROUP)) << 2;
 
 
 
/* For ranged attacks */
 
if (ranged_attk(ptr)) n++;
 
 
 
/* For higher ac values */
 
n += (ptr->ac < 4);
 
n += (ptr->ac < 0);
 
 
 
/* For very fast monsters */
 
n += (ptr->mmove >= 18);
 
 
 
/* For each attack and "special" attack */
 
for(i = 0; i < NATTK; i++) {
 
 
 
    tmp2 = ptr->mattk[i].aatyp;
 
    n += (tmp2 > 0);
 
    n += (tmp2 == AT_MAGC);
 
    n += (tmp2 == AT_WEAP && (ptr->mflags2 & M2_STRONG));
 
}
 
 
 
/* For each "special" damage type */
 
for(i = 0; i < NATTK; i++) {
 
 
 
    tmp2 = ptr->mattk[i].adtyp;
 
    if ((tmp2 == AD_DRLI) || (tmp2 == AD_STON) || (tmp2 == AD_DRST)
 
|| (tmp2 == AD_DRDX) || (tmp2 == AD_DRCO) || (tmp2 == AD_WERE))
 
n += 2;
 
    else if (strcmp(ptr->mname, "grid bug")) n += (tmp2 != AD_PHYS);
 
    n += ((int) (ptr->mattk[i].damd * ptr->mattk[i].damn) > 23);
 
}
 
/* tom's nasties */
 
if (extra_nasty(ptr)) n += 5;
 
 
 
/* Leprechauns are special cases.  They have many hit dice so they
 
can hit and are hard to kill, but they don't really do much damage. */
 
if (!strcmp(ptr->mname, "leprechaun")) n -= 2;
 
 
 
/* Finally, adjust the monster level  0 <= n <= 24 (approx.) */
 
if(n == 0) tmp--;
 
else if(n >= 6) tmp += ( n / 2 );
 
else tmp += ( n / 3 + 1);
 
 
 
return((tmp >= 0) ? tmp : 0);
 
}
 
*/
 
If I read this correctly, it goes, with n = 0
 
+1 for small groups
 
+2 for large groups
 
+4 for very large groups (do they exist?)
 
+1 for ranged (breath, spit, gaze) attack
 
+1 for AC < 4
 
+1 for AC < 0
 
+1 for speed > 18
 
 
For each attack:
 
For each attack:
+1 if it exists
+
*+1 if it is not passive
+1 if it is a spellcasting attack
+
*+1 if it is a magic (AT_MAGC) attack
+1 if it is a weapon attack and the monster is strong
+
*+1 if it is a weapon (AT_WEAP) attack, and monster has the M2_STRONG flag
+2 if it is poison (dexterity, const. or strength), drain life, stoning or lycanthrope
+
*+2 if it is poisonous (AD_DRST, AD_DRDX, AD_DRCO), drain life (AD_DRLI), stoning (AD_STON) or lycanthropy (AD_WERE)
+1 if it is read as kdx, if kx > 23 (can do 24 or more damage)
+
*+1 if it is not one of the immediate above, and is also not pure physical damage (AD_PHYS)
Then
+
*+1 if it can do 24 or more "damage" (specifically, if it is ndm, if nm > 23); does not have to be physical damage
+5 for extra-nasty monsters (M2_NASTY)
+
===Nastiness===
If n=0, difficulty is monster's level - 1
+
*+5 if it has the M2_NASTY flag (note that this does not seem to be true for vanilla NetHack, from checking monsters both with and without it, this formula matches for those without, but is off by the right amount for those with
if n>=6, difficulty is monster's level + n/2
+
Then, we have tmp; if mlevel <= 49, tmp = mlevel; otherwise tmp = .5 * (mlevel - 6)
if 0<n<6, difficulty is monster's level + 1 + n/3
+
Now, what is difficulty?
Exception; substitute .5*(mlevel-6) for mlevel if mlevel > 49 - only would be relevant to high-level demons, no randomly generated monster has a level greater than 39
+
If n = 0, difficulty is tmp - 1
 +
If 0 < n < 6, difficulty is tmp + 1 + n/3
 +
If n >= 6, difficulty is tmp + n/2
 +
Rounding down for integer division

Revision as of 03:25, 1 January 2010

From source code found here, I infer that, in SLASH'EM, difficulty is computed as follows: We have an integer, n

Generation in groups

  • +1 for small groups
  • +2 for large groups
  • +4 for very large groups

Ranged attacks

  • +1 for any gaze, spit, breath, weapon or magic attack (all can be ranged)

Armor class

  • +1 for base AC < 4
  • +1 for base AC < 0 (these two combine)

Speed

  • +1 if speed >= 18

Attacks

For each attack:

  • +1 if it is not passive
  • +1 if it is a magic (AT_MAGC) attack
  • +1 if it is a weapon (AT_WEAP) attack, and monster has the M2_STRONG flag
  • +2 if it is poisonous (AD_DRST, AD_DRDX, AD_DRCO), drain life (AD_DRLI), stoning (AD_STON) or lycanthropy (AD_WERE)
  • +1 if it is not one of the immediate above, and is also not pure physical damage (AD_PHYS)
  • +1 if it can do 24 or more "damage" (specifically, if it is ndm, if nm > 23); does not have to be physical damage

Nastiness

  • +5 if it has the M2_NASTY flag (note that this does not seem to be true for vanilla NetHack, from checking monsters both with and without it, this formula matches for those without, but is off by the right amount for those with

Then, we have tmp; if mlevel <= 49, tmp = mlevel; otherwise tmp = .5 * (mlevel - 6) Now, what is difficulty? If n = 0, difficulty is tmp - 1 If 0 < n < 6, difficulty is tmp + 1 + n/3 If n >= 6, difficulty is tmp + n/2 Rounding down for integer division