User Name:


Forgot your password?
Vote for Us!
AFKMud 2.2.2
Mar 3, 2019 5:35 pm
By Samson
Nov 28, 2018 12:10 pm
By Keirath
First Immortal
Oct 12, 2018 2:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018 7:31 pm
By joeyfogas
question on overland code
May 31, 2018 12:03 pm
By joeyfogas
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
AFKMud 2.2.2
Author: AFKMud Team
Submitted by: Samson
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
Users Online

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

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

Pages:<< prev 1 next >>
Post is unread #1 Feb 19, 2006 1:17 pm
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.
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_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;

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_SET macro, be it TRUE or FALSE. The above function was adapted from the AFKMud 2.0 C++ code. In addition to fixing the issue it is also visually easier to follow, and takes up fewer lines.
Pages:<< prev 1 next >>