Beispiel #1
0
void hunt_room(struct char_data * ch)
{
  int dir = -1;

  if (!ch) {
    return;
  }

  /* make sure the room is valid */
  if (HUNTINGRM(ch) < 0 || AFF_FLAGGED(ch, AFF_MAJOR_PARALIZED) || AFF2_FLAGGED(ch, AFF2_MINOR_PARALIZED)) {
    return;
  }

  /* dez 19980805
   if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) {
   dir = find_first_step(ch->in_room, HUNTINGRM(ch), 2);
   } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
   */
  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
    dir = find_first_step(ch->in_room, HUNTINGRM(ch), 1);
  } else {
    dir = find_first_step(ch->in_room, HUNTINGRM(ch), 0);
  }

  if (dir < 0) {
    HUNTINGRM(ch) = -1;
    return;
  } else {
    perform_move(ch, dir, 1);
    if (ch->in_room == HUNTINGRM(ch)) {
      HUNTINGRM(ch) = -1;
    }
    return;
  }
}
Beispiel #2
0
void hunt_victim(struct char_data *ch)
{
	int dir;
	byte found;
	struct char_data *tmp;

	if (!ch || !HUNTING(ch) || FIGHTING(ch))
		return;

	/* make sure the char still exists */
	for (found = FALSE, tmp = character_list; tmp && !found; tmp = tmp->next)
		if (HUNTING(ch) == tmp)
			found = TRUE;

	if (!found) {
		do_say(ch, "Damn!  My prey is gone!", 0, 0);
		HUNTING(ch) = NULL;
		return;
	}
	if ((dir = find_first_step(IN_ROOM(ch), IN_ROOM(HUNTING(ch)))) < 0) {
		sprintf(buf, "Damn!  I lost %s!", HMHR(HUNTING(ch)));
		do_say(ch, buf, 0, 0);
		HUNTING(ch) = NULL;
	} else {
		perform_move(ch, dir, 1);
		if (IN_ROOM(ch) == IN_ROOM(HUNTING(ch)))
			hit(ch, HUNTING(ch), TYPE_UNDEFINED);
	}
}
Beispiel #3
0
/********************************************************
* Functions and Commands which use the above functions. *
********************************************************/
int go_track(CHAR_DATA * ch, CHAR_DATA * victim, int skill_no)
{
	int percent, dir;

	if (AFF_FLAGGED(victim, AFF_NOTRACK) && (skill_no != SKILL_SENSE))
	{
		return BFS_ERROR;
	}

	/* 101 is a complete failure, no matter what the proficiency. */
	percent = number(0, skill_info[skill_no].max_percent);

	if (percent > calculate_skill(ch, skill_no, skill_info[skill_no].max_percent, victim))
	{
		int tries = 10;
		/* Find a random direction. :) */
		do
		{
			dir = number(0, NUM_OF_DIRS - 1);
		}
		while (!CAN_GO(ch, dir) && --tries);
		return dir;
	}

	/* They passed the skill check. */
	return find_first_step(ch->in_room, victim->in_room, ch);
}
Beispiel #4
0
void do_track( CHAR_DATA* ch, const char* argument)
{
    CHAR_DATA *vict;
    char arg[MAX_INPUT_LENGTH];
    int dir, maxdist;

    if( !IS_NPC( ch ) && ch->pcdata->learned[gsn_track] <= 0 )
    {
        send_to_char( "You do not know of this skill yet.\r\n", ch );
        return;
    }

    one_argument( argument, arg );
    if( arg[0] == '\0' )
    {
        send_to_char( "Whom are you trying to track?\r\n", ch );
        return;
    }

    WAIT_STATE( ch, skill_table[gsn_track]->beats );

    if( !( vict = get_char_world( ch, arg ) ) )
    {
        send_to_char( "You can't find a trail of anyone like that.\r\n", ch );
        return;
    }

    maxdist = 100 + ch->level * 30;

    if( !IS_NPC( ch ) )
        maxdist = ( maxdist * LEARNED( ch, gsn_track ) ) / 100;

    dir = find_first_step( ch->in_room, vict->in_room, maxdist );

    switch ( dir )
    {
    case BFS_ERROR:
        send_to_char( "Hmm... something seems to be wrong.\r\n", ch );
        break;
    case BFS_ALREADY_THERE:
        send_to_char( "You're already in the same room!\r\n", ch );
        break;
    case BFS_NO_PATH:
        send_to_char( "You can't sense a trail from here.\r\n", ch );
        learn_from_failure( ch, gsn_track );
        break;
    default:
        ch_printf( ch, "You sense a trail %s from here...\r\n", dir_name[dir] );
        learn_from_success( ch, gsn_track );
        break;
    }
}
Beispiel #5
0
void hunt_victim( CHAR_DATA * ch )
{
    bool found;
    CHAR_DATA *tmp;
    EXIT_DATA *pexit;
    short ret;

    if( !ch || !ch->hunting || ch->position < 5 )
        return;

    /*
     * make sure the char still exists
     */
    for( found = FALSE, tmp = first_char; tmp && !found; tmp = tmp->next )
        if( ch->hunting->who == tmp )
            found = TRUE;

    if( !found )
    {
        do_say( ch, "Damn!  My prey is gone!!" );
        stop_hunting( ch );
        return;
    }

    if( ch->in_room == ch->hunting->who->in_room )
    {
        if( ch->fighting )
            return;
        found_prey( ch, ch->hunting->who );
        return;
    }

    ret = find_first_step( ch->in_room, ch->hunting->who->in_room, 500 + ch->level * 25 );
    if( ret < 0 )
    {
        do_say( ch, "Damn!  Lost my prey!" );
        stop_hunting( ch );
        return;
    }
    else
    {
        if( ( pexit = get_exit( ch->in_room, ret ) ) == NULL )
        {
            bug( "%s", "Hunt_victim: lost exit?" );
            return;
        }
        move_char( ch, pexit, FALSE );

        /*
         * Crash bug fix by Shaddai
         */
        if( char_died( ch ) )
            return;

        if( !ch->hunting )
        {
            if( !ch->in_room )
            {
                bug( "Hunt_victim: no ch->in_room!  Mob #%d, name: %s.  Placing mob in limbo.", ch->pIndexData->vnum, ch->name );
                char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) );
                return;
            }
            do_say( ch, "Damn!  Lost my prey!" );
            return;
        }
        if( ch->in_room == ch->hunting->who->in_room )
            found_prey( ch, ch->hunting->who );
        else
        {
            CHAR_DATA *vch;

            /*
             * perform a ranged attack if possible
             */
            /*
             * Changed who to name as scan_for_victim expects the name and
             * * Not the char struct. --Shaddai
             */
            if( ( vch = scan_for_victim( ch, pexit, ch->hunting->name ) ) != NULL )
            {
                if( !mob_fire( ch, ch->hunting->who->name ) )
                {
                    /*
                     * ranged spell attacks go here
                     */
                }
            }
        }
        return;
    }
}
Beispiel #6
0
void hunt_aggro(struct char_data * ch)
{
  int dir;
  int skillnum = spells[find_skill_num("aggressive")].spellindex;
  struct char_data *hunted_ch;

  if (!ch || !HUNTING(ch) || FIGHTING(ch)) {
    return;
  }
  /*
   if (world[ch->in_room].zone != world[HUNTING(ch)->in_room].zone) {
   HUNTING(ch) = 0;
   return;
   }
   */
  if ((hunted_ch = find_hunted_char(HUNTING(ch)))) {
    if (ch->in_room == hunted_ch->in_room && !ROOM_FLAGGED(hunted_ch->in_room, ROOM_PEACEFUL)) {
      if (CAN_SEE(hunted_ch, ch) && GET_SKILL(hunted_ch, skillnum) > number(0, 101)) {
        improve_skill(ch, skillnum, SKUSE_AVERAGE);
        hit(hunted_ch, ch, TYPE_UNDEFINED);
      } else {
        if (CAN_SEE(ch, hunted_ch)) {
          hit(ch, hunted_ch, TYPE_UNDEFINED);
        }
      }
      return;
    }
  } else {
    return;
  }

  /* dez 19980805
   if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) {
   dir = find_first_step(ch->in_room, hunted_ch->in_room, 2);
   } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
   */
  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 1);
  } else {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 0);
  }

  if (dir < 0) {
    /* do not forget until player is dead or I die
     HUNTING(ch) = 0;
     */
    return;
  } else {
    perform_move(ch, dir, 1);
    if (ch->in_room == hunted_ch->in_room) {
      if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
        if (CAN_SEE(hunted_ch, ch) && GET_SKILL(hunted_ch, skillnum) > number(0, 101)) {
          improve_skill(ch, skillnum, SKUSE_AVERAGE);
          hit(hunted_ch, ch, TYPE_UNDEFINED);
        } else {
          if (CAN_SEE(ch, hunted_ch)) {
            hit(ch, hunted_ch, TYPE_UNDEFINED);
          }
        }
      }
    }
    return;
  }
}
Beispiel #7
0
void hunt_victim(struct char_data * ch)
{
  extern struct char_data *character_list;
  ACMD(do_open);

  int dir;
  byte found;
  struct char_data *tmp;
  struct char_data *hunted_ch;
  char abuf[80];
  char doorname[80];

  if (!ch || !HUNTING(ch) || AFF2_FLAGGED(ch, AFF2_MINOR_PARALIZED) || AFF_FLAGGED(ch, AFF_MAJOR_PARALIZED)) {
    return;
  }

  hunted_ch = find_hunted_char(HUNTING(ch));
  /* make sure the char still exists */
  for (found = 0, tmp = character_list; tmp && !found && hunted_ch; tmp = tmp->next) {
    if (HUNTING(ch) == GET_IDNUM(tmp)) {
      found = 1;
    }
  }

  if (!found) {
    act("$n says, 'Damn!  My prey is gone!!'", TRUE, ch, 0, 0, TO_ROOM);
    /* don't forget vict until they die or I am dead
     HUNTING(ch) = 0;
     */
    return;
  }

  /* dez 19980805
   if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) {
   dir = find_first_step(ch->in_room, hunted_ch->in_room, 2);
   } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
   */

  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 1);
  } else {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 0);
  }

  if (dir < 0) {
    sprintf(buf, "$n says 'Damn!  Lost %s!'", HMHR(hunted_ch));
    act(buf, TRUE, ch, 0, 0, TO_ROOM);
    /* don't forget vict until they die or I am dead
     HUNTING(ch) = 0;
     */
    return;
  } else {
    if (IS_CLOSED(ch->in_room, dir)) {
      one_argument(EXIT(ch, dir)->keyword, doorname);
      sprintf(abuf, "%s %s", doorname, dirs[dir]);
      do_open(ch, abuf, 0, 0);
    }
    perform_move(ch, dir, 1);
    if (ch->in_room == hunted_ch->in_room && !ROOM_FLAGGED(hunted_ch->in_room, ROOM_PEACEFUL)) {
      if (CAN_SEE(ch, hunted_ch)) {
        hit(ch, hunted_ch, TYPE_UNDEFINED);
      }
    }
    return;
  }
}