[CF-Devel] dragon food messages

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Wed Apr 16 19:49:05 CDT 2003


This patch will generate more precise messages for dragons eating body
parts.

In the old way "The blah had a boring taste." could mean anything
from 0 to 5.9 % chance of gaining a resistance.
(Yes, including zero as (int)chance*100 will floor x < 0.01 to 0)

With this patch, any "boring" food does have a chance of at least 0.01 % .

I also filled the gap from "boring" to "good" with "bland".

So now we have:

   chance          | message  | average amount needed for +1

          x = 0      no taste   {}
 0.01  <= x <=  0.1  boring     [1000,10000)
 0.1    < x <=  1.0  bland      [100,1000)
 1.0    < x <= 10.0  good       [10,100)
10.0    < x <= 50.0  very good  [2,10)
50.0    < x          delicious  [1,2)

With x the total chance (in %) of gaining a resistance level.

I have not changed the chance to get resistances, only the feedback.

Bernd Edler
-------------- next part --------------
*** apply.c.old	Thu Apr 17 00:30:49 2003
--- apply.c	Thu Apr 17 01:49:08 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;
        
        /*printf("   %s: bonus %.1f, chance %.1f\n", attacks[i], bonus, chance);*/
      }
    }
    
!   /* inverse totalchance as until now we have the failure-chance   */
!   totalchance = 1 - totalchance;
!   /* 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