Exemplo n.º 1
0
/*
 * Forces the mobile to flee.
 *
 * Syntax: mob flee
 *
 */
void do_mpflee(CHAR_DATA * ch, char *argument)
{
    ROOM_INDEX_DATA *was_in;
    EXIT_DATA *pexit;
    int door, attempt;

    if (ch->fighting != NULL)
	return;

    if ((was_in = ch->in_room) == NULL)
	return;

    for (attempt = 0; attempt < 6; attempt++) {
	door = number_door();
	if ((pexit = was_in->exit[door]) == 0
	    || pexit->u1.to_room == NULL
	    || IS_SET(pexit->exit_info, EX_CLOSED)
	    || (IS_NPC(ch)
		&& IS_SET(pexit->u1.to_room->room_flags, ROOM_NO_MOB)))
	    continue;

	move_char(ch, door, FALSE);
	if (ch->in_room != was_in)
	    return;
    }
}
Exemplo n.º 2
0
void do_pshift( CHAR_DATA *ch, char *argument )
{

    ROOM_INDEX_DATA *to_room;
    EXIT_DATA *pexit;
    CHAR_DATA *victim;
    int door;

    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        stc("Huh?\n\r",ch);
        return;
    }

    if (ch->pcdata->stats[WL_SPELLS] < 5)
    {
        stc("#RYou do not yet have mastery of this spell.#n\n\r",ch);
        return;
    }

    if ( ( victim = ch->fighting ) == NULL )
    {
        if ( ch->position == POS_FIGHTING )
            ch->position = POS_STANDING;
        send_to_char( "You aren't fighting anyone.\n\r", ch );
        return;
    }

    if(ch->mana < 750)
    {
        send_to_char("#RYou d not have the 750 required mana.\n\r",ch);
        return;
    }

    door = number_door( );
    if ( ( pexit = ch->in_room->exit[door] ) == NULL
        ||   (to_room = pexit->to_room) == NULL)
    {
        act( "#y$n#R mutters some words and disappears!", ch, NULL, NULL, TO_ROOM );
        send_to_char( "#RYou mutter some dark words and vanish from combat.\n\r", ch );
        char_from_room( ch );
        char_to_room( ch, get_room_index(ROOM_VNUM_ALTAR));
        stop_fighting( ch, TRUE );
        return;
    };

    act( "#y$n#R mutters some words and disappears!", ch, NULL, NULL, TO_ROOM );
    send_to_char( "#RYou mutter some dark words and vanish from combat.\n\r", ch );
    char_from_room(ch);
    char_to_room( ch, to_room );
    do_look(ch,"auto");
    stop_fighting( ch, TRUE );
    ch->mana -= 750;
    return;
}
Exemplo n.º 3
0
void hunt_victim( CHAR_DATA *ch )
{
  int		dir;
  bool		found;
  CHAR_DATA	*tmp;

  if( ch == NULL || ch->hunting == NULL || !IS_NPC(ch) )
    return;

  /*
   * Make sure the victim still exists.
   */
  for( found = 0, tmp = char_list; tmp && !found; tmp = tmp->next )
    if( ch->hunting == tmp )
      found = 1;

  if( !found || !can_see( ch, ch->hunting ) )
    {
      do_say( ch, "Damn!  My prey is gone!!" );
      ch->hunting = NULL;
      return;
    }

  if( ch->in_room == ch->hunting->in_room )
    {
      act(AT_BLOOD, "$n glares at $N with vengeance filled eyes.",
	  ch, NULL, ch->hunting, TO_NOTVICT );
      act(AT_BLOOD, "$n glares at you with vengeance filled eyes.",
	  ch, NULL, ch->hunting, TO_VICT );
      act(AT_BLOOD, "You glare at $N with vengeance filled eyes.",
	  ch, NULL, ch->hunting, TO_CHAR);
      multi_hit( ch, ch->hunting, TYPE_UNDEFINED );
      ch->hunting = NULL;
      return;
    }

  WAIT_STATE( ch, skill_table[skill_lookup("hunt")].beats );
  dir = find_path( ch->in_room->vnum, ch->hunting->in_room->vnum,
		  ch, -40000, TRUE );

  if( dir < 0 || dir > 5 )
    {
      act(AT_BLOOD, "$n says 'Damn!  Lost $M!'", ch, NULL, ch->hunting, TO_ROOM );
      ch->hunting = NULL;
      return;
    }

  /*
   * Give a random direction if the mob misses the die roll.
   */
  if( number_percent () > 75 )        /* @ 25% */
    {
      do
        {
	  dir = number_door();
        }
      while( ( ch->in_room->exit[dir] == NULL )
	    || ( ch->in_room->exit[dir]->to_room == NULL ) );
    }


  if( IS_SET( ch->in_room->exit[dir]->exit_info, EX_CLOSED ) )
    {
      do_open( ch, (char *) dir_name[dir] );
      return;
    }

  move_char( ch, dir );
  return;
}
Exemplo n.º 4
0
int skill_hunt( int sn, int level, CHAR_DATA *ch, void *vo )
{
  char buf[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  int direction;
  bool fArea;

  if( target_name[0] == '\0' )
    {
      send_to_char(AT_BLOOD, "Whom are you trying to hunt?\n\r", ch );
      return SKPELL_BOTCHED;
    }

  /* only imps can hunt to different areas */
  fArea = ( get_trust(ch) < MAX_LEVEL );

  if( fArea )
    victim = get_char_area( ch, target_name );
  else
    victim = get_char_world( ch, target_name );

  if( victim == NULL )
    {
      send_to_char(AT_BLOOD,"No-one around by that name.\n\r", ch );
      return SKPELL_BOTCHED;
    }

  if( ch->in_room == victim->in_room )
    {
      act(AT_BLOOD, "$N is here!", ch, NULL, victim, TO_CHAR );
      return SKPELL_NO_DAMAGE;
    }

  /*
   * Deduct some movement.
   */
  if( ch->move > 2 )
    ch->move -= 3;
  else
    {
      send_to_char(AT_BLOOD, "You're too exhausted to hunt anyone!\n\r", ch );
      return SKPELL_MISSED;
    }

  act(AT_BLOOD, "$n carefully sniffs the air.", ch, NULL, NULL, TO_ROOM );
  WAIT_STATE( ch, skill_table[sn].beats );
  direction = find_path( ch->in_room->vnum, victim->in_room->vnum,
			ch, -40000, fArea );

  if( direction == -1 )
    {
      act(AT_BLOOD, "You couldn't find a path to $N from here.",
	  ch, NULL, victim, TO_CHAR );
      return SKPELL_MISSED;
    }

  if( direction < 0 || direction > 5 )
    {
      send_to_char(AT_BLOOD, "Hmm... Something seems to be wrong.\n\r", ch );
      return SKPELL_BOTCHED;
    }

  /*
   * Give a random direction if the player misses the die roll.
   */
  if( ( IS_NPC (ch) && number_percent () > 75)        /* NPC @ 25% */
     || (!IS_NPC (ch) && number_percent () >          /* PC @ norm */
	 ( ch->pcdata->learned[sn] / 10 )  ) )
    {
      do
	{
	  direction = number_door();
	}
      while( ( ch->in_room->exit[direction] == NULL )
	    || ( ch->in_room->exit[direction]->to_room == NULL) );
    }

  /*
   * Display the results of the search.
   */
  sprintf( buf, "$N is %s from here.", dir_name[direction] );
  act(AT_BLOOD, buf, ch, NULL, victim, TO_CHAR );

  return SKPELL_NO_DAMAGE;
}
Exemplo n.º 5
0
void do_mienaku( CHAR_DATA *ch, char *argument )
{
    ROOM_INDEX_DATA *was_in;
    ROOM_INDEX_DATA *now_in;
    CHAR_DATA *victim;
    int attempt;

    if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_NINGENNO] < 3 )
    {
        send_to_char("You have not learned the Ningenno principle to 3.\n\r", ch);
        return;
    }
    else if (!IS_CLASS(ch, CLASS_NINJA) )
    {
        send_to_char("Huh?\n\r", ch);
        return;
    }

    if ( IS_NPC(ch) ) return;

    if ( ( victim = ch->fighting ) == NULL )
    {
        if ( ch->position == POS_FIGHTING )
            ch->position = POS_STANDING;
        send_to_char( "You aren't fighting anyone.\n\r", ch );
        return;
    }
    if (ch->move < 200)
    {
        send_to_char("You don't have enough movement points to flee.\n\r", ch);
        return;
    }
    if (IS_AFFECTED(ch, AFF_WEBBED))
    {
        send_to_char("You are unable to move with all this sticky webbing on.\n\r",ch);
        return;
    }

    was_in = ch->in_room;

    {
        EXIT_DATA *pexit;
        int door;

        send_to_char("You move to vanish from combat!\n\r", ch );

        for ( attempt =  0; attempt < 6; attempt++ )
        {
            door = number_door( );
            if ( ( pexit = was_in->exit[door] ) == 0
                ||   pexit->to_room == NULL
                ||   IS_SET(pexit->exit_info, EX_CLOSED)
                || ( IS_NPC(ch)
                &&   IS_SET(pexit->to_room->room_flags, ROOM_NO_MOB) ) )
                continue;

            move_char( ch, door );
            if ( ( now_in = ch->in_room ) == was_in )
                continue;

            /* Use escape instead of flee so people know it's the ninja power */
            ch->in_room = was_in;
            act( "$n has escaped!", ch, NULL, NULL, TO_ROOM );
            ch->in_room = now_in;

            if ( !IS_NPC(ch) )
                send_to_char( "You escape from combat!\n\r", ch );

            if (victim->in_room == ch->in_room)
            {
                SET_BIT(victim->extra,BLINDFOLDED);
                act("You start to move at super speeds and blind $N.",ch,NULL,victim,TO_CHAR);
                act("$n starts to move at super speeds and blinds $N.",ch,NULL,victim,TO_ROOM);
                act("$n starts to move at super speeds and blinds you.",ch,NULL,victim,TO_VICT);

                return;
            }

            ch->move -= 1000;
            stop_fighting( ch, TRUE );
            WAIT_STATE(ch,1);
            return;
        }

    }
    return;
}
Exemplo n.º 6
0
void hunt_victim( CHAR_DATA *ch )
{
	CHAR_DATA *tmp;
	int        dir,chance;
	bool       found;

    if ( !ch || !ch->hunting )
    {
        return;
    }
    /*
     * Make sure the victim still exists.
     */
    for ( found = FALSE, tmp = char_list; tmp && !found; tmp = tmp->next )
    {
        if ( ch->hunting == tmp )
        {
            found = TRUE;
        }
    }

    if ( !can_move( ch) || !found || !can_see( ch, ch->hunting ) )
    {
        stop_hunting( ch );
        return;
    }


    if ( ch->in_room == ch->hunting->in_room )
    {
        if ( ch->fighting )
            return;

        found_prey( ch, ch->hunting );
        return;
    }

    if ( !IS_NPC ( ch ) )
    {
        WAIT_STATE( ch, skill_table[gsn_track].beats );
    }
	dir = find_path( ch->in_room->vnum, ch->hunting->in_room->vnum, ch, -40000, TRUE );

	if ( dir < 0 || dir >= MAX_DIR )
	{
	stop_hunting( ch );
	return;
	}

	/*
	* Give a random direction if the mob misses the die roll.
    *
    * 20% for PC
    *  2% for NPC
	*/
    chance = IS_NPC ( ch ) ? 2 : 20;
    if ( number_percent( ) < chance + 1 )
    {
        do
        {
            dir = number_door( );
        }
        while (   !( ch->in_room->exit[dir] )
                || !( ch->in_room->exit[dir]->u1.to_room ) );
    }


	if ( IS_SET(ch->in_room->exit[dir]->exit_info, EX_SECRET) &&
		!IS_SET(ch->in_room->exit[dir]->exit_info, EX_HIDDEN) &&
        IS_AFFECTED(ch, AFF_DETECT_HIDDEN) )
    {
        //	do_secret(ch, (char *)dir_name[dir]);
        return;
    }

	if ( IS_SET( ch->in_room->exit[dir]->exit_info, EX_CLOSED ) )
	{
	do_open( ch, (char *) dir_name[dir] );
	return;
	}

	if(	IS_SET(sector_table[ch->in_room->exit[dir]->u1.to_room->sector_type].flag, SECT_UNDERWATER)
	||	IS_SET(ch->in_room->exit[dir]->exit_info, EX_NO_MOB)
	||	EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags, ROOM_NO_MOB)
	||  ( EXT_IS_SET(ch->act, ACT_STAY_AREA)
		&&   ch->in_room->exit[dir]->u1.to_room->area != ch->in_room->area )
	||	( EXT_IS_SET(ch->act, ACT_STAY_SECTOR)
		&&  ch->in_room->exit[dir]->u1.to_room->sector_type != ch->in_room->sector_type )
	||	( EXT_IS_SET(ch->act, ACT_OUTDOORS)
	&&   EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS))
	||	( EXT_IS_SET(ch->act, ACT_INDOORS)
	&&   EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS)))
		return;

	move_char( ch, dir, FALSE, NULL );

	if ( !ch->hunting )
	{
	if ( !ch->in_room )
	{
		char buf [ MAX_STRING_LENGTH ];

		sprintf( buf, "Hunt_victim: no ch->in_room!  Mob #%d, name: %s.  Placing mob in limbo (char_to_room).",
			ch->pIndexData->vnum, ch->name );
		bug( buf, 0 );
		char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) );
		return;
	}
	return;
	}

	if ( ch->in_room == ch->hunting->in_room )
	found_prey( ch, ch->hunting );

	return;
}
Exemplo n.º 7
0
void do_track( CHAR_DATA *ch, char *argument )
{
	char       buf [ MAX_STRING_LENGTH ];
	char       arg [ MAX_STRING_LENGTH ];
	CHAR_DATA *victim;
	int        direction, skill;
	bool       fArea=TRUE;

	skill=get_skill(ch, gsn_track);

	if (IS_NPC(ch))
	{
		return;
	}

	if ( ch->mount )
	{
		send_to_char( "Najpierw zsi±d¼ ze swojego wierzchowca.\n\r", ch );
		return;
	}

	if ( !IS_IMMORTAL( ch ) && IS_AFFECTED( ch, AFF_BLIND ) )
	{
		act("$n klêka i bezradnie potrz±sa g³ow±.",ch,NULL,NULL,TO_ROOM);
		send_to_char("Klekasz, ale przecie¿ niczego nie widzisz.\n\r",ch);
		return;
	}
	if ( room_is_dark( ch, ch->in_room ) &&  !(IS_AFFECTED( ch, AFF_DARK_VISION ) || IS_IMMORTAL( ch ) ))
	{
		send_to_char("Klekasz, ale jest tu tak ciemno, ¿e niczego nie widzisz.\n\r",ch);
		return;
	}

	// wycinamy niektóre ze sektorów
	switch ( ch->in_room->sector_type )
	{
		case  6:  //woda p³yw
		case  7:  //woda niep
		case 19:  //rzeka
		case 20:  //jezioro
		case 21:  //morze
		case 22:  //ocean
		case 23:  //lawa
		case 24:  //ruchome piaski
		case 25:  //gor±ce ¼ród³o
		case 34:  //pod wod±
		case 37:  //ciemna woda
		case 39:  //podziemne jezioro
			send_to_char( "Tutaj chyba nie da siê szukaæ ¶ladów.\n\r", ch );
			return;
	}

	// komunikaty dla tych, którzy nie umiej± szukaæ ¶ladów
	if ( skill == 0 )
	{
		switch (number_range(1,7))
		{
			case 1:
				act("$n klêka i nie wie co robiæ dalej.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i nie za bardzo wiesz co robiæ dalej.\n\r",ch);
				break;
			case 2:
				act("$n klêka i niczego nie widzi.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i niczego nie widzisz.\n\r",ch);
				break;
			case 3:
				act("$n mocno tupie, klêka i przygl±da siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Mocno tupiesz, klêkasz i przygl±dasz siê ¶ladom.\n\r",ch);
				break;
			case 4:
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i ¶ledzisz tropy, choæ nie masz o tym zielonego pojêcia.\n\r",ch);
				break;
			case 5:
				act("$n klêka i robi nieszczê¶liw± minê.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i robisz nieszczê¶liw± minê.\n\r",ch);
				break;
			case 6:
				act("$n rozgl±da siê dooko³a.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Rozgl±dasz siê dooko³a, ale to nie pomaga.\n\r",ch);
				break;
			case 7:
				act("$n zastanawia siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Zastanawiasz siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.\n\r",ch);
				break;
			default :
				send_to_char( "Nie masz pojêcia jak to siê robi.\n\r", ch );
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				break;
		}
		return;
	}

	// bonus/kara od dobrej lokacji s± wiêksze ni¿ od z³ej
	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_CONSECRATE ))
	{
		if (IS_EVIL( ch ) ) skill -= number_range(1,5);
		if (IS_GOOD( ch ) ) skill += number_range(1,5);
	}

	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_DESECRATE ))
	{
		if (IS_EVIL( ch ) ) skill += number_range(0,4);
		if (IS_GOOD( ch ) ) skill -= number_range(0,4);
	}

	// sprawdzamy czy skill nie zrobi³ siê nam mniejszy ni¿ 1
	if (skill < 1)
	{
		skill = 1;
	}

	// no to zaczynamy w³a¶ciwe trackowanie :D
	one_argument( argument, arg );

#ifdef ENABLE_NEW_TRACK
	if(MAX_TRACK_LEN > 0)
	{
		track_new(ch, skill, argument);
		return;
	}
#endif

	if ( arg[0] == '\0' )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i z uwag± przygl±dasz siê ¶ladom.",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( fArea )
	{
		victim = get_char_area( ch, arg );
	}
	else
	{
		victim = get_char_world( ch, arg );
	}

	if ( !victim )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}

	if(victim==ch)
	{
		act("Zastanawiasz siê przez chwilê czy to ma sens, no có¿...",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( ch->in_room == victim->in_room )
	{
		act( "Klêkasz i badasz trop, po chwili zdajesz sobie sprawê, ¿e $N stoi ko³o ciebie.", ch, NULL, victim, TO_CHAR );
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		return;
	}

	if ( skill < number_range( 20, 40 ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		check_improve(ch, NULL, gsn_track, FALSE, 12);
		return;
	}

	if ( IS_AFFECTED ( victim, AFF_SPIRIT_WALK ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}
	else
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i przygladasz siê ¶ladom, chyba widzisz jaki¶ trop.",ch,NULL,NULL,TO_CHAR);
	}

	WAIT_STATE( ch, skill_table[gsn_track].beats );


	direction = find_path( ch->in_room->vnum, victim->in_room->vnum, ch, -40000, fArea );

	if ( direction == -1 )
	{
		act( "Niestety, nie mo¿esz nic wiêcej odczytaæ ze ¶ladów.", ch, NULL, victim, TO_CHAR );
		return;
	}

	if ( direction < 0 || direction >= MAX_DIR )
	{
		send_to_char( "Hmm... co¶ jest nie tak.\n\r", ch );
		return;
	}

/*
 * Give a random direction if the player misses the die roll.
 */
	if ( number_percent() > skill )
	{
		do
		{
			direction = number_door( );
		}
		while (   !( ch->in_room->exit[direction] ) || !( ch->in_room->exit[direction]->u1.to_room ) );
	}

	check_improve(ch, NULL, gsn_track, TRUE, 9);

/*
 * Display the results of the search.
 */


	sprintf( buf, "Znajdujesz ¶lady $Z prowadz±ce na %s.", direction == 4 ? "górê" : dir_name[direction] );
	act( buf, ch, NULL, victim, TO_CHAR );
	return;
}
Exemplo n.º 8
0
Arquivo: hunt.c Projeto: Lamieur/Lac
/*
 * Lam 16.5.98
 */
void hunt_victim( CHAR_DATA *ch )
{
    CHAR_DATA *victim;
    ROOM_INDEX_DATA *to_room;
    int direction;

    victim = ch->hunting;

    if ( victim == NULL )
    {
	bug( "hunt_victim: NULL victim", 0 );
	return;
    }

    if ( !ch->in_room || !victim->in_room )
    {
	bug( "hunt_victim: NULL ch->in_room or victim->in_room", 0 );
	return;
    }

    if ( ch->in_room == victim->in_room )
    {
	mam_cie( ch, victim );
	return;
    }

    if ( ch->in_room->area != victim->in_room->area )
    {
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( ch->move > 1 )
	ch->move -= 2;
    else
	return;

    WAIT_STATE( ch, 3 );
    direction = find_path( ch->in_room, victim->in_room, 40000, TRUE, TRUE );

    if ( direction == -1 )
    {
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( direction < 0 || direction > 9 )
    {
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( number_percent( ) < 10 ) /* 10% mylnych tropow */
	do
	{
	    direction = number_door( );
	}
	while ( !ch->in_room->exit[ direction ]
	     || !ch->in_room->exit[ direction ]->to_room );

    to_room = ch->in_room->exit[ direction ]->to_room;

    /* Lam 30.6.98 - to sie rzadko zdarza, ale jednak */
    if ( ch->in_room->area != to_room->area
      && IS_SET( ch->act, ACT_STAY_AREA ) )
    {
	return;
    }

    if ( IS_SET( to_room->room_flags, ROOM_NO_MOB ) )
	return; /* Tissarius 5.10.2001 */

    move_char( ch, direction, FALSE );

    /* mogl wystapic entry_prog moba ch lub greet_prog moba/pomieszczenia */
    if ( !ch->deleted
      && ch->in_room == to_room
      && ch->in_room == victim->in_room
      && ch->position == POS_STANDING )
    {
	mam_cie( ch, victim );
    }

    return;
}
Exemplo n.º 9
0
Arquivo: hunt.c Projeto: Lamieur/Lac
/* Wersja wykonywana przy chodzeniu */
void auto_hunt( CHAR_DATA *ch )
{
    char buf[ MAX_STRING_LENGTH ];
    CHAR_DATA *victim;
    int direction;
    bool fArea;

    if ( IS_NPC( ch ) ) /* moby maja wlasna metode polowania */
      return;

    victim = ch->hunting;

    if ( !victim )
	return;

    if ( !can_see( ch, victim ) )
    {
	/* Vigud 26.7.2010 */
	/* act( ZM_ZAWSZE, "Nie mo`zesz st`ad znale`x`c drogi do $!. Przestajesz polowa`c na $#.",
	    ch, NULL, victim, TO_CHAR ); */
	sprintf( buf, "Nie mo`zesz st`ad znale`x`c drogi do %s. Przestajesz polowa`c na %s.\n\r",
	    victim->dopelniacz, victim->biernik );
	STC( buf, ch );
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( ch->in_room == victim->in_room )
    {
	act( ZM_ZAWSZE, "{Y$N jest tutaj!{x", ch, NULL, victim, TO_CHAR );
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( IS_SET( ch->in_room->room_flags, ROOM_NO_HUNT ) )
    {
	send_to_char( "Nie mo`zesz tu znale`x`c niczyich `slad`ow.\n\r", ch );
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    /* only imps can hunt to different areas */
    fArea = ( skill_get_trust( ch ) < 106 );

    /*
     * Deduct some movement.
     */
    if ( ch->move > 2 )
	ch->move -= 3;
    else
    {
	ASTC( "Jeste`s zbyt wyczerpan$y, aby szuka`c `slad`ow!", ch );
	return;
    }

    act( ZM_WZROK | ZM_WID_CHAR, "$n szuka `slad`ow na ziemi.", ch, NULL, NULL, TO_ROOM );
    WAIT_STATE( ch, 3 );
    direction = find_path( ch->in_room, victim->in_room, 40000, fArea, TRUE );

    if ( direction == -1 )
    {
	/* Vigud 26.7.2010 */
	/* act( ZM_ZAWSZE, "Nie mo`zesz st`ad znale`x`c drogi do $!. Przestajesz polowa`c na $#.",
	    ch, NULL, victim, TO_CHAR ); */
	sprintf( buf, "Nie mo`zesz st`ad znale`x`c drogi do %s. Przestajesz polowa`c na %s.\n\r",
	    victim->dopelniacz, victim->biernik );
	STC( buf, ch );
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    if ( direction < 0 || direction > 9 )
    {
	send_to_char( "Co`s tu jest nie tak.\n\r", ch );
	wywal_zwod( &victim->zwod_hunting, ch );
	ch->hunting = NULL;
	return;
    }

    /*
     * Give a random direction if the player misses the die roll.
     */
    if ( ( IS_NPC( ch ) && number_percent( ) < 25 )        /* NPC @ 25% */
      || ( !IS_NPC( ch ) && number_percent( ) >          /* PC @ norm */
		  ch->pcdata->learned[ gsn_hunt ] ) )
    {
	do
	{
	    direction = number_door( );
	}
	while ( !ch->in_room->exit[ direction ]
	     || !ch->in_room->exit[ direction ]->to_room );
    }

    /*
     * Display the results of the search.
     */
    sprintf( buf, "{YDroga do $! prowadzi na %s.{x", kierunki[ direction ].biernik );
    act( ZM_ZAWSZE, buf, ch, NULL, victim, TO_CHAR );

    return;
}
Exemplo n.º 10
0
Arquivo: hunt.c Projeto: Lamieur/Lac
void do_hunt( CHAR_DATA *ch, char *argument )
{
    char buf[ MAX_STRING_LENGTH ];
    char arg[ MAX_STRING_LENGTH ];
    CHAR_DATA *victim;
    int direction;
    bool fArea;
    bool uzycie;

    one_argument( argument, arg );

    if ( ch->hunting )
    {
	wywal_zwod( &ch->hunting->zwod_hunting, ch );
	ch->hunting = NULL;
    }
    if ( arg[ 0 ] == '\0' )
    {
	send_to_char( "Na kogo chcesz zapolowa`c?\n\r", ch );
	return;
    }

    if ( ch->in_room->area == area_czysciec )
    {
	send_to_char( "No co`s ty, w niecielesnym `swiecie?\n\r", ch );
	return;
    }

    if ( IS_SET( ch->in_room->room_flags, ROOM_NO_HUNT ) )
    {
	send_to_char( "Nie mo`zesz tu znale`x`c niczyich `slad`ow.\n\r", ch );
	return;
    }

    /* only imps can hunt to different areas */
    fArea = ( get_trust( ch ) < L_SEN );

    if ( fArea )
	victim = get_char_area( ch, arg );
    else
	victim = get_char_world( ch, arg );

    if ( !victim )
    {
	send_to_char( "Nikogo takiego nie ma w pobli`zu.\n\r", ch );
	return;
    }

    if ( ch == victim )
    {
	send_to_char( "Znajdujesz siebie!\n\r", ch );
	return;
    }

    if ( ch->in_room == victim->in_room )
    {
	act( ZM_ZAWSZE, "$N jest tutaj!", ch, NULL, victim, TO_CHAR );
	return;
    }

    if ( IS_NPC( victim ) && IS_SET( victim->act, ACT_NO_HUNT ) )
    {
	act( ZM_ZAWSZE, "Nie mo`zesz znale`x`c drogi do $!.", ch, NULL, victim, TO_CHAR );
	return;
    }

    /*
     * Deduct some movement.
     */
    if ( ch->move > 2 )
	ch->move -= 3;
    else
    {
	ASTC( "Jeste`s zbyt wyczerpan$y, aby szuka`c `slad`ow!", ch );
	return;
    }

    act( ZM_WZROK | ZM_WID_CHAR, "$n szuka `slad`ow na ziemi.", ch, NULL, NULL, TO_ROOM );
    WAIT_STATE( ch, skill_table[ gsn_hunt ].beats );
    direction = find_path( ch->in_room, victim->in_room,
			40000, fArea, TRUE );

    if ( direction == -1 )
    {
	/* Vigud 26.7.2010: jesli nie moglem widziec celu, $! bylo zamieniane na
	   "kogos", a to wygladalo dosc glupio, skoro wiem, na kogo poluje */
	/* act( ZM_ZAWSZE, "Nie mo`zesz st`ad znale`x`c drogi do $!.", ch, NULL, victim, TO_CHAR ); */
	sprintf( buf, "Nie mo`zesz st`ad znale`x`c drogi do %s.\n\r", victim->dopelniacz );
	STC( buf, ch );
	return;
    }

    if ( direction < 0 || direction > 9 )
    {
	send_to_char( "Wiesz, co`s tu jest nie tak.\n\r", ch );
	return;
    }

    /*
     * Give a random direction if the player misses the die roll.
     */
    uzycie = TRUE;
    if ( ( IS_NPC( ch ) && number_percent( ) < 25 )        /* NPC @ 25% */
      || ( !IS_NPC( ch ) && number_percent( ) >          /* PC @ norm */
		ch->pcdata->learned[ gsn_hunt ] ) )
    {
	do
	{
	    direction = number_door( );
	}
	while ( ch->in_room->exit[ direction ] == NULL
	     || ch->in_room->exit[ direction ]->to_room == NULL );
	uzycie = FALSE;
    }

    /*
     * Display the results of the search.
     */
    sprintf( buf, "Droga do $! prowadzi na %s.", kierunki[ direction ].biernik );
    act( ZM_ZAWSZE, buf, ch, NULL, victim, TO_CHAR );

    /* bez wywal_zwod, jest to robione wczesniej */
    ch->hunting = victim;
    dod_zwod( &victim->zwod_hunting, ch );
    if ( uzycie )
	uzyj( ch, gsn_hunt, "poszukiwaniu dr`og" );

    return;
}
Exemplo n.º 11
0
void hunt_victim( CHAR_DATA *ch )
{
    CHAR_DATA *tmp;
    int        dir;
    bool       found;

    if ( !ch || ch->deleted || !ch->hunting )
        return;

    /*
     * Make sure the victim still exists.
     */
    found = FALSE;
    for ( tmp = char_list; tmp; tmp = tmp->next )
        if ( ch->hunting->who == tmp )
        {
            found = TRUE;
            break;
        }

    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;
    }

    /*
     * Give a random direction if the mob misses the die roll.
     */
    if ( number_percent( ) > 75 )	/* @ 25% */
    {
        do
        {
            dir = number_door( );
        }
        while (   !( ch->in_room->exit[dir] )
                  || !( ch->in_room->exit[dir]->to_room ) );
    }
    else
    {
        dir = find_path( ch->in_room, ch->hunting->who->in_room,
                         500 + ch->level * 25 );

        if ( dir < 0 )
        {
            act( "$n says 'Damn!  Lost $M!'", ch, NULL, ch->hunting->who,
                 TO_ROOM );
            stop_hunting( ch );
            return;
        }
    }

    {
        EXIT_DATA *pexit;

        pexit = ch->in_room->exit[dir];

        if ( IS_SET( pexit->to_room->room_flags, ROOM_NO_MOB )
                || ( xIS_SET( ch->act, ACT_STAY_AREA )
                     && pexit->to_room->area != ch->in_room->area ) )
        {
            stop_hunting( ch );
            return;
        }

        if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
        {
            do_open( ch, dir_name[dir] );
            return;
        }
    }

    move_char( ch, dir );

    if ( ch->deleted )
    {
        return;
    }

    if ( !ch->hunting )
    {
        if ( !ch->in_room )
        {
            char buf [ MAX_STRING_LENGTH ];

            sprintf( buf, "Hunt_victim: no ch->in_room!  Mob #%d, name: %s.  Placing mob in limbo.",
                     ch->pIndexData->vnum, ch->name );
            bug( buf, 0 );
            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 );
    return;
}
Exemplo n.º 12
0
void do_track( CHAR_DATA *ch, char *argument )
{
    char       buf [ MAX_STRING_LENGTH ];
    char       arg [ MAX_STRING_LENGTH ];
    CHAR_DATA *victim;
    int        dir;
    bool       fArea;

    if ( !can_use( ch, gsn_track ) )
    {
        send_to_char( "You do not know of this skill yet.\n\r", ch );
        return;
    }

    one_argument( argument, arg );

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

    if ( ch->riding )
    {
        send_to_char( "You can't sniff a trail mounted.\n\r", ch );
        return;
    }

    /* only imps can hunt to different areas */
    fArea = ( get_trust( ch ) < L_DIR );

    if ( fArea )
        victim = get_char_area( ch, arg );
    else
        victim = get_char_world( ch, arg );

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

    if ( ch->in_room == victim->in_room )
    {
        act( "You're already in $N's room!", ch, NULL, victim, TO_CHAR );
        return;
    }

    /*
     * Deduct some movement.
     */
    if ( ch->move > 2 )
        ch->move -= 3;
    else
    {
        send_to_char( "You're too exhausted to hunt anyone!\n\r", ch );
        return;
    }

    act( "$n carefully sniffs the air.", ch, NULL, NULL, TO_ROOM );
    WAIT_STATE( ch, skill_table[gsn_track].beats );

    /*
     * Give a random direction if the player misses the die roll.
     */
    if (   (  IS_NPC( ch ) && number_percent( ) > 75 )	/* NPC @ 25% */
            || ( !IS_NPC( ch ) && number_percent( ) >	/* PC @ norm */
                 ch->pcdata->learned[gsn_track] ) )
    {
        do
        {
            dir = number_door( );
        }
        while (   !( ch->in_room->exit[dir] )
                  || !( ch->in_room->exit[dir]->to_room ) );

        learn( ch, gsn_track, FALSE );
    }
    else
    {
        dir = find_path( ch->in_room, victim->in_room, 100 + ch->level * 30 );

        if ( dir < 0 )
        {
            act( "You can't sense $N's trail from here.",
                 ch, NULL, victim, TO_CHAR );
            return;
        }

        learn( ch, gsn_track, TRUE );
    }

    /*
     * Display the results of the search.
     */
    sprintf( buf, "You sense $N's trail %s from here...", dir_name[dir] );
    act( buf, ch, NULL, victim, TO_CHAR );
    return;
}
Exemplo n.º 13
0
bool spec_wanderer( CHAR_DATA *ch )
{
    OBJ_DATA *trash;
    OBJ_DATA *trash_next;
    OBJ_DATA *obj2;
    ROOM_INDEX_DATA *was_in_room;
    EXIT_DATA *pexit = NULL;
    CHAR_DATA *vch;
    int door;
    int chance=50;
    bool found = FALSE; /* Valid direction */
    bool thrown = FALSE;/* Whether to be thrown or not */
    bool noexit = TRUE; /* Assume there is no valid exits */
    
    
    was_in_room = ch->in_room;
    if ( !IS_AWAKE(ch) )
	return FALSE;

    if((pexit = ch->in_room->first_exit) !=NULL)
			noexit=FALSE;
    
    if(chance>number_percent()){
    /****
     * Look for objects on the ground and pick it up
     ****/
    
    for ( trash = ch->in_room->first_content; trash; trash = trash_next )
    {
	trash_next = trash->next_content;
	if ( !IS_SET( trash->wear_flags, ITEM_TAKE )
	||    IS_OBJ_STAT( trash, ITEM_BURIED ) )
	    continue;
	
	if ( trash->item_type == ITEM_WEAPON
	|| 	 trash->item_type == ITEM_ARMOR
	||   trash->item_type == ITEM_LIGHT ) {
	separate_obj( trash );  /* So there is no 'sword <6>' gets only one object off ground */
	act( AT_ACTION, "$n leans over and gets $p.", ch, trash, NULL, TO_ROOM );	
	obj_from_room( trash );
	trash = obj_to_char( trash, ch );
	
	/*****
	 * If object is too high a level throw it away.
	 *****/
    if ( ch->level < trash->level )
    {
	act( AT_ACTION, "$n tries to use $p, but is too inexperienced.",ch, trash, NULL, TO_ROOM );
        thrown = TRUE;
    }
    
	/*****
	 * Wear the object if it is not to be thrown. The FALSE is passed
	 * so that the mob wont remove a piece of armor already there
	 * if it is not worn it is assumed that they can't use it or 
	 * they already are wearing something.
	 *****/
	
	if(!thrown)
	wear_obj( ch, trash, FALSE, -1 );
	
	/*****
	 * Look for an object in the inventory that is not being worn
	 * then throw it away...
	 *****/
	found=FALSE;
	if(!thrown)
        for ( obj2 = ch->first_carrying; obj2; obj2 = obj2->next_content ){
			if (obj2->wear_loc == WEAR_NONE){
			do_say(ch,"Hmm, I can't use this.");			
			trash=obj2; 
			thrown=TRUE;
	 }
	}
	/*****
	 * Ugly bit of code..
	 * Checks if the object is to be thrown & there is a valid exit, 
	 * randomly pick a direction to throw it, and check to make sure no other
	 * spec_wanderer mobs are in that room.
	 *****/
	if(thrown && !noexit)
	  while(!found && !noexit){
		door=number_door();
		if((pexit = get_exit(ch->in_room,door) ) != NULL
		&&   pexit->to_room
		&&   !IS_SET(pexit->exit_info, EX_CLOSED)
		&&	!xIS_SET(pexit->to_room->room_flags, ROOM_NODROP)){
		  if( (vch = pexit->to_room->first_person) !=NULL)
			for( vch = pexit->to_room->first_person; vch; vch = vch->next_in_room){
			  if (!str_cmp(lookup_spec(vch->spec_fun), "spec_wanderer")){
			  noexit = TRUE;
			  /*act( AT_CYAN,"$n spec_wanderer inroom $T", ch, NULL,dir_name[pexit->vdir], TO_ROOM);*/
			  return FALSE;
			  }
			}
			found = TRUE;
		}
	  }
		if (!noexit && thrown){
		/*if (trash->value*/
		set_cur_obj( trash );
		if( damage_obj( trash ) != rOBJ_SCRAPPED){
		separate_obj(trash);
		act( AT_ACTION, "$n growls and throws $p $T.", ch, trash, dir_name[pexit->vdir], TO_ROOM );
		obj_from_char( trash );
		obj_to_room( trash, pexit->to_room );
		char_from_room(ch);
		char_to_room(ch, pexit->to_room);
		act( AT_CYAN,"$p thrown by $n lands in the room.",ch, trash, ch, TO_ROOM);
		char_from_room(ch);
		char_to_room(ch, was_in_room);
		}
		else{
		do_say(ch,"This thing is junk!");
		act( AT_ACTION, "$n growls and breaks $p.",ch, trash, NULL, TO_ROOM);
		}
	
	return TRUE;
	}
	return TRUE;
    }
   } /* get next obj */
    return FALSE; /* No objects :< */
   }
   return FALSE;
}
Exemplo n.º 14
0
void do_track( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  char arg[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  int direction;
  bool fArea;

  one_argument( argument, arg );

    if ( !IS_NPC(ch)
    &&   !can_use_skpell( ch, gsn_track) )          
      {
        send_to_char( "\n\r{WYou find some tracks that look remarkably like your own...{x\n\r",ch);                                           
        return;   
      }


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

  /* only imps can hunt to different areas */

  fArea = ( ch->level < MAX_LEVEL );

/*
  if (IS_NPC(ch))
    victim = get_char_world( ch, arg );
  else 
*/

  if (fArea)
    victim = get_char_area( ch, arg );
  else
    victim = get_char_area( ch, arg );

  if (IS_SET(ch->in_room->room_flags, ROOM_DRAGONPIT))
    {
      send_to_char("\n\r{CThat would be cheating..{x\n\r", ch );
      return;
    }

  if( victim == NULL )
    {
      send_to_char("\n\r{RNo-one around by that name.{x\n\r", ch );
      return;
    }

  if( ch->in_room == victim->in_room )
    {
      act( "\n\r{G$N is here!{x\n\r", ch, NULL, victim, TO_CHAR );
      return;
    }

  /*
   * Deduct some movement.
   */
  if( ch->move > 3 )
    ch->move -= 3;
  else
    {
      send_to_char( "\n\r{RYou're too exhausted to track anyone!{x\n\r", ch );
      return;
    }

  act( "\n\r{c$n carefully sniffs the air.{x\n\r", ch, NULL, NULL, TO_ROOM );
  WAIT_STATE( ch, skill_table[gsn_track].beats );
  direction = find_path( ch->in_room->vnum, victim->in_room->vnum,
			ch, -40000, fArea );

  if( direction == -1 )
    {
      act( "\n\r{GYou couldn't find a path to $N from here.{x\n\r",
	  ch, NULL, victim, TO_CHAR );
      return;
    }

  if( direction < 0 || direction > 9 )
    {
      send_to_char( "\n\r{CHmm... Something seems to be wrong.{x\n\r", ch );
      return;
    }

  /*
   * Give a random direction if the player misses the die roll.
   */
#if 0
  if( ( IS_NPC (ch) && number_percent () > 75)        /* NPC @ 25% */
     || (!IS_NPC (ch) && number_percent () >          /* PC @ norm */
	 ch->pcdata->learned[gsn_track] ) )
#endif

  if (!IS_NPC(ch) && number_percent() > ch->pcdata->learned[gsn_track])
    {
      do
	{
	  direction = number_door();
	}
      while( ( ch->in_room->exit[direction] == NULL )
	    || ( ch->in_room->exit[direction]->u1.to_room == NULL) );
    }

  /*
   * Display the results of the search.
   */
  sprintf( buf, "\n\r{C$N is %s from here.{x\n\r", dir_name[direction] );
  act( buf, ch, NULL, victim, TO_CHAR );
  check_improve(ch,gsn_track,TRUE,1);
  return;
}