Re: [newbie] Regen and exp penalty for races?

From: Edward J Glamkowski (
Date: 06/11/02

>does anyone have a snippet or idea how to give races regen bonuses
>and exp penalties?

In limits.c in mana_gain, hit_gain, move_gain, just add in another
if according to the bonuses and penalties you want.

In hit_gain you might add right before the return statment:

if (IS_GIANT(ch))
  gain *= 2;

while in mana_gain you would add:

if (IS_GIANT(ch))
  gain /= 2;

As for experience, it is very similar.  Look at gain_exp(), also in
limits.c and add similar statements as for regen.

>and does anyone know how to give them permanent effects, like

Infravision has been brought up many times, and I see only two
real solutions that would work.   Create a new bitvector RACE_AFF,
though they you probably will have a lot of duplicate functionality.
If you use the normal AFF flags, you run into problems with the
unaffect command or if you make a dispel spell.  You could just
re-add the innate racial abilities in each place where they might
be removed, but eventually you WILL lose synch on this and it will
become more hassle then it is worth.

The better solution is to hard code such AFFs.  Racial infravision,
for example, is just a part of the CAN_SEE_IN_DARK macro instead of
any flag.  For example (I give all non-human races infravision but
you can easily change it to whatever):

#define HAS_INFRAVISION(ch)  (!IS_HUMAN(ch))
#define CAN_SEE_IN_DARK(ch) \
   (HAS_INFRAVISION(ch) || \
         (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))

Is your boss reading your email? ....Probably
Keep your messages private by using Lycos Mail.
Sign up today at

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT