[Question] Sanity checking with affects

From: Dust (dustlos@hotmail.com)
Date: 06/01/01


Hey, I just wanted to check with others to see if this seems correct. I have
it so stats go past 25 naturally (race and such), and I have made #defines
to get the player's real abilities GET_RSTR compared to GET_STR which gets
the aff_abilities. Now, I need to make sure if this will work under any
circumstances...

I've done some prelimnary testing with it and it seems to work

#define URANGE(a, b, c)          ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b)))
// gets A if B is too small, gets C if B is too large

in affect_modify within handler.c

  GET_STR(ch) = URANGE(3, GET_STR(ch), 25);
  GET_DEX(ch) = URANGE(3, GET_DEX(ch), 25);
  GET_CON(ch) = URANGE(3, GET_CON(ch), 25);
  GET_INT(ch) = URANGE(3, GET_INT(ch), 25);
  GET_WIS(ch) = URANGE(3, GET_WIS(ch), 25);
  GET_CHA(ch) = URANGE(3, GET_CHA(ch), 25);

  /* Sanity checking, if they had a spell which did +2 str
   * but they already had 25 str, it would affect_remove them
   * down to 23 str which would suck. This is only checked if
   * we are remove the affect */
  if ((GET_RSTR(ch) > GET_STR(ch)) && !add)
      GET_STR(ch) = GET_RSTR(ch);
  if ((GET_RDEX(ch) > GET_DEX(ch)) && !add)
      GET_DEX(ch) = GET_RDEX(ch);
  if ((GET_RCON(ch) > GET_CON(ch)) && !add)
      GET_CON(ch) = GET_RCON(ch);
  if ((GET_RINT(ch) > GET_INT(ch)) && !add)
      GET_INT(ch) = GET_RINT(ch);
  if ((GET_RWIS(ch) > GET_WIS(ch)) && !add)
      GET_WIS(ch) = GET_RWIS(ch);
  if ((GET_RCHA(ch) > GET_CHA(ch)) && !add)
      GET_CHA(ch) = GET_RCHA(ch);

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST