removing affect bits

From: linebacker (linebacker@microlink.net)
Date: 07/12/96


I have added an improved invis spell and I want to make it so
that when a player casts it, it will check to see if the player
is affected by the other invisibility spell and if so, remove that
affect.

I have added the following code along with several other atempts, and they
all compile fine but none of them will remove the invisibility affect before
applying the improved affect. (thus the player has armor bonuses from both
spell)

here is the last thing I tried:

ASPELL(spell_improved_invis)
{
   void appear(struct char_data * ch);
   struct affected_type af;

   assert((ch && obj) || victim);

   if (obj) {
      if (IS_SET(obj->obj_flags.extra_flags, ITEM_NOINVIS)) {
         send_to_char("You failed.\n\r", ch);
         return; 
    }

      if (!IS_SET(obj->obj_flags.extra_flags, ITEM_INVISIBLE) ) {
         act("$p turns invisible.", FALSE, ch, obj, 0, TO_CHAR);
         act("$p turns invisible.", TRUE, ch, obj, 0, TO_ROOM);
         SET_BIT(obj->obj_flags.extra_flags, ITEM_INVISIBLE);
      }
   } else {              /* Then it is a PC | NPC */
/*********************************************************/
/*********************************************************/
/* HERE IS THE CHECK I AM TRYING TO ADD */

     if (IS_AFFECTED(victim, AFF_INVISIBLE) || IS_AFFECTED(ch, AFF_INVISIBLE)) {
        appear(ch);
        } 
     if (!affected_by_spell(victim, SPELL_IMPROVED_INVIS)) {

         act("$n slowly fades out of existence.", TRUE, victim, 0, 0, TO_ROOM);
         send_to_char("You vanish.\n\r", victim);

         af.type      = SPELL_IMPROVED_INVIS;
         af.duration  = GET_LEVEL(ch);
         af.modifier  = -60;
         af.location  = APPLY_AC;
         af.bitvector = AFF_INVISIBLE;
         affect_to_char(victim, &af);
      }
  }
}
Has anyone done anything like this? What do I need to do to remove a spell
affect?
thanks in advance,
Chuck
-
######################################################################
##  						          	    ##
##  Chuck Carson        	University of Missouri -- Rolla     ##
##  linebacker@microlink.net    Dept. of Electrical Engr.           ##
##  http://www.microlink.net/~linebacker                            ##
##		                                                    ##
######################################################################

            ^ INSERT PASSE NON-ORIGINAL SAYING HERE ^



This archive was generated by hypermail 2b30 : 12/07/00 PST