Re: Disarm Skill

From: Hai Nguyen (hai@progsoc.uts.edu.au)
Date: 10/17/95


On Mon, 16 Oct 1995, Entreri wrote:

> Hello,
> 	I am having some troubles with a skill that i just coded, disarm.
> It seems to enjoy slamming the weapon into a room that is "somewhere" and
> doesn't have a vnum :)
> 
> [code begins]
> ACMD(do_disarm)
> {
>   struct char_data *vict;
>   int percent, prob;
>  
>   if ((GET_CLASS(ch) != CLASS_WARRIOR && (GET_CLASS(ch)) != CLASS_RANGER))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I find its easier to do this
    if (!GET_SKILL(ch, SKILL_DISARM)

>   {
>     send_to_char("Disarming is better left to warrior types.\r\n", ch);
>     return;
>   }
>   one_argument(argument, arg);
>  
>   if (!(vict = get_char_room_vis(ch, arg))) {
>     if (FIGHTING(ch)) {
>       vict = FIGHTING(ch);
>     } else {
>       send_to_char("Disarm who?\r\n", ch);
>       return;
>     }
>   }
>   if (vict == ch) {
>     send_to_char("You decide not to disarm yourself.\r\n", ch);
>     return;
>   }
>   percent = ((10 - (GET_AC(vict) / 10)) << 1) + number(1, 101);
> /* 101% is a complete failure */
>   prob = GET_SKILL(ch, SKILL_DISARM);
>  
>   if (percent > prob) {
>     if (vict->equipment[WEAR_WIELD]) {


>       unequip_char(vict, WEAR_WIELD);
>       obj_to_room(0, vict->in_room);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   These two lines can be merged!!
        obj_to_room(unequip_char(vict, WEAR_WIELD), vict->in_room);
       /* THIS SHOULD FIX YOUR PROBLEMS UP */

>       act("$n skillfully disarms $N!",
>           TRUE, ch, 0, 0, TO_ROOM);
>       act("You send $p flying from $N's grasp.", TRUE, ch, 0, vict,
>           TO_CHAR);
>       act("$p flies from your grasp as $n disarms you!", TRUE, ch, 0, vict,
> TO_VICT);
>   } else
>       act("$n trys to disarm $N but fails!",
>           TRUE, ch, 0, 0, TO_ROOM);
>       act("You fail to disarm $N!", TRUE, ch, 0, vict,
>           TO_CHAR);
>       act("$n trys and fails to disarm you!", TRUE, ch, 0, vict, TO_VICT);
>         damage(ch, vict, GET_LEVEL(ch) >> 1, SKILL_DISARM);
>   WAIT_STATE(ch, PULSE_VIOLENCE * 3);
> [code ends]

>From your fellow Circle Imp

Horus.

PS: if ya need to ask any questions personally, log onto my mud and talk
to me or mudmail me with ya name and ya mud site and details of ya probs
Dark Realms : ftoomsh.progsoc.uts.edu.au 5000



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