/* NOTE, THIS IS A QUICK CODE PIECED TOGETHER IN HORRIBLE FASHION!
 *
 *
 *  This is a cheap WEAPON_DISPEL flag to allow for very powerful
 *  weapon dispels on striking.  I threw it together very quickly
 *  and will probably be revamping the fight.c code in due time. 
 *  I require no credits for this snippet because:
 *     
 *      1. It's quite easy to do.
 *      2. It's probably been posted before.
 *      3. It's a dispel code, not something original like an ASCII Automapper.
 *
 *  Go ahead and use this code as freely as you want. 
 *  Hack it up and slash it up, and flush it down the toilet and write
 *  a better one. I just threw this together in a hurry to test
 *  WEAPON_DISPEL flags.  
 *
 *
 *  I compiled this code using QuickMUD so it should compile for 
 *  most ROM based MUDs.  This code is as-is.  I will not offer 
 *  any help to anyone because I'm not the best guy to be asking for help :)
 *
 *
 *
 *
 *
 *
 *  If you feel the code is dispelling too often, or not enough,
 *  change the numbers in: fight.c
 * 
 *
 *  wskill = 15 * get_weapon_skill (ch, get_weapon_sn(ch)) / 100;
 *
 *
 *  The % chance to dispel is based on how well the character is skilled
 *  with the weapon he/she is using. With the above line, the maximum %
 *  chance to dispel is 15%
 *
 *
 *     Vexor, mudgod_dave@yahoo.com
 *     http://madhax.homedns.org
 *
 *
 */  



---- in merc.h, under the /* weapon types */ -----


    #define WEAPON_FLAMING    (A)
    #define WEAPON_FROST      (B)
    #define WEAPON_VAMPIRIC   (C)
    #define WEAPON_SHARP      (D)
    #define WEAPON_VORPAL     (E)
    #define WEAPON_TWO_HANDS  (F)
    #define WEAPON_SHOCKING   (G)
    #define WEAPON_POISON     (H)
    #define WEAPON_DISPEL     (I)  /* ADD WEAPON_DISPEL AT FIRST AVAILABLE FLAG, MINE WAS (I) */





---- in act_obj.c, in function do_envenom   /*OPTIONAL*/ -----

/*This prevents PC's from envenoming a DISPEL weapon */

find:

    if (obj->item_type == ITEM_WEAPON)
    {
        if (IS_WEAPON_STAT (obj, WEAPON_FLAMING)
            || IS_WEAPON_STAT (obj, WEAPON_FROST)
            || IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC)
            || IS_WEAPON_STAT (obj, WEAPON_SHARP)
            || IS_WEAPON_STAT (obj, WEAPON_VORPAL)
            || IS_WEAPON_STAT (obj, WEAPON_SHOCKING)
            || IS_OBJ_STAT (obj, ITEM_BLESS)
            || IS_OBJ_STAT (obj, ITEM_BURN_PROOF))


Add, so it looks like:

   if (obj->item_type == ITEM_WEAPON)
    {
        if (IS_WEAPON_STAT (obj, WEAPON_FLAMING)
            || IS_WEAPON_STAT (obj, WEAPON_FROST)
            || IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC)
            || IS_WEAPON_STAT (obj, WEAPON_SHARP)
            || IS_WEAPON_STAT (obj, WEAPON_VORPAL)
            || IS_WEAPON_STAT (obj, WEAPON_SHOCKING)
            || IS_OBJ_STAT (obj, ITEM_BLESS)
            || IS_OBJ_STAT (obj, ITEM_BURN_PROOF)
	    || IS_OBJ_STAT (obj, WEAPON_DISPEL))	



---- in handler.c, in char *weapon_bit_name ----

Add:
    
     if (weapon_flags & WEAPON_DISPEL)
         strcat (buf, " dispels-magic");




---- in magic.c, in void spell_poison,  /*OPTIONAL*/ ----


---- Find: ----
    
      if (obj->item_type == ITEM_WEAPON)
        {
            if (IS_WEAPON_STAT (obj, WEAPON_FLAMING)
                || IS_WEAPON_STAT (obj, WEAPON_FROST)
                || IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC)
                || IS_WEAPON_STAT (obj, WEAPON_SHARP)
                || IS_WEAPON_STAT (obj, WEAPON_VORPAL)
                || IS_WEAPON_STAT (obj, WEAPON_SHOCKING)
                || IS_OBJ_STAT (obj, ITEM_BLESS)
                || IS_OBJ_STAT (obj, ITEM_BURN_PROOF))





---- Add: so it looks like, ----

       if (obj->item_type == ITEM_WEAPON)
        {
            if (IS_WEAPON_STAT (obj, WEAPON_FLAMING)
                || IS_WEAPON_STAT (obj, WEAPON_FROST)
                || IS_WEAPON_STAT (obj, WEAPON_VAMPIRIC)
                || IS_WEAPON_STAT (obj, WEAPON_SHARP)
                || IS_WEAPON_STAT (obj, WEAPON_VORPAL)
                || IS_WEAPON_STAT (obj, WEAPON_SHOCKING)
                || IS_OBJ_STAT (obj, ITEM_BLESS)
                || IS_OBJ_STAT (obj, ITEM_BURN_PROOF)
                || IS_OBJ_STAT (obj, WEAPON_DISPEL))





---- in tables.c, in const struct flag_type weapon_type2[] ----


const struct flag_type weapon_type2[] = {
    {"flaming", WEAPON_FLAMING, TRUE},
    {"frost", WEAPON_FROST, TRUE},
    {"vampiric", WEAPON_VAMPIRIC, TRUE},
    {"sharp", WEAPON_SHARP, TRUE},
    {"vorpal", WEAPON_VORPAL, TRUE},
    {"twohands", WEAPON_TWO_HANDS, TRUE},
    {"shocking", WEAPON_SHOCKING, TRUE},
    {"poison", WEAPON_POISON, TRUE},
    {"dispels-magic", WEAPON_DISPEL, TRUE},  /* ADDED DISPEL PROPERTY FOR 'identify' and 'stat' and OLC */
    {NULL, 0, 0}
};






---- in fight.c, in one_hit,  ----



--- Find: ---

    
 int dam;


        if (ch->fighting == victim && IS_WEAPON_STAT (wield, WEAPON_POISON))
        {
            int level;
            AFFECT_DATA *poison, af;








---- Add this above the 'int dam;' statement ----



    /* WEAPON_DISPEL PROPERTY */
            if (ch->fighting == victim && IS_WEAPON_STAT(wield, WEAPON_DISPEL))
               {
                 int wskill;
                 int chance = number_percent();
                 char buf[MAX_STRING_LENGTH];
                 int sn;
                 AFFECT_DATA *af;
                 wskill = 15 * get_weapon_skill (ch, get_weapon_sn(ch)) / 100;

                 if ( chance < wskill )
                    {
                     /*if ( number_percent() < 10 )
                       {*/

                      for ( sn = 0; sn < MAX_SKILL; sn++ )
                       {

                        if (is_affected (victim, sn))
                        {
                            for (af = victim->affected; af != NULL; af = af->next)
                            {
                                if (af->type == sn)
                                {
                                        affect_strip (victim, sn);
                                        if (skill_table[sn].msg_off)
                                        {
                                            send_to_char (skill_table[sn].msg_off, victim);
                                            send_to_char ("\n\r", victim);
                                            if (skill_table[sn].name != NULL)
                                              {
                                            sprintf(buf,"{M%s {Mdispels %s's %s!{x\n\r",wield->short_descr,
                                                         victim->name, skill_table[sn].name);
                                            send_to_char(buf,ch);
                                              }
                                        }
                                        return;
                                }
                                  af->level--;
                            }
                        }
                       }

                    }

               }