Re: docs on adding new skills - [CODE] Stun

From: Ryan Stapleton (raal@PENN.COM)
Date: 06/05/98


Here is a copy of my stun.  I have borrowed enough code from the snippet
page that I might as well donate some back
-Ryan

ACMD(do_stun)
{
  struct char_data *vict;
  struct affected_type af;
  int diff_lev, percent, prob;
  int chance;

  one_argument(argument, arg);
  log ("do_stun\r\n");

  if (!GET_SKILL(ch, SKILL_STUN) ) {
    send_to_char("You do not know this skill.\r\n", ch);
  } else  if (!*arg) {
    send_to_char("Stun who?\r\n", ch);
  } else if (!(vict = get_char_room_vis(ch, arg))) {
    send_to_char("They don't seem to be here.\r\n", ch);
  } else if ( ! IS_NPC(vict) ){
    send_to_char("You can not attack another PC.\r\n", ch);
  } else if (vict == ch) {
    send_to_char("You Stun yourself...OUCH!.\r\n", ch);
    act("$n tries to stun $mself, and says OUCH!", FALSE, ch, 0, vict, TO_ROOM);
  } else if (IS_AFFECTED(ch, AFF_CHARM) && (ch->master == vict)) {
    act("$N is just such a good friend, you simply can't stun $M.", FALSE, ch,
0,
 vict, TO_CHAR);
  } else if (ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
    send_to_char("This room just has such a peaceful, easy feeling...\r\n", ch);
  } else if ( ! (GET_MOVE(ch) >= 10) ) {
    send_to_char("I am sorry, but you seem to tired to try to do that.\r\n",
ch);
  } else {
    percent = number(1, 101);   /* 101% is a complete failure */
    prob = GET_SKILL(ch, SKILL_STUN);

    if (MOB_FLAGGED(vict, MOB_NOSTUN))
      percent = 101;

    if ( percent < prob ) {
      GET_MOVE(ch) -= 10;
      diff_lev = GET_LEVEL(vict) - GET_LEVEL(ch);

      chance = 33 - (diff_lev ) ;

      if (chance > 100)
        chance = 100;

      chance -= GET_DEX(vict);
      percent = number(1, 101);

      if ( chance > percent ) {
        af.bitvector = AFF_STUN;
        af.duration = 0;
        affect_to_char(vict, &af);

        stop_fighting(vict);
        GET_POS(vict) = POS_STUNNED;

        act("You stun $N.", FALSE, ch, 0, vict, TO_CHAR);
        act("$n stuns $N.", TRUE, ch, 0, vict, TO_NOTVICT);
        act("$n stuns you.", TRUE, ch, 0, ch->master, TO_VICT);

      } else {
        send_to_char("You Fail to stun.\r\n", ch);
        if ( number(1,101) <= 1) {
          if (GET_LEVEL(ch) < LVL_IMMORT) {
            send_to_char("Oops, You stuned your self.\r\n", ch);
            af.bitvector = AFF_STUN;
            af.duration = 0;
            affect_to_char(ch, &af);
            GET_POS(ch) = POS_STUNNED;
          }
        }
      }

    } else {
      send_to_char("You Fail to stun him.\r\n", ch);
      if ( number(1,101) <= 1) {
        if (GET_LEVEL(ch) < LVL_IMMORT) {
          send_to_char("Oops, You stuned your self.\r\n", ch);
          af.bitvector = AFF_STUN;
          af.duration = 0;
          affect_to_char(ch, &af);
          GET_POS(ch) = POS_STUNNED;
        }
      }
    }
    hit(ch, vict, TYPE_UNDEFINED);
    WAIT_STATE(ch, PULSE_VIOLENCE * 4);
  }

}



On 05-Jun-98 Anthony Rye wrote:
> ACMD (do_stun)
---------------------------------------------------------------
- Ryan Stapleton               |   raal@penn.com              -
- 225 West Main Street         |   ryans@cis.clarion.edu      -
- Reynoldsville, Pa            |   ryan@flower.aud.temple.edu -
- 15851                        |                              -
- Amateur Radio Call:  KA3WUT  |  http://users.penn.com/~raal -
---------------------------------------------------------------


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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