Example #1
0
void do_peer(struct char_data *ch, char *argument, int cmd)
{
  void do_look(struct char_data *ch,char *arg,int cmd);

  if( GET_MANA(ch) < (15 - GET_LEVEL(ch,BestThiefClass(ch))/4))
  {
    send_to_char("You don't really see anything...\n\r",ch);
    return;
  }

  if(!*argument)
  {
    send_to_char("You must peer in a direction...\n\r",ch);
    return;
  }

  if(ch->skills[SKILL_PEER].learned < number(1,101))
  {
    do_look(ch,argument,0);
    GET_MANA(ch) -= 5; 
    return;
  }

  GET_MANA(ch) -= (20 - GET_LEVEL(ch,BestThiefClass(ch))/4);
  if(ch->skills[SKILL_PEER].learned < 50)
    ch->skills[SKILL_PEER].learned +=2;

  act("$n peers about the area.", TRUE, ch, 0, 0, TO_ROOM);

  do_look(ch,argument,SKILL_PEER);
}
Example #2
0
void start_tag( void )
{
    DESCRIPTOR_DATA        *d,
                           *d_next;
    ROOM_INDEX_DATA        *loc;
    char                    buf[MAX_INPUT_LENGTH];
    int                     count = 0;

    tag_game.status = TAG_ISPLAY;
    tag_game.timer = 2 * tag_game.playing;

    for ( d = first_descriptor; d; d = d_next ) {
        d_next = d->next;

        if ( d->connected != CON_PLAYING || !d->character || IS_NPC( d->character ) )
            continue;

        if ( xIS_SET( d->character->act, PLR_WAITING ) ) {
            count++;
            loc = get_room_index( number_range( FTAG_MIN_VNUM, FTAG_MAX_VNUM ) );
            xREMOVE_BIT( d->character->act, PLR_FROZEN );
            xREMOVE_BIT( d->character->act, PLR_WAITING );
            xSET_BIT( d->character->act, PLR_PLAYING );
            char_from_room( d->character );
            char_to_room( d->character, loc );
            do_look( d->character, ( char * ) "auto" );
        }
    }
    sprintf( buf, "&R[&WEvento de congelación&R] &C¡El evento va a comenzar! hay &Y%d&C personas jugando.", count );
    tag_channel( NULL, buf );
}
Example #3
0
void end_tag( void )
{
    DESCRIPTOR_DATA        *d,
                           *d_next;

    tag_game.status = TAG_OFF;
    tag_game.timer = -1;
    tag_game.next = number_range( 30, 50 );
    tag_game.playing = 0;

    for ( d = first_descriptor; d; d = d_next ) {
        d_next = d->next;

        if ( d->connected != CON_PLAYING || !d->character || !d->character->in_room )
            continue;
        if ( d->character->in_room->vnum < FTAG_MIN_VNUM - 1
             || d->character->in_room->vnum > FTAG_MAX_VNUM )
            continue;
        xREMOVE_BIT( d->character->act, PLR_RED );
        xREMOVE_BIT( d->character->act, PLR_BLUE );
        xREMOVE_BIT( d->character->act, PLR_FROZEN );
        xREMOVE_BIT( d->character->act, PLR_PLAYING );
        xREMOVE_BIT( d->character->act, PLR_WAITING );
        xREMOVE_BIT( d->character->act, PLR_PKSAFE );
        char_from_room( d->character );
        char_to_room( d->character, get_room_index( ROOM_VNUM_TEMPLE ) );
        do_look( d->character, ( char * ) "auto" );
        act( AT_TELL, "¡$n cae del cielo!\r\n", d->character, NULL, NULL, TO_ROOM );
        d->character->quest_curr += 10;
        d->character->quest_accum += 10;
        ch_printf( d->character,
                   "¡Ganas 10 puntos de gloria por participar en el evento de congelación!\r\n" );
    }
}
Example #4
0
/*
 * Special procedures for rooms.
 */
bool spec_deathtrap( ROOM_INDEX_DATA *room )
{
    CHAR_DATA *rch;
    int        found;

    found = FALSE;
    for ( rch = room->people; rch; rch = rch->next_in_room )
    {
	found = TRUE;

	do_look( rch, "dt" );

	if ( rch->position == POS_STANDING && rch->hit > 20 )
	{
	    rch->position = POS_RESTING;
	    rch->hit /= 2;
	    send_to_char( "You better get out of here fast!\n\r", rch );
	}
	else
	{
	    raw_kill( rch, rch );
	    send_to_char( "You are dead.\n\r", rch );
	}
    }

    return found;
}
Example #5
0
int event_exitportal(EVENT_DATA *event)
{
  CHAR_DATA *ch = event->owner.ch;
  OBJECT_DATA *obj = event->victim.obj;
  int args[3];

  args[0] = event->args[0]; /* newx */
  args[1] = event->args[1]; /* newy */
  args[2] = event->args[2]; /* newplane */

  destroy_all_events(ch, EVENT_EXITPORTAL);

  ch->x = args[0];
  ch->y = args[1];
  ch->plane = args[2];
  update_objects(ch);
  act("\nYou jump out of $v and look around.\n", ch, obj, TO_ACTOR + TYPE_ACT_CHAR + TYPE_VIC_OBJ, SENSE_SIGHT);
  act("$a jumps out of $v.", ch, obj, TO_NOTACTVIC + TYPE_ACT_CHAR + TYPE_VIC_OBJ, SENSE_SIGHT);
  do_look(ch, "");

  if (ch->level == LEVEL_MORTAL && (args[2] == PLANE_NEXUS || args[2] == PLANE_HNEXUS))
  {
    send_to_char(ch, "#R+#r------------------------------------------------------------------------#R+\n");
    send_to_char(ch, "#r| #RWARNING:#Y This plane is meant for characters of greater power than you. #r|\n");
    send_to_char(ch, "#r| #YWe recommend that you return to the newbie plane by typing #CENTER BLUE#Y. #r|\n");
    send_to_char(ch, "#R+#r------------------------------------------------------------------------#R+\n");
  }
  return 1;
}
Example #6
0
void do_shadowshift( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *obj;
    char      arg [MAX_INPUT_LENGTH];
    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }
    if (IS_CLASS(ch, CLASS_WIZARD) && ch->pcdata->powers[WL_SKILLS] < 3)
    {
        send_to_char("You need Level 3 in Wizard Skills.\n\r",ch);
        return;
    }
    if ( arg[0] == '\0' )
    {
        if (!IS_AFFECTED(ch, AFF_SHADOWPLANE))
        {
            if (has_timer(ch)) return;
            send_to_char("You fade into the plane of shadows.\n\r",ch);
            act("The shadows flicker and swallow up $n.",ch,NULL,NULL,TO_ROOM);
            SET_BIT(ch->affected_by, AFF_SHADOWPLANE);
            do_look(ch,"auto");
            return;
        }
        REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
        send_to_char("You fade back into the real world.\n\r",ch);
        act("The shadows flicker and $n fades into existance.",ch,NULL,NULL,TO_ROOM);
        do_look(ch,"auto");
        return;
    }

    if ( ( obj = get_obj_here( ch, arg ) ) == NULL )
    {
        send_to_char( "What do you wish to toss into the shadow plane?\n\r", ch );
        return;
    }

    if (IS_AFFECTED(ch, AFF_SHADOWPLANE))
        send_to_char( "You toss it to the ground and it vanishes.\n\r", ch );
    else
        send_to_char( "You toss it into a shadow and it vanishes.\n\r", ch );
    return;
}
Example #7
0
void do_swoop( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    ROOM_INDEX_DATA *location;
    CHAR_DATA *victim;

    one_argument (argument, arg);
    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_ANGEL))
    {
        send_to_char("Huh?\n\r", ch );
        return;
    }
    if (ch->pcdata->powers[ANGEL_JUSTICE] < 1)
    {
        send_to_char("You haven't learned to fly yet.\n\r",ch);
        return;
    }
    if (!IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_WINGS))
    {
        send_to_char("Where are your wings?\n\r",ch);
        return;
    }
    if ((victim = get_char_world(ch, arg)) == NULL)
    {
        send_to_char("Swoop down on whom?\n\r", ch );
        return;
    }
    if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "You can't find it's room.\n\r",ch);
        return;
    }
    if (IS_IMMUNE(victim, IMM_TRAVEL) && !IS_NPC(victim))
    {
        send_to_char("I don't think they want you to do that.\n\r",ch);
        return;
    }
    if (IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "Your room is not connected to the astral plane.\n\r",ch);
        return;
    }
    location = victim->in_room;
    if (ch->move < 500)
    {
        send_to_char("You don't have the move to fly that far.\n\r", ch );
        return;
    }
    act("You fly up into the sky.", ch, NULL, NULL, TO_CHAR);
    act("$n flies into the sky.", ch, NULL, NULL, TO_ROOM);
    ch->move -= 500;
    char_from_room(ch);
    char_to_room(ch, location);
    do_look(ch, "auto");
    act("You swoop down upon $N.", ch, NULL, victim, TO_CHAR);
    act("$n swoops down from the sky.", ch, NULL, NULL, TO_ROOM);
    return;
}
Example #8
0
void do_krecall(CHAR_DATA * ch, char *argument)
{
	char buf[MAX_STRING_LENGTH];
	CHAR_DATA *victim;
	CHAR_DATA *mount;
	ROOM_INDEX_DATA *location;
	KINGDOM_DATA *kingdom;

	if(IS_NPC(ch) || (kingdom = get_kingdom(ch->pcdata->kingdom)) == &kingdom_default)
	{
		send_to_char("You have no kingdom!\n\r", ch);
		return;
	}

	act("$n's body flickers with green energy.", ch, 0, 0, TO_ROOM);
	act("Your body flickers with green energy.", ch, 0, 0, TO_CHAR);

	if((location = get_room_index(kingdom->recall)) == 0)
	{
		send_to_char("Your kingdom has no recall set.\n\r", ch);
		return;
	}

	if(ch->in_room == location)
		return;

	if(IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) || IS_AFFECTED(ch, AFF_CURSE))
	{
		send_to_char("You are unable to recall.\n\r", ch);
		return;
	}

	if((victim = ch->fighting) != 0)
	{
		if(number_bits(1) == 0)
		{
			WAIT_STATE(ch, 4);
			sprintf(buf, "You failed!\n\r");
			send_to_char(buf, ch);
			return;
		}
		sprintf(buf, "You recall from combat!\n\r");
		send_to_char(buf, ch);
		stop_fighting(ch, TRUE);
	}

	act("$n disappears.", ch, 0, 0, TO_ROOM);
	char_from_room(ch);
	char_to_room(ch, location);
	act("$n appears in the room.", ch, 0, 0, TO_ROOM);
	do_look(ch, "auto");

	if((mount = ch->mount) == 0)
		return;
	char_from_room(mount);
	char_to_room(mount, ch->in_room);
	return;
}
Example #9
0
void find_game_winner()
{
  char buf[MAX_INPUT_LENGTH];
//  char buf2[MAX_INPUT_LENGTH];
  CHAR_DATA *i;
  DESCRIPTOR_DATA *d;    
  ROOM_INDEX_DATA *location;
  
  struct hall_of_fame_element *fame_node;
          
  for (d = first_descriptor; d; d = d->next)
      {
       if( d->connected == CON_PLAYING )
        {
        i = d->original ? d->original : d->character;
        if (IS_SET(i->in_room->room_flags2,ROOM_ARENA)
            && (i->top_level < LEVEL_IMMORTAL))
        {
          i->hit = i->max_hit;
          i->mana = i->max_mana;
          i->move = i->max_move;
          i->challenged=NULL;
//          i->armor = i->pcdata->oldac;
          char_from_room(i);
          location = i->pcdata->roomarena;
          char_to_room(i,location);
          do_look(i, "auto");
          act(AT_YELLOW,"$n falls from the sky.", i, NULL, NULL, TO_ROOM);
          if(time_left_in_game == 1)
          {
             sprintf(buf, "After 1 hour of battle %s is declared the winner",i->name);
             sportschan(buf);
          }
          else
          {
             sprintf(buf, "After %d hours of battle %s is declared the winner",
                   game_length - time_left_in_game, i->name);
             sportschan(buf);
          }
          i->gold += arena_pot/2;
          sprintf(buf, "You have been awarded %d credits for winning the arena\r\n",
                        (arena_pot/2));
          send_to_char(buf, i);
//          sprintf(buf2, "%s awarded %d credits for winning arena", i->name,                 (arena_pot/2));
//          bug(buf2, 0);
          CREATE(fame_node, struct hall_of_fame_element, 1);
          strncpy(fame_node->name, i->name, MAX_INPUT_LENGTH);
          fame_node->name[MAX_INPUT_LENGTH] = '\0';
          fame_node->date = time(0);
          fame_node->award = (arena_pot/2);
          fame_node->next = fame_list;
          fame_list = fame_node;
          write_fame_list();
          find_bet_winners(i);
          ppl_in_arena = 0;
          ppl_challenged = 0;
        }
     }
Example #10
0
/*
 * Lets the mobile transfer people.  The 'all' argument transfers
 *  everyone in the current room to the specified location
 *
 * Syntax: mob transfer [target|'all'] [location]
 */
void do_mptransfer(CHAR_DATA * ch, char *argument)
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    ROOM_INDEX_DATA *location;
    CHAR_DATA *victim;

    argument = one_argument(argument, arg1);
    argument = one_argument(argument, arg2);

    if (arg1[0] == '\0') {
	bug("Mptransfer - Bad syntax from vnum %d.",
	    IS_NPC(ch) ? ch->pIndexData->vnum : 0);
	return;
    }
    if (!str_cmp(arg1, "all")) {
	CHAR_DATA *victim_next;

	for (victim = ch->in_room->people; victim != NULL; victim = victim_next) {
	    victim_next = victim->next_in_room;
	    if (!IS_NPC(victim)) {
		sprintf(buf, "%s %s", victim->name, arg2);
		do_mptransfer(ch, buf);
	    }
	}
	return;
    }
    /*
     * Thanks to Grodyn for the optional location parameter.
     */
    if (arg2[0] == '\0') {
	location = ch->in_room;
    } else {
	if ((location = find_location(ch, arg2)) == NULL) {
	    bug("Mptransfer - No such location from vnum %d.",
		IS_NPC(ch) ? ch->pIndexData->vnum : 0);
	    return;
	}
	if (room_is_private(location))
	    return;
    }

    if ((victim = get_char_world(ch, arg1)) == NULL)
	return;

    if (victim->in_room == NULL)
	return;

    if (victim->fighting != NULL)
	stop_fighting(victim, TRUE);
    char_from_room(victim);
    char_to_room(victim, location);
    do_look(victim, "auto");

    return;
}
Example #11
0
void do_arena(CHAR_DATA *ch, char *argument)
{
 char buf[MAX_INPUT_LENGTH];
 ROOM_INDEX_DATA *location;

 
 if (IS_NPC(ch))
 {
   send_to_char("Mobs cant play in the arena.\r\n",ch);
   return;
 }

 if(!in_start_arena)
 {
   send_to_char("The killing fields are closed right now.\r\n", ch);
   return;
 }
 
 if(ch->top_level < lo_lim)
 {
   sprintf(buf, "Sorry but you must be at least level %d to enter this arena.\r\n", lo_lim);
   send_to_char(buf, ch);
   return;	
 }
 
 if( ch->top_level > hi_lim)
 {
    send_to_char("This arena is for lower level characters.\n\r", ch);
    return;
 } 
 
 if(IS_SET(ch->in_room->room_flags2, ROOM_ARENA))
 { 
    send_to_char("You are in the arena already\r\n",ch);
    return;
 }	
 else
 {

    location = ch->in_room;
    ch->pcdata->roomarena = location;
    act(AT_RED, "$n has been whisked away to the killing fields.", ch, NULL, NULL, TO_ROOM);
    char_from_room(ch);
    char_to_room(ch, get_room_index(PREP_START)); 
    act(AT_WHITE,"$n is dropped from the sky.", ch, NULL, NULL, TO_ROOM);
    send_to_char("You have been taken to the killing fields\r\n",ch);
    do_look(ch, "auto");
    sprintf(buf, "%s has joined the blood bath.", ch->name);
    sportschan(buf);
    send_to_char(buf, ch);
    ch->hit = ch->max_hit;
    ch->mana = ch->max_mana;
    ch->move = ch->max_move; 
     return;
  }
}
Example #12
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;
}
Example #13
0
void Teleport( int pulse )
{
   struct char_data *ch;
   struct obj_data *obj_object, *temp_obj;
   int or;

   if(DEBUG) dlog("Teleport");
   if (pulse < 0) 
      return;

   if(MOUNTED(ch))
   {
     FallOffMount(ch,MOUNTED(ch));
     Dismount(ch,MOUNTED(ch),POSITION_SITTING);
   }
   else
   if(RIDDEN(ch))
   {
     FallOffMount(RIDDEN(ch),ch);
     Dismount(RIDDEN(ch),ch,POSITION_SITTING);
   }

   for (ch = character_list; ch; ch = ch->next) 
   {
     if (ch->in_room != NOWHERE) 
     {
	if (real_roomp(ch->in_room)->tele_targ > 0) 
	{
           if (real_roomp(ch->in_room)->tele_time > 0) 
	   {
              if ((pulse % real_roomp(ch->in_room)->tele_time)==0) 
	      {
		 obj_object = real_roomp(ch->in_room)->contents;
		 while (obj_object) 
		 {
		   temp_obj = obj_object->next_content;
                   obj_from_room(obj_object);
   	           obj_to_room(obj_object, real_roomp(ch->in_room)->tele_targ);
		   obj_object = temp_obj;
		 }

		 or = ch->in_room;
		 char_from_room(ch); 
		 char_to_room(ch, real_roomp(or)->tele_targ);
       	         if (real_roomp(or)->tele_look) 
		 {
                   do_look(ch, "\0",15);
		 }
	       }
	    }
	 }
      }
   }
}
Example #14
0
/* syntax : teleport <target>
 * ex : teleport satan
 */
void do_teleport (CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  ROOM_INDEX_DATA *location;
  CHAR_DATA *victim;

  one_argument (argument, arg);
  if (IS_NPC(ch)) return;
  if (!IS_CLASS(ch, CLASS_MAGE))
  {
    send_to_char("Huh?\n\r", ch );
    return;
	}
  if (ch->pcdata->powers[PINVOKE] < 1) /* 1 is just a test */
  {
    send_to_char("You don't have that invoke yet.\n\r",ch);
    return;
  }
  if ((victim = get_char_world(ch, arg)) == NULL) 
  {
    send_to_char("Teleport to whom?\n\r", ch );
    return;
  }
  if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  { 
    stc( "You can't find it's room.\n\r",ch);
    return; 
  }
  if (IS_IMMUNE(victim, IMM_TRAVEL) && !IS_NPC(victim))
  {
    send_to_char("I don't think they want you to do that.\n\r",ch);
    return;
  } 
  if (IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "Your room is not connected to the astral plane.\n\r",ch);
    return;
  }
	location = victim->in_room;
  if (ch->mana < 250) 
  {
    send_to_char("You don't have the mana to cast teleport.\n\r", ch );
    return;
  }
	act("You utter a single powerword.", ch, NULL, NULL, TO_CHAR);
	act("$n utters a strange sounding word and disappers.", ch, NULL, NULL, TO_ROOM);
	ch->mana -= 250;
	char_from_room(ch);
	char_to_room(ch, location);
	do_look(ch, "auto");
	act("You materialize.", ch, NULL, NULL, TO_CHAR);
	act("$n suddenly appear from out of nowhere.", ch, NULL, NULL, TO_ROOM);
  return;
}
Example #15
0
int kings_hall(struct char_data *ch, int cmd, char *arg)
{
	if (cmd != 176)
		return(0);

	do_action(ch, arg, 176);

	send_to_char("You feel as if some mighty force has been offended.\n\r", ch);
	send_to_char(CHAL_ACT, ch);
	act("$n is struck by an intense beam of light and vanishes.",
		TRUE, ch, 0, 0, TO_ROOM);
	char_from_room(ch);
	char_to_room(ch, real_room(1420));  /* behind the altar */
	do_look(ch, "", 15);
	return(1);
}
Example #16
0
int main(object me, string arg)
{
	object board;
	seteuid(getuid());
	board=find_object("/clone/board/news_b");
	if (!board) board=new("/clone/board/news_b");
        if (! arg || arg == "" )
        {
                tell_object(me,bshort(board));
                return 1;
        }
        if (arg == "all")
        {//news all == l board
                return do_look(board);
        }

        if (sscanf(arg, "discard %s", arg))
        {
                return board->delete_post(arg);
        }

        if (sscanf(arg, "post %s", arg))
        {
       		 	if (! wizardp(me) || ! interactive(me))
       			 {
                tell_object(me, "只有巫师才能发布新闻。\n");
                return 1;
       	 		}               
        			if (replace_string(arg, " ", "") == "")
         		       arg = "无标题";
                if (board->do_post(arg))
                 {
         shout(HIC "【侠客行一百】" NOR + WHT + me->name() + WHT "[" +
             me->query("id") + WHT "]发布了一条新闻,请用(news)命令查看。\n" NOR);

        tell_object(me, HIC "【侠客行一百】" NOR + WHT + me->name() + WHT "[" +
             me->query("id") + WHT "]发布了一条新闻。\n" NOR);

        tell_object(me, "新闻发布完成。\n");
                	return 1;
                 	}
                 return 0;
        }

        return board->do_read(arg);
}
Example #17
0
void move_char(Character *ch, direction_t dir)
{

    if (ch->inRoom == 0)
    {
        log_error("character with no room");
        return;
    }
    Exit *ex = ch->inRoom->exits[dir];

    if (ex == 0 || ex->to.room == 0)
    {
        xwriteln(ch, "You can't move in that direction.");
        return;
    }
    char_from_room(ch);
    char_to_room(ch, ex->to.room);

    do_look(str_empty, ch, str_empty);
}
Example #18
0
void start_game()
{
  CHAR_DATA *i;
  DESCRIPTOR_DATA *d;
    
  for (d = first_descriptor; d; d = d->next)
  {
  if( d->connected == CON_PLAYING )
  {
    i = d->character;
    if (IS_SET(i->in_room->room_flags2, ROOM_ARENA))
    {
       send_to_char("\r\nThe floor falls out from bellow, droping you in the arena\r\n", i);
       char_from_room(i);
//      i->pcdata->oldac = i->armor;
//       i->armor = -1500;
       char_to_room(i, get_room_index( ARENA_START));
       do_look(i,"auto");
    }
  }
 }
  do_game();
}
Example #19
0
void TrapTeleport(struct char_data *v) 
{
	int to_room;
	extern int top_of_world;      /* ref to the top element of world */
        struct room_data *room;

if(DEBUG) dlog("TrapTeleport");
    if (saves_spell(v,SAVING_SPELL)) 
    {
       send_to_char("You feel strange, but the effect fades.\n\r",v);
       return;
     } 

     do {
		to_room = number(0, top_of_world);
		room = real_roomp(to_room);
		if(room)
		{
		  if(IS_SET(room->room_flags,PRIVATE))
		    room = 0;
                }
     } while(!room);

     act("$n slowly fade out of existence.", FALSE, v,0,0,TO_ROOM);
     char_from_room(v);
     char_to_room(v, to_room);
     act("$n slowly fade in to existence.", FALSE, v,0,0,TO_ROOM);

     do_look(v, "", 0);

     if (IS_SET(real_roomp(to_room)->room_flags,DEATH) && GetMaxLevel(v) < LOW_IMMORTAL) 
     {
       death_cry(v);
       zero_rent(v);
       extract_char(v);
     }
}
Example #20
0
/* Recover from a hotreboot - load players */
void hotreboot_recover()
{
	DESCRIPTOR_DATA *d;
	FILE *fp;
	char name[100];
	char host[MSL];
	long desc;
	bool fOld;

	fp = fopen(HOTREBOOT_FILE, "r");

	if(!fp)			/* there are some descriptors open which will hang forever then ? */
	{
		perror("hotreboot_recover:fopen");
		exit(1);
	}

/*	unlink (HOTREBOOT_FILE);  In case something crashes - doesn't prevent reading	*/

	for(;;)
	{
		fscanf(fp, "%li %s %s\n", &desc, name, host);
		if(desc == -1)
			break;

		/* Write something, and check if it goes error-free */
		if(!write_to_descriptor(desc, "\n\rRestoring from hotreboot...\n\r", 0))
		{
#ifdef WIN32
			closesocket(desc);

#else /*  */
			close(desc);	/* nope */
#endif /*  */
			continue;
		}

		d = alloc_perm(sizeof(DESCRIPTOR_DATA));
		init_descriptor(d, desc);	/* set up various stuff */

		d->host = str_dup(host);
		d->next = descriptor_list;
		descriptor_list = d;
		d->connected = CON_HOTREBOOT_RECOVER;	/* -15, so close_socket frees the char */


		/* Now, find the pfile */

		fOld = load_char_obj(d, name);

		if(!fOld)	/* Player file not found?! */
		{
			write_to_descriptor(desc, "\n\rSomehow, your character was lost in the hotreboot. Reconnect\n\r",
					    0);
			close_socket2(d, FALSE);
		}
		else		/* ok! */
		{
			/* Just In Case */
			if(!d->character->in_room)
				d->character->in_room = get_room_index(ROOM_VNUM_TEMPLE);

			/* Insert in the char_list */
			d->character->next = char_list;
			char_list = d->character;

			char_to_room(d->character, d->character->in_room);
			do_look(d->character, "");
			act("$n appears from the netherworld!", d->character, 0, 0, TO_ROOM);
			d->connected = CON_PLAYING;
		}

	}

	fclose(fp);
	olduptime = get_olduptime();

}
Example #21
0
void
do_assist (CHAR_DATA * ch, char *argument, int cmd)
{
  CHAR_DATA *tch = NULL;
  int pos = 0, i = 0;
  char buf[MAX_STRING_LENGTH];

  if (!IS_GUIDE (ch) && IS_MORTAL (ch)
      && !IS_SET (ch->plr_flags, NEW_PLAYER_TAG))
    {
      send_to_char
	("Only Guides, staff members, and new characters may use this command.\n",
	 ch);
      return;
    }

  if (!str_cmp (argument, "request"))
    {
      if (str_cmp (ch->room->name, PREGAME_ROOM_NAME))
	{
	  send_to_char
	    ("This command may only be invoked in a pre-game debriefing room.\n",
	     ch);
	  return;
	}
      if (!IS_SET (ch->plr_flags, NEW_PLAYER_TAG))
	{
	  send_to_char
	    ("The assist queue is only available to new characters.\n", ch);
	  return;
	}
      if ((pos = get_queue_position (ch)) != -1)
	{
	  sprintf (buf,
		   "You are already number #6%d#0 in the assist queue.\n",
		   pos);
	  send_to_char (buf, ch);
	  return;
	}
      update_assist_queue (ch, false);
      ch->assist_pos = get_queue_position (ch);
      sprintf (buf, "You are now number #6%d#0 in the assist queue.\n",
	       get_queue_position (ch));
      send_to_char (buf, ch);
      return;
    }
  else if (!str_cmp (argument, "cancel"))
    {
      if ((pos = get_queue_position (ch)) == -1)
	{
	  send_to_char ("You are not currently in the assist queue.\n", ch);
	  return;
	}
      update_assist_queue (ch, true);
      send_to_char ("You have been removed from the assist queue.\n", ch);
      return;
    }
  else if (!str_cmp (argument, "list") || !str_cmp (argument, "queue"))
    {
      if (!IS_GUIDE (ch) && IS_MORTAL (ch))
	{
	  send_to_char
	    ("Only Guides and staff members may see the assist queue.\n", ch);
	  return;
	}
      if (!assist_queue)
	{
	  send_to_char ("The assist queue is currently empty.\n", ch);
	  return;
	}
      sprintf (buf, "#6Currently waiting in the assist queue:#0\n\n");
      for (tch = assist_queue; tch; tch = tch->next_assist)
	{
	  i++;
	  sprintf (buf + strlen (buf), "  %2d. %s\n", i, tch->pc->account_name);
	}
      send_to_char (buf, ch);
      return;
    }
  else if (!str_cmp (argument, "answer"))
    {
      if (!IS_GUIDE (ch) && IS_MORTAL (ch))
	{
	  send_to_char
	    ("Only Guides and staff members may answer assist requests.\n",
	     ch);
	  return;
	}
      if (IS_GUIDE (ch) && !IS_SET (ch->flags, FLAG_GUEST))
	{
	  send_to_char
	    ("You may only answer assist requests via your Guest login.\n",
	     ch);
	  return;
	}
      if (!(tch = assist_queue))
	{
	  send_to_char
	    ("There is currently no-one waiting in the assist queue.\n", ch);
	  return;
	}
      act ("Your request for assistance has been answered!", true, tch, 0, 0,
	   TO_CHAR);

      if (tch->in_room != ch->in_room)
	{
	  tch->was_in_room = tch->in_room;
	  send_to_char ("\n", tch);
	  act ("$n vanishes in a subtle glimmer of light.", true, ch, 0, 0,
	       TO_ROOM | _ACT_FORMAT);
	  char_from_room (ch);
	  char_to_room (ch, tch->in_room);
	  act ("$n appears in a subtle glimmer of light.", true, ch, 0, 0,
	       TO_ROOM | _ACT_FORMAT);
	  send_to_char ("\n", ch);
	  act
	    ("The world around you fades away in a glimmer of light and you feel yourself whisked instantly to $N's location.",
	     false, ch, 0, tch, TO_CHAR | _ACT_FORMAT);
	  send_to_char ("\n", ch);
	}
      else
	send_to_char ("\n", ch);

      update_assist_queue (tch, true);

      send_to_char ("\n", ch);

      do_look (ch, "", 0);

      return;
    }
  else if (!str_cmp (argument, "return"))
    {
      if (!IS_GUIDE (ch) || !IS_SET (ch->flags, FLAG_GUEST))
	{
	  send_to_char ("This command is only for Guide guest logins.\n", ch);
	  return;
	}
      if (ch->in_room == OOC_LOUNGE)
	{
	  send_to_char ("You're already in Club Endore!\n", ch);
	  return;
	}
      act ("$n vanishes in a subtle glimmer of light.", true, ch, 0, 0,
	   TO_ROOM | _ACT_FORMAT);
      char_from_room (ch);
      char_to_room (ch, OOC_LOUNGE);
      act ("$n appears in a subtle glimmer of light.", true, ch, 0, 0,
	   TO_ROOM | _ACT_FORMAT);
      send_to_char ("\n", ch);
      act
	("The world around you fades away in a glimmer of light and you feel yourself whisked instantly back to Club Endore.",
	 false, ch, 0, 0, TO_CHAR | _ACT_FORMAT);
      send_to_char ("\n", ch);
      do_look (ch, "", 0);
      return;
    }
  else if (*argument)
    {
      send_to_char ("See #6HELP ASSIST#0 for command usage.\n", ch);
      return;
    }

  if ((pos = get_queue_position (ch)) != -1)
    {
      sprintf (buf, "You are currently number #6%d#0 in the assist queue.\n",
	       pos);
      send_to_char (buf, ch);
      return;
    }
  else
    send_to_char ("You are not currently in the assist queue.\n", ch);

  return;
}
Example #22
0
/* TODO: CMD_ARG_POS is meaningful here, we should implement it. */
int
doquickwhatis(const struct nh_cmd_arg *arg)
{
    return do_look(TRUE, arg);
}
Example #23
0
void do_bladejump( CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MAX_INPUT_LENGTH];

  if ( IS_NPC(ch) )
    return;

  argument = one_argument (argument, arg);

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

  if ( arg[0] == '\0' )
  {
    send_to_char( "BladeJump to whom?\n\r", ch );
    return;
  }

  if ( ( victim = get_char_world( ch, arg ) ) == NULL )
  {
    send_to_char( "You cannot find them.\n\r", ch );
    return;
  }

  if( ch->move < 1000)
  {
    stc( "You don't have enough movement points to bladejump to them.\n\r",ch);
    return;
  }

  if( IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "You can't find it's room.\n\r",ch);
    return;
  }

  if( IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "Your body can't go there.\n\r",ch);
    return;
  }
    if (IS_SET(victim->act, ACT_NOTRAVEL))
  {
  	send_to_char("No Can Do.\n\r", ch);
  	return;
  }
  if (ch == victim)
  {
    send_to_char("But you're already at yourself!\n\r",ch);
    return;
  }

  if ( room_is_private(victim->in_room ) )
  {
    send_to_char( "That room is private right now.\n\r", ch );
    return;
  }
  if (!IS_NPC(victim) && ch->move < victim->max_move)
  {
    if ( !IS_NPC(victim) && !IS_IMMUNE(victim, IMM_SUMMON) )
    {
      send_to_char( "They are hiding from you.\n\r", ch );
      return;
    }
    else
    send_to_char("You need more move than you're opponent.\n\r",ch);
  }
  if (victim->in_room == ch->in_room)
  {
    send_to_char("But you're already there!\n\r",ch);
    return;
  }

  act("You jump into the clouds", ch, NULL, victim, TO_CHAR);
  act("$n jumps into the clouds", ch, NULL, victim, TO_ROOM);
  char_from_room(ch);
  char_to_room(ch,victim->in_room);
  ch->move -= 1000;
  act("$n jumps out of the clouds and lands infront of $N.", ch, NULL, victim, TO_NOTVICT);
  act("$n jumps out of the clouds and lands infront of you.", ch, NULL, victim, TO_VICT);
  do_look(ch,"auto");
  return;
}
Example #24
0
int doquickwhatis(void)
{
	return do_look(TRUE);
}
Example #25
0
int
dowhatis(const struct nh_cmd_arg *arg)
{
    return do_look(FALSE, arg);
}
Example #26
0
void do_gbanish( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    CHAR_DATA *mount;
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int dam;

    argument = one_argument( argument, arg );

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_ANGEL))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }
    if (ch->pcdata->powers[ANGEL_HARMONY] < 3)
    {
        send_to_char("Your not in contact with your inner harmonies.\n\r",ch);
        return;
    }
    if ((victim = get_char_room(ch, arg)) == NULL)
    {
        send_to_char("They are not here.\n\r", ch);
        return;
    }
    if (IS_NPC(victim))
    {
        send_to_char("Not on mobiles.\n\r",ch);
        return;
    }
    if (is_safe(ch,victim)) return;
    if (victim == ch)
    {
        send_to_char("That doesn't seem like a good idea.\n\r",ch);
        return;
    }
    if (victim->alignment > 500)
    {
        send_to_char("They are not evil, you cannot punish them.\n\r",ch);
        return;
    }
    if (victim->alignment > 0) dam = 500;
    else if (victim->alignment > - 500) dam = 1000;
    else dam = 1500;
    sprintf(buf,"Your call for God to banish $N and $S is hurt [%d]",dam);
    act(buf,ch,NULL,victim,TO_CHAR);
    sprintf(buf,"$n calls for God to banish you, and it hurts BAD! [%d]",dam);
    act(buf,ch,NULL,victim,TO_VICT);
    sprintf(buf,"$n calls for God to Banish $N.");
    act(buf,ch,NULL,victim,TO_NOTVICT);
    hurt_person(ch,victim,dam);
    if (number_range(1,10) > 7)
    {
        act( "$n is flung into a vortex and disappears.", victim, NULL, NULL, TO_ROOM );
        char_from_room( victim );
        char_to_room( victim, get_room_index(ROOM_VNUM_HELL));
        act( "$n is flung out of a vortex.", victim, NULL, NULL, TO_ROOM );
        do_look(victim, "auto");
        if ((mount = victim->mount) == NULL) return;
        char_from_room( mount );
        char_to_room(mount, victim->in_room);
        do_look(mount, "auto");
        return;
    }
    if (victim->position > POS_STUNNED)
    {
        if (victim->fighting == NULL) set_fighting(victim, ch);
        if (ch->fighting == NULL) set_fighting(ch, victim);
    }
    WAIT_STATE(ch,18);
    return;
}
Example #27
0
/* RT Enter portals */
void do_enter( CHAR_DATA *ch, char *argument)
{    
    ROOM_INDEX_DATA *location; 

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

    /* nifty portal stuff */
    if (argument[0] != '\0')
    {
        ROOM_INDEX_DATA *old_room;
	OBJ_DATA *portal;
	CHAR_DATA *fch, *fch_next;

        old_room = ch->in_room;

	portal = get_obj_list( ch, argument,  ch->in_room->contents );
	
	if (portal == NULL)
	{
	    send_to_char("You don't see that here.\n\r",ch);
	    return;
	}

	if (portal->item_type != ITEM_PORTAL 
        ||  (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,KNIGHT)))
	{
	    send_to_char("You can't seem to find a way in.\n\r",ch);
	    return;
	}

	if (!IS_TRUSTED(ch,KNIGHT) && !IS_SET(portal->value[2],GATE_NOCURSE)
	&&  IS_AFFECTED(ch,AFF_CURSE) )
	{
	    send_to_char("Something prevents you from leaving...\n\r",ch);
	    return;
	}

	if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1)
	{
	    location = get_random_room(ch);
	    portal->value[3] = location->vnum; /* for record keeping :) */
	}
	else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5))
	    location = get_random_room(ch);
	else
	    location = get_room_index(portal->value[3]);

	if (location == NULL
	||  location == old_room
	||  !can_see_room(ch,location) 
	||  (room_is_private(ch,location) && !IS_TRUSTED(ch,IMPLEMENTOR)))
	{
	   act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR);
	   return;
	}

        if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE)
        &&  IS_SET(location->room_flags,ROOM_LAW))
        {
            send_to_char("Something prevents you from leaving...\n\r",ch);
            return;
        }

	act("$n steps into $p.",ch,portal,NULL,TO_ROOM);
	
	if (IS_SET(portal->value[2],GATE_NORMAL_EXIT))
	    act("You enter $p.",ch,portal,NULL,TO_CHAR);
	else
	    act("You walk through $p and find yourself somewhere else...",
	        ch,portal,NULL,TO_CHAR); 

	char_from_room(ch);
	char_to_room(ch, location);

	if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */
	{
	    obj_from_room(portal);
	    obj_to_room(portal,location);
	}

	if (IS_SET(portal->value[2],GATE_NORMAL_EXIT))
	    act("$n has arrived.",ch,portal,NULL,TO_ROOM);
	else
	    act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM);

	do_look(ch,"auto");

	/* charges */
	if (portal->value[0] > 0)
	{
	    portal->value[0]--;
	    if (portal->value[0] == 0)
		portal->value[0] = -1;
	}

	/* protect against circular follows */
	if (old_room == location)
	    return;

    	for ( fch = old_room->people; fch != NULL; fch = fch_next )
    	{
            fch_next = fch->next_in_room;

            if (portal == NULL || portal->value[0] == -1) 
	    /* no following through dead portals */
                continue;
 
            if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM)
            &&   fch->position < POS_STANDING)
            	do_stand(fch,"");

            if ( fch->master == ch && fch->position == POS_STANDING)
            {
 
                if (IS_SET(ch->in_room->room_flags,ROOM_LAW)
                &&  (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE)))
                {
                    act("You can't bring $N into the city.",
                    	ch,NULL,fch,TO_CHAR);
                    act("You aren't allowed in the city.",
                    	fch,NULL,NULL,TO_CHAR);
                    continue;
            	}
 
            	act( "You follow $N.", fch, NULL, ch, TO_CHAR );
		do_enter(fch,argument);
            }
    	}

 	if (portal != NULL && portal->value[0] == -1)
	{
	    act("$p fades out of existence.",ch,portal,NULL,TO_CHAR);
	    if (ch->in_room == old_room)
		act("$p fades out of existence.",ch,portal,NULL,TO_ROOM);
	    else if (old_room->people != NULL)
	    {
		act("$p fades out of existence.", 
		    old_room->people,portal,NULL,TO_CHAR);
		act("$p fades out of existence.",
		    old_room->people,portal,NULL,TO_ROOM);
	    }
	    extract_obj(portal);
	}

	/* 
	 * If someone is following the char, these triggers get activated
	 * for the followers before the char, but it's safer this way...
	 */
	if ( IS_NPC( ch ) && HAS_TRIGGER( ch, TRIG_ENTRY ) )
	    mp_percent_trigger( ch, NULL, NULL, NULL, TRIG_ENTRY );
	if ( !IS_NPC( ch ) )
	    mp_greet_trigger( ch );

	return;
    }

    send_to_char("Nope, can't do it.\n\r",ch);
    return;
}
Example #28
0
void do_clanview( CHAR_DATA *ch, char *argument )
{
    ROOM_INDEX_DATA *from_room;
    char	target_name[MAX_STRING_LENGTH];
    CHAR_DATA *victim;

    if (IS_NPC( ch ) )
        return;

    if (ch->clan < 1 )
    {
        send_to_char( C_DEFAULT, "Huh?\n\r", ch );
        return;
    }

    if ( !( victim = get_char_world( ch, argument ) ) || IS_NPC( victim ) )
    {
        send_to_char(C_DEFAULT, "No such person exists.\n\r", ch );
        return;
    }

    if (victim->clan != ch->clan)
    {
        send_to_char(AT_BLUE, "They aren't in your clan!\n\r", ch );
        return;
    }

    one_argument( argument, target_name );

    if ( IS_SET(ch->in_room->area->area_flags, AREA_PRESENT)
            && (IS_SET( victim->in_room->area->area_flags, AREA_FUTURE )
                || IS_SET( victim->in_room->area->area_flags, AREA_PAST ) ) )
    {
        send_to_char(AT_BLUE, "You cannot!!!!!!!!\n\r", ch );
        return;
    }

    if ( IS_SET(ch->in_room->area->area_flags, AREA_FUTURE )
            && (IS_SET( victim->in_room->area->area_flags, AREA_PRESENT )
                || IS_SET( victim->in_room->area->area_flags, AREA_PAST ) ) )
    {
        send_to_char(AT_BLUE, "You cannot!!!!!!!!\n\r", ch );
        return;
    }

    if ( IS_SET(ch->in_room->area->area_flags, AREA_PAST )
            && (IS_SET( victim->in_room->area->area_flags, AREA_FUTURE )
                || IS_SET( victim->in_room->area->area_flags, AREA_PRESENT ) ) )
    {
        send_to_char( AT_BLUE, "You cannot!!!!!!!!\n\r", ch );
        return;
    }

    from_room = ch->in_room;
    if ( ch != victim )
    {
        char_from_room( ch );
        char_to_room( ch, victim->in_room );
    }
    do_look( ch, "auto" );
    if( ch != victim )
    {
        char_from_room( ch );
        char_to_room( ch, from_room );
    }
    return;
}
Example #29
0
bool sp_damage( OBJ_DATA * obj, CHAR_DATA * ch, CHAR_DATA * victim, int dam, int type, int sn, bool show_msg )
{
    int ch_strong, ch_weak, ch_race, ch_suscept, ch_resist, vi_strong, vi_weak, vi_race, vi_suscept, vi_resist;
    float dam_modifier = 1.0;
    float tmp = 0;
    bool can_reflect = TRUE;
    bool can_absorb = TRUE;

    if ( victim == NULL )
        return FALSE;

    /*
     *  First, check caster's strengths and weaknesses.
     *
     */

    if ( IS_SET( type, NO_REFLECT ) )
    {
        REMOVE_BIT( type, NO_REFLECT );
        can_reflect = FALSE;
    }
    if ( IS_SET( type, NO_ABSORB ) )
    {
        REMOVE_BIT( type, NO_ABSORB );
        can_absorb = FALSE;
    }
    if ( obj == NULL )
    {
        if ( ( can_reflect )
                && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE )
                && ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
                && ( ch != victim ) && ( number_percent(  ) < ( victim->get_level("psuedo") - 70 ) ) )
        {

            act( "@@N$n's @@lc@@el@@ro@@ya@@ak@@N glows brightly as $Nn's spell hits it, and the spell is reflected@@N!!", ch,
                 victim, NULL, TO_ROOM );
            act( "@@N$N's @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects your spell back on you@@N!!", ch, NULL, victim,
                 TO_CHAR );
            act( "@@NYour @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects the spell back on $N@@N!!!", victim, NULL, ch,
                 TO_CHAR );
            ( *skill_table[sn].spell_fun ) ( sn, 60, ch, ( void * )ch, NULL );
            return FALSE;

        }


        else if ( ( can_reflect )
                  && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE )
                  && ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
                  && ( ch != victim ) && ( number_percent(  ) < ( victim->get_level("psuedo") - 55 ) ) )
        {
            int mana;
            mana = mana_cost( ch, sn );
            victim->mana = UMIN( victim->max_mana, victim->mana + mana );

            act( "@@N$n's @@lcloak@@N glows brightly as $N's spell hits it, then fades@@N!!", victim, NULL, ch, TO_ROOM );
            act( "@@N$N's @@lcloak@@N glows brightly, and absorbs your spell@@N!!", ch, NULL, victim, TO_CHAR );
            act( "@@NYour @@lcloak@@N glows brightly, and absorbs $N's spell@@N!!!", victim, NULL, ch, TO_CHAR );
            return FALSE;
        }




        ch_strong = ( IS_NPC( ch ) ?
                      ( ( ( ch->race > 0 )
                          && ( ch->race < MAX_RACE ) ) ?
                        race_table[ch->race].strong_realms : ch->npcdata->strong_magic ) : race_table[ch->race].strong_realms );
        ch_resist = ( IS_NPC( ch ) ?
                      ( ( ( ch->race > 0 )
                          && ( ch->race < MAX_RACE ) ) ?
                        race_table[ch->race].resist_realms : ch->npcdata->resist ) : race_table[ch->race].resist_realms );
        ch_weak = ( IS_NPC( ch ) ?
                    ( ( ( ch->race > 0 )
                        && ( ch->race < MAX_RACE ) ) ?
                      race_table[ch->race].weak_realms : ch->npcdata->weak_magic ) : race_table[ch->race].weak_realms );
        ch_suscept = ( IS_NPC( ch ) ?
                       ( ( ( ch->race > 0 )
                           && ( ch->race < MAX_RACE ) ) ?
                         race_table[ch->race].suscept_realms : ch->npcdata->suscept ) : race_table[ch->race].suscept_realms );
        ch_race = ( IS_NPC( ch ) ?
                    ( ( ( ch->race > 0 )
                        && ( ch->race < MAX_RACE ) ) ?
                      race_table[ch->race].race_flags : ch->race_mods ) : race_table[ch->race].race_flags );

        if ( IS_SET( ch_strong, type ) )
        {
            dam_modifier += .35;
        }
        else if ( IS_SET( ch_weak, type ) )
        {
            dam_modifier -= .35;
        }

        if ( IS_SET( ch_race, RACE_MOD_STRONG_MAGIC ) )
        {
            dam_modifier += .25;
        }
        else if ( IS_SET( ch_race, RACE_MOD_WEAK_MAGIC ) )
        {
            dam_modifier -= .25;
        }
        else if ( IS_SET( ch_race, RACE_MOD_NO_MAGIC ) )
        {
            dam_modifier -= .50;
        }

        if ( ch->stance == STANCE_CASTER )
            dam_modifier += .10;
        else if ( ch->stance == STANCE_WIZARD )
            dam_modifier += .25;
        else if ( ch->stance == STANCE_MAGI )
            dam_modifier += .30;

        if ( ( !IS_NPC( ch ) ) && ( !IS_SET( type, REALM_MIND ) ) )
        {
            if ( ch->pcdata->learned[gsn_potency] > 0 )
            {
                dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_potency] / 5000 );
            }

            if ( ch->pcdata->learned[gsn_thaumatergy] > 0 )
            {
                dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_thaumatergy] / 2500 );
            }
        }
        if ( is_affected( ch, skill_lookup( "mystical focus" ) ) )
        {
            dam_modifier += .5;
        }
    }  /* obj == NULL */
    else if ( obj->carried_by != NULL )
    {
        ch = obj->carried_by;
    }
    else
    {
        snprintf( log_buf, (2 * MIL), "Error, object %s casting spell, but not carried by anyone.", obj->short_descr );
        monitor_chan( log_buf, MONITOR_DEBUG );
        return FALSE;
    }

    /*
     *  Next, the victim
     *
     */
    vi_strong = ( IS_NPC( victim ) ?
                  ( ( ( victim->race > 0 )
                      && ( victim->race < MAX_RACE ) ) ?
                    race_table[victim->race].strong_realms :
                    victim->npcdata->strong_magic ) : race_table[victim->race].strong_realms );
    vi_resist = ( IS_NPC( victim ) ?
                  ( ( ( victim->race > 0 )
                      && ( victim->race < MAX_RACE ) ) ?
                    race_table[victim->race].resist_realms : victim->npcdata->resist ) : race_table[victim->race].resist_realms );
    vi_weak = ( IS_NPC( victim ) ?
                ( ( ( victim->race > 0 )
                    && ( victim->race < MAX_RACE ) ) ?
                  race_table[victim->race].weak_realms : victim->npcdata->weak_magic ) : race_table[victim->race].weak_realms );
    vi_suscept = ( IS_NPC( victim ) ?
                   ( ( ( victim->race > 0 )
                       && ( victim->race < MAX_RACE ) ) ?
                     race_table[victim->race].suscept_realms : victim->npcdata->suscept ) : race_table[victim->race].suscept_realms );
    vi_race = ( IS_NPC( victim ) ?
                ( ( ( victim->race > 0 )
                    && ( victim->race < MAX_RACE ) ) ?
                  race_table[victim->race].race_flags : victim->race_mods ) : race_table[victim->race].race_flags );

    if ( IS_SET( vi_suscept, type ) )
    {
        dam_modifier += .45;
    }
    else if ( IS_SET( vi_resist, type ) )
    {
        dam_modifier -= .45;
    }

    else if ( IS_SET( vi_race, RACE_MOD_NO_MAGIC ) )
    {
        dam_modifier -= .25;
    }

    if ( MAGIC_STANCE( ch ) )
        dam_modifier += .15;

    if ( ( IS_SET( type, REALM_MIND ) ) && ( !HAS_MIND( victim ) ) )
        dam_modifier = 0.0;
    else if ( ( ( IS_SET( type, REALM_IMPACT ) )
                || ( IS_SET( type, REALM_ACID ) ) || ( IS_SET( type, REALM_GAS ) ) ) && ( !HAS_BODY( victim ) ) )
        dam_modifier = 0.0;

    if ( ( IS_SET( type, REALM_POISON ) ) && ( IS_SET( vi_race, RACE_MOD_IMMUNE_POISON ) ) )
        dam_modifier = 0.0;

    if ( ( IS_SET( type, REALM_DRAIN ) ) && ( IS_UNDEAD( victim ) ) )
        dam_modifier = 0.0;

    tmp = dam;
    tmp *= dam_modifier;

    if ( check_charm_aff(ch, CHARM_AFF_MAGE) )
        tmp *= ((100 + get_charm_bonus(ch, CHARM_AFF_MAGE)) / 100);

    dam = static_cast<int>(tmp);
    dam += number_range(static_cast<int>((dam * -0.10)), static_cast<int>((dam * 0.10))); /* Lets add a little randomness to things. --Kline */

    if ( victim != ch )
    {
        /*
         * Certain attacks are forbidden.
         * Most other attacks are returned.
         */
        if ( is_safe( ch, victim ) )
            return FALSE;
        if ( victim != ch->fighting )
            check_killer( ch, victim );

        if ( victim->position > POS_STUNNED )
        {
            if ( victim->fighting == NULL )
                set_fighting( victim, ch, FALSE );
            victim->position = POS_FIGHTING;
        }

        if ( victim->position > POS_STUNNED )
        {
            if ( ch->fighting == NULL )
            {
                set_fighting( ch, victim, TRUE );
            }


            /*
             * If victim is charmed, ch might attack victim's master.
             */
            if ( IS_NPC( ch )
                    && IS_NPC( victim )
                    && IS_AFFECTED( victim, AFF_CHARM )
                    && victim->master != NULL && victim->master->in_room == ch->in_room && number_bits( 3 ) == 0 )
            {
                stop_fighting( ch );
                one_hit( ch, victim->master, TYPE_UNDEFINED );
            }
        }

        /*
         * More charm stuff.
         */
        if ( victim->master == ch )
            stop_follower( victim );

        /*
         * Inviso attacks ... not.
         */
        if ( IS_AFFECTED( ch, AFF_INVISIBLE ) )
        {
            affect_strip( ch, gsn_invis );
            affect_strip( ch, gsn_mass_invis );
            REMOVE_BIT( ch->affected_by, AFF_INVISIBLE );
            act( "$n shimmers into existence.", ch, NULL, NULL, TO_ROOM );
        }

        /*
         * Damage modifiers.
         */

        if ( dam < 0 )
            dam = 0;

        /*
         * Stop up any residual loopholes.
         */
        if ( dam > sysdata.damcap )
        {
            char buf[MAX_STRING_LENGTH];
            snprintf( buf, MSL, "Spell: %d damage by %s, spell %s", dam, ( obj == NULL ) ? ch->get_name() : obj->short_descr, skill_table[sn].name );
            if ( ch->level < 82 )
                monitor_chan( buf, MONITOR_MAGIC );
            log_f( "%s", buf );
            dam = sysdata.damcap;
        }


        if ( ( show_msg ) && ( dam >= 0 ) )
            sp_dam_message( obj, ch, victim, dam, type, sn );

    }

    /*
     * Hurt the victim.
     * Inform the victim of his new state.
     */
    victim->hit -= dam;

    if ( !IS_NPC(ch) )
    {
        if ( dam > ch->pcdata->records->mdam_amt )
        {
            send_to_char("@@yYou've broken your magical damage record!@@N\r\n", ch);
            ch->pcdata->records->mdam_amt = dam;
            ch->pcdata->records->mdam_gsn = sn;
        }
    }

    if ( !IS_NPC( victim ) )
        check_adrenaline( victim, dam );

    if ( !IS_NPC( victim ) && IS_WOLF( victim ) && ( dam > 350 ) )
        do_rage( victim, "FORCE" );

    update_pos( victim );

    if ( ( IS_NPC( victim ) || !IS_VAMP( victim ) ) && !( deathmatch ) )
    {
        switch ( victim->position )
        {
            case POS_MORTAL:
                act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM );
                send_to_char( "You are mortally wounded, and will die soon, if not aided.\r\n", victim );
                break;

            case POS_INCAP:
                act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM );
                send_to_char( "You are incapacitated and will slowly die, if not aided.\r\n", victim );
                break;

            case POS_STUNNED:
                act( "$n is too stunned to do anything!", victim, NULL, NULL, TO_ROOM );
                send_to_char( "You are too stunned to do anything!\r\n", victim );
                break;

            case POS_DEAD:
                act( "$n is DEAD!!", victim, 0, 0, TO_ROOM );
                send_to_char( "You have been KILLED!!\r\n\r\n", victim );
                break;

            default:
                if ( dam > victim->max_hit / 4 )
                    send_to_char( "That really did HURT!\r\n", victim );
                if ( victim->hit < victim->max_hit / 4 )
                    send_to_char( "You sure are BLEEDING!\r\n", victim );
                break;
        }
    }  /* end of if statement */
    /*
     * Sleep spells and extremely wounded folks.
     */
    if ( !IS_AWAKE( victim ) )
        stop_fighting( victim );

    /*
     * Payoff for killing things.
     */



    if ( victim->position == POS_DEAD && ( IS_NPC( victim ) || !IS_VAMP( victim ) || ( deathmatch ) ) )
    {
        group_gain( ch, victim );

        /*
         * Sort out kill counts.....
         */
        if ( !IS_NPC( ch ) )
        {
            if ( !IS_NPC( victim ) )
                ch->pcdata->records->pk++;
            else
                ch->pcdata->records->mk++;
        }

        if ( !IS_NPC( victim ) )
        {
            if ( !IS_NPC( ch ) )
                victim->pcdata->records->pd++;
            else
                victim->pcdata->records->md++;
        }

        if ( !IS_NPC( victim ) || victim->act.test(ACT_INTELLIGENT) )
        {


            snprintf( log_buf, (2 * MIL), "%s killed by %s at %d", victim->get_name(), ch->get_name(), victim->in_room->vnum );
            log_string( log_buf );

            notify( log_buf, 82 );

            /*
             * As level gain is no longer automatic, a dead char loses
             * * 1/2 their gained exp.  -S-
             * * Fixed my bug here too, hehe!
             */

            if ( victim->exp > 0 )
            {
                int lose = (victim->exp / 2);
                lose *= -1;
                victim->gain_exp(lose);
            }

        }

        if ( IS_NPC( ch ) )
            raw_kill( victim, "" );
        else
        {
            char name_buf[MAX_STRING_LENGTH];
            snprintf( name_buf, MSL, "%s", ch->name.c_str() );
            raw_kill( victim, name_buf );
        }

        if ( deathmatch && !IS_NPC( victim ) )
            do_quit( victim, "" );

        if ( IS_NPC( ch ) && IS_NPC( victim ) && ch->act.test(ACT_INTELLIGENT) )
        {
            do_get( ch, "all corpse" );
            do_sacrifice( ch, "corpse" );
        }

        if ( !IS_NPC( ch ) && IS_NPC( victim ) )
        {
            if ( ch->act.test(ACT_AUTOLOOT) )
                do_get( ch, "all corpse" );
            else
                do_look( ch, "in corpse" );

            if ( ch->act.test(ACT_AUTOSAC) )
                do_sacrifice( ch, "corpse" );
        }

        return FALSE;
    }

    if ( victim == ch )
        return TRUE;

    /*
     * Take care of link dead people.
     */
    if ( !IS_NPC( victim ) && victim->desc == NULL )
    {
        if ( number_range( 0, victim->wait ) == 0 )
        {
            do_recall( victim, "" );
            return TRUE;
        }
    }

    /*
     * Wimp out?
     */
    if ( IS_NPC( victim ) && dam > 0 )
    {
        if ( ( victim->act.test(ACT_WIMPY) && number_bits( 1 ) == 0
                && victim->hit < victim->max_hit / 2 )
                || ( IS_AFFECTED( victim, AFF_CHARM ) && victim->master != NULL && victim->master->in_room != victim->in_room ) )
            do_flee( victim, "" );
    }

    if ( !IS_NPC( victim ) && victim->hit > 0 && victim->hit <= victim->wimpy && victim->wait == 0 )
        do_flee( victim, "" );

    return TRUE;

}
Example #30
0
void do_stalk( CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *victim;
    char arg[MAX_INPUT_LENGTH];

    if ( IS_NPC(ch) )
        return;

    argument = one_argument (argument, arg);

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

    if ( arg[0] == '\0' )
    {
        send_to_char( "Stalk whom?\n\r", ch );
        return;
    }

    if ( ( victim = get_char_world( ch, arg ) ) == NULL )
    {
        send_to_char( "You cannot find them.\n\r", ch );
        return;
    }

    if( ch->move < 500)
    {
        stc( "You don't have enough movement points to stalk them.\n\r",ch);
        return;
    }

    if( IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "You can't find it's room.\n\r",ch);
        return;
    }

    if( IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "Your body can't go there.\n\r",ch);
        return;
    }

    if (ch == victim)
    {
        send_to_char("But you're already at yourself!\n\r",ch);
        return;
    }

    if ( room_is_private(victim->in_room ) )
    {
        send_to_char( "That room is private right now.\n\r", ch );
        return;
    }
    if ( !IS_NPC(victim) && !IS_IMMUNE(victim, IMM_SUMMON) )
    {
        send_to_char( "They are hiding from you.\n\r", ch );
        return;
    }
    if (victim->in_room == ch->in_room)
    {
        send_to_char("But you're already there!\n\r",ch);
        return;
    }

    act("You pick up the trail of $N, and quickly find them.", ch, NULL, victim, TO_CHAR);
    act("$n slides into the shadows, stalking someone.", ch, NULL, victim, TO_ROOM);
    char_from_room(ch);
    char_to_room(ch,victim->in_room);
    ch->move -= 500;
    act("$n walks out of nowhere behind $N.", ch, NULL, victim, TO_NOTVICT);
    act("$n walks out of nowhere from behind.", ch, NULL, victim, TO_VICT);
    do_look(ch,"scry");
    return;
}