[CODE][LONG] Redirect Skill

From: flawed (flawed@io.com)
Date: 10/03/01


Im trying to add in a skill which changes the person youre fighting, but
only if its more than one person.

ex:
Player A and B both attack you. Player A is tanking for Player B. Redirect
Player B then makes them the tank.

Im missing something obviously because what happens is more or less you
get a cheap shot in on the victim you attempt to redirect to, but then go
back to the origional person. What am I missing here?

Here is the skill

ACMD(do_redirect)
{
  struct char_data *vict;
  int percent, prob;

  one_argument(argument, arg);

  if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_REDIRECT)) {
    send_to_char("You have no idea how to do that.\r\n", ch);
    return;
  } else if (!IS_NPC(ch) && !GET_SKILL(ch, SKILL_REDIRECT)) {
    send_to_char("You don't know of that skill.\r\n", ch);
    return;
  }

  if (!*arg)
    send_to_char("Hit 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 (vict == ch) {
    send_to_char("You hit yourself...OUCH!.\r\n", ch);
    act("$n hits $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 hit $M.", FALSE, ch, 0, vict, TO_CHAR);
  else {
    if (!pk_allowed) {
      if (!IS_NPC(vict) && !IS_NPC(ch) && (subcmd != SCMD_MURDER)) {
        send_to_char("Use 'murder' to hit another player.\r\n", ch);
        return;
      }
      if (IS_AFFECTED(ch, AFF_CHARM) && !IS_NPC(ch->master) && !IS_NPC(vict))
        return;                 /* you can't order a charmed pet to attack a
                                 * player */
          }

  percent = number(1, 401);     /* 101% is a complete failure */
  if (IS_NPC(ch))
     prob = 90;
       else
  prob = GET_SKILL(ch, SKILL_REDIRECT);
   if (percent > prob) {
      act("You try to change targets, but your current opponent keeps you busy!", FALSE, ch, 0, 0, TO_CHAR);
      act("$n makes some desperate attempts to attack another opponent!", FALSE, ch, 0, 0, TO_ROOM );
      WAIT_STATE (ch, PULSE_VIOLENCE * 2);
      return;
  }
      act("You start fighting $N!", FALSE, ch, 0, vict, TO_CHAR);
      act("$n starts fighting $N!", FALSE, ch, 0, vict, TO_NOTVICT);
      act("$n starts fighting you!", FALSE, ch, 0, vict, TO_VICT);
      hit(ch, vict, TYPE_UNDEFINED);
      WAIT_STATE (ch, PULSE_VIOLENCE * 2);
    }
}

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST