Disarm skill

From: Mark Garringer (zizazat@rmii.com)
Date: 07/30/95


It just would not be the weekend if I did not have a question for the 
group ;)

I am trying to add a disarm skill for warriors in my MUD. I have gotten 
it mostly done. You can practice it, and if you try to disarm a 
weaponless opponent is tell you such, but it just simply will not work as 
it should. Here is the code that I added to act.offensive, and fight.c:

ACMD(do_disarm)
{
   struct char_data *victim;
   byte percent, prob;
   if (GET_CLASS(ch) != CLASS_WARRIOR) {
      send_to_char("You'd better leave all that to the fighters.\n\r", ch);
      return;
   }
    if victim = ch->specials.fighting;
      } else {
         send_to_char("Disarm who?\n\r", ch);
         return;
      }
   }
   
   if (victim == ch) {
      send_to_char("Aren't we funny today...\n\r", ch);
      return;
   }
   percent = number(1, 101); /* 101% is a complete failure */
   prob = GET_SKILL(ch, SKILL_DISARM);
   
   if (percent > prob) {
      disarm(ch, victim);
   } else
   act ("You failed to disarm $s.", FALSE, ch, 0, 0, TO_CHAR);
   WAIT_STATE(ch, PULSE_VIOLENCE * 2);
}

And in fight.c:

void disarm( struct char_data *ch, struct char_data *victim )
{
    struct obj_data *obj;
    obj = (victim->equipment[WIELD]);
    if ( (victim->equipment[WIELD]) == NULL )
        act( "$s weapon seems to be $s hands.", FALSE, ch, 0, 0, TO_CHAR);
        return;  
    act( "$n tries to disarm you, but $p won't come off your hand!", 
FALSE, ch, 0, 0, TO_VICTIM);
        act( "You try to knock the weapon from $S hand, but it is 
useless!", FALSE, ch, 0, 0, TO_CHAR);
        return;
    }
    act( "$n disarms you and sends your weapon flying!", TRUE, ch, 0, 0, 
TO_VICTIM);
    act( "You have managed to disarm $N!",  TRUE, ch, 0, 0, TO_CHAR );
    act( "$n disarms $N!",  TRUE, ch, 0, 0, TO_ROOM );
    obj_from_char( obj );
    obj_to_room( obj, victim->in_room );
    
    return;
}

Suggestions?

Thanks.

--Ziz, NetShamen



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