[CF-Devel] dragon food messages
crossfire-devel-admin at archives.real-time.com
crossfire-devel-admin at archives.real-time.com
Wed Apr 16 20:59:25 CDT 2003
Rather use this diff, i wrongly used mathematical propabilities
instead of percentage values.
-------------- next part --------------
*** apply.c.old Thu Apr 17 00:30:49 2003
--- apply.c Thu Apr 17 03:50:41 2003
***************
*** 1868,1874 ****
char buf[MAX_BUF]; /* tmp. string buffer */
double chance; /* improvement-chance of one resistance type */
! double maxchance=0; /* highest chance of any type */
double bonus=0; /* level bonus (improvement is easier at lowlevel) */
double mbonus=0; /* monster bonus */
int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */
--- 1868,1874 ----
char buf[MAX_BUF]; /* tmp. string buffer */
double chance; /* improvement-chance of one resistance type */
! double totalchance=1; /* total chance of gaining one resistance */
double bonus=0; /* level bonus (improvement is easier at lowlevel) */
double mbonus=0; /* monster bonus */
int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */
***************
*** 1941,1960 ****
winners++;
}
! if (chance > maxchance) maxchance = chance;
/*printf(" %s: bonus %.1f, chance %.1f\n", attacks[i], bonus, chance);*/
}
}
! /* print message according to maxchance */
! if (maxchance > 50.)
sprintf(buf, "Hmm! The %s tasted delicious!", meal->name);
! else if (maxchance > 10.)
sprintf(buf, "The %s tasted very good.", meal->name);
! else if (maxchance > 1.)
sprintf(buf, "The %s tasted good.", meal->name);
! else if (maxchance > 0.0001)
sprintf(buf, "The %s had a boring taste.", meal->name);
else if (meal->last_eat > 0 && atnr_is_dragon_enabled(meal->last_eat))
sprintf(buf, "The %s tasted strange.", meal->name);
--- 1941,1964 ----
winners++;
}
! if (chance >= 0.01 ) totalchance *= 1 - chance/100;
/*printf(" %s: bonus %.1f, chance %.1f\n", attacks[i], bonus, chance);*/
}
}
! /* inverse totalchance as until now we have the failure-chance */
! totalchance = 100 - totalchance*100;
! /* print message according to totalchance */
! if (totalchance > 50.)
sprintf(buf, "Hmm! The %s tasted delicious!", meal->name);
! else if (totalchance > 10.)
sprintf(buf, "The %s tasted very good.", meal->name);
! else if (totalchance > 1.)
sprintf(buf, "The %s tasted good.", meal->name);
! else if (totalchance > 0.1)
! sprintf(buf, "The %s tasted bland.", meal->name);
! else if (totalchance >= 0.01)
sprintf(buf, "The %s had a boring taste.", meal->name);
else if (meal->last_eat > 0 && atnr_is_dragon_enabled(meal->last_eat))
sprintf(buf, "The %s tasted strange.", meal->name);
More information about the crossfire
mailing list