User Name:


Forgot your password?
Vote for Us!
 alias snippet fix
Yesterday, 6:14 pm
By Vladaar
 help with debug?
Yesterday, 5:52 pm
By joeyfogas
features of a good MUD
Yesterday, 1:06 am
By GatewaySysop
All skills to a class?
Mar 15, 2018, 11:43 pm
By joeyfogas
help with syntax for mobprog (smaug)
Mar 14, 2018, 10:34 pm
By joeyfogas
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Google

Members: 0
Guests: 8
Newest Member
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Spell immunity checks a...
Forum Rules | Mark all | Recent Posts

[Bug] Spell immunity checks are not working properly
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Feb 19, 2006, 11:10 am
Go to the top of the page
Go to the bottom of the page

Black Hand
JoinedJan 1, 2002

Bug: Spell immunity checks are not working properly
Danger: Medium - Expected immunity may not work, or may report successful even when not set.
Discovered in: AFKMud 1.77
Found by: Matteo2303
Fixed by: Samson


magic.c, is_immune

Replace that function with this new one:
bool is_immune( CHAR_DATA *ch, short damtype )
   switch( damtype )
      case SD_FIRE:           return( IS_IMMUNE( ch, RIS_FIRE ) );
      case SD_COLD:           return( IS_IMMUNE( ch, RIS_COLD ) );
      case SD_ELECTRICITY:    return( IS_IMMUNE( ch, RIS_ELECTRICITY ) );
      case SD_ENERGY:         return( IS_IMMUNE( ch, RIS_ENERGY ) );
      case SD_ACID:           return( IS_IMMUNE( ch, RIS_ACID ) );
      case SD_POISON:         return( IS_IMMUNE( ch, RIS_POISON ) );
      case SD_DRAIN:          return( IS_IMMUNE( ch, RIS_DRAIN ) );
   return FALSE;

The is_immune function checks for the immunity to types of spell damage. It is supposed to return TRUE upon a successul check, and FALSE if not. Apparently the way the original function worked the switch was able to fall through to something else and report a false positive if another immunity was present on the player. It is assumed that this could also have worked the other way. In either case, the above function fixes the issue by returning the direct result of the IS_IMMUNE macro, be it TRUE or FALSE. The above function was adapted from the C++ 2.0 code. In addition to fixing the issue it is also visually easier to follow, and takes up fewer lines.
Pages:<< prev 1 next >>