New RIS (resistance, immune, susceptible) types

Posted by Tseris on Sun 14 Oct 2007 08:43 AM — 6 posts, 27,558 views.

#0
First of all Id like to thank all of you who are helping new mud builders like me with all of our variable and sometimes obscure problems. I read this forum for a couple weeks before I started posting to it, and you guys' patience seems to be endless. So thank you.

And on to my current issue. I wrote out the words in the subject box in case anyone else tries to search the same thing. Id like to add new RIS types for use with weapons, spells, races, etc. and would like to know what all I need to look at and change. Heres what Ive seen so far:

in mud.h:
/*
* Resistant Immune Susceptible flags
*/
#define RIS_FIRE BV00
#define RIS_COLD BV01
#define RIS_ELECTRICITY BV02
#define RIS_ENERGY BV03
#define RIS_BLUNT BV04
#define RIS_PIERCE BV05
#define RIS_SLASH BV06
#define RIS_ACID BV07
#define RIS_POISON BV08
#define RIS_DRAIN BV09
#define RIS_SLEEP BV10
#define RIS_CHARM BV11
#define RIS_HOLD BV12
#define RIS_NONMAGIC BV13
#define RIS_PLUS1 BV14
#define RIS_PLUS2 BV15
#define RIS_PLUS3 BV16
#define RIS_PLUS4 BV17
#define RIS_PLUS5 BV18
#define RIS_PLUS6 BV19
#define RIS_MAGIC BV20
#define RIS_PARALYSIS BV21
/* 21 RIS's*/

in magic.c:
/*
* Is immune to a damage type
*/
bool is_immune( CHAR_DATA * ch, short damtype )
{
switch ( damtype )
{
case SD_FIRE:
return ( IS_SET( ch->immune, RIS_FIRE ) );
case SD_COLD:
return ( IS_SET( ch->immune, RIS_COLD ) );
case SD_ELECTRICITY:
return ( IS_SET( ch->immune, RIS_ELECTRICITY ) );
case SD_ENERGY:
return ( IS_SET( ch->immune, RIS_ENERGY ) );
case SD_ACID:
return ( IS_SET( ch->immune, RIS_ACID ) );
case SD_POISON:
return ( IS_SET( ch->immune, RIS_POISON ) );
case SD_DRAIN:
return ( IS_SET( ch->immune, RIS_DRAIN ) );
}
return FALSE;
}

Changing the Plus1 to 'Holy' or whatever is simple enough, and 6 extras is plenty. But id like to know where else id need to change things. Thanks alot. Tseris
USA #1
grep is your friend. ;)
#2
Hrmm. Okay used grep on RIS_FIRE so that I could add my own RIS_HOLY, and made changes to magic.c, mud_comm.c, and mud.h, but ran into a problem in fight.c:

fight.c: In function ‘ch_ret one_hit(CHAR_DATA*, CHAR_DATA*, int)’:
fight.c:1258: error: ‘RIS_PLUS1’ was not declared in this scope
fight.c:1269: error: ‘RIS_PLUS1’ was not declared in this scope
fight.c: In function ‘ch_ret projectile_hit(CHAR_DATA*, CHAR_DATA*, OBJ_DATA*, OBJ_DATA*, short int)’:
fight.c:1584: error: ‘RIS_PLUS1’ was not declared in this scope
fight.c:1595: error: ‘RIS_PLUS1’ was not declared in this scope
fight.c: In function ‘ch_ret damage(CHAR_DATA*, CHAR_DATA*, int, int)’:
fight.c:1816: error: ‘IS_HOLY’ was not declared in this scope
make[1]: *** [o/fight.o] Error 1
make: *** [all] Error 2



I replaced RIS_PLUS1 with RIS_HOLY, thinking that RIS_PLUS1 through RIS_PLUS6 were extras, but its looking like those are used for resisting weapon damage? So should I just add an extra RIS at the end of RIS types in mud.h?
#3
Okay, now my mud.h looks like this:

/*
* Resistant Immune Susceptible flags
*/
#define RIS_FIRE BV00
#define RIS_COLD BV01
#define RIS_ELECTRICITY BV02
#define RIS_ENERGY BV03
#define RIS_BLUNT BV04
#define RIS_PIERCE BV05
#define RIS_SLASH BV06
#define RIS_ACID BV07
#define RIS_POISON BV08
#define RIS_DRAIN BV09
#define RIS_SLEEP BV10
#define RIS_CHARM BV11
#define RIS_HOLD BV12
#define RIS_NONMAGIC BV13
#define RIS_PLUS1 BV14
#define RIS_PLUS2 BV15
#define RIS_PLUS3 BV16
#define RIS_PLUS4 BV17
#define RIS_PLUS5 BV18
#define RIS_PLUS6 BV19
#define RIS_MAGIC BV20
#define RIS_PARALYSIS BV21
#define RIS_HOLY BV22
/* 22 RIS's*/


and my fight.c looks like this:

/*
* Check damage types for RIS -Thoric
*/
if( dam && dt != TYPE_UNDEFINED )
{
if( IS_FIRE( dt ) )
dam = ris_damage( victim, dam, RIS_FIRE );
else if( IS_COLD( dt ) )
dam = ris_damage( victim, dam, RIS_COLD );
else if( IS_ACID( dt ) )
dam = ris_damage( victim, dam, RIS_ACID );
else if( IS_ELECTRICITY( dt ) )
dam = ris_damage( victim, dam, RIS_ELECTRICITY );
else if( IS_ENERGY( dt ) )
dam = ris_damage( victim, dam, RIS_ENERGY );
else if( IS_DRAIN( dt ) )
dam = ris_damage( victim, dam, RIS_DRAIN );
else if( IS_HOLY( dt ) )
dam = ris_damage( victim, dam, RIS_HOLY ); /* Tseris */
else if( dt == gsn_poison || IS_POISON( dt ) )
dam = ris_damage( victim, dam, RIS_POISON );


but my compile looks like this:

Compiling o/fight.o....
fight.c: In function ‘ch_ret damage(CHAR_DATA*, CHAR_DATA*, int, int)’:
fight.c:1816: error: ‘IS_HOLY’ was not declared in this scope
make[1]: *** [o/fight.o] Error 1
make: *** [all] Error 2




Thoughts?
USA #4
Look for the definitions of IS_DRAIN, IS_ENERGY and so forth. You'll need to add one for IS_HOLY. (Again, grep is your friend for finding those definitions. Or search in mud.h with a text editor.)
#5
Found it. Defined IS_HOLY and SD_HOLY and clean compile. You're the bomb.