Re: Question about the Strength Spell

From: Johan Dustler (epkjodu@hmepks1.ericsson.se)
Date: 06/19/96


> From: Dann Fuller <dannimal@umich.edu>
> 
> As near as I can tell, when you cast STR, nowhere does it check to make 
> sure you don't go over the limit of 18/100.  This is bad, because if 
> you're at 18/100 when you cast it, bad thigns happen to your stats.  
> 
> After looking at the code, I can think of a couple of places to put the 
> check in, but before I do, I was wondering if others had noticed this, 
> and how they went about fixing it if they have.  TIA
> 
>   Dann
> 
> _____________________________________________________________________________
> Dann Fuller 						   dannimal@umich.edu
> ITD Contract Services System Administrator	      www.umich.edu/~dannimal
> Kinesiology Administration  			      764-4015     
> School of Public Policy				      764-8004
> "He fell out of the Stupid tree and hit every branch on the way down."
> 
> 

There is already a check for this. If you check the function calls from
mag_affects <magic.c> you will see that it calls affect_join <handler.c>.
If you continue tracing function calls from affect_join you will end up
in affect_total <handler.c>. In the second half of this function the check
is made:

  /* Make certain values are between 0..25, not < 0 and not > 25! */
 
  i = (IS_NPC(ch) ? 25 : 18);
 
  GET_DEX(ch) = MAX(0, MIN(GET_DEX(ch), i));
  GET_INT(ch) = MAX(0, MIN(GET_INT(ch), i));
  GET_WIS(ch) = MAX(0, MIN(GET_WIS(ch), i));
  GET_CON(ch) = MAX(0, MIN(GET_CON(ch), i));
  GET_STR(ch) = MAX(0, GET_STR(ch));
 
  if (IS_NPC(ch)) {
    GET_STR(ch) = MIN(GET_STR(ch), i);
  } else {
|->    if (GET_STR(ch) > 18) {
|->      i = GET_ADD(ch) + ((GET_STR(ch) - 18) * 10);
|->      GET_ADD(ch) = MIN(i, 100);
|->      GET_STR(ch) = 18;
|    }
|  }
|
|

This part sets the str_add to a maximum of 100.

-Johan



This archive was generated by hypermail 2b30 : 12/18/00 PST