示例#1
0
文件: handler.c 项目: Calebros/aol
/* dismount_char() / fr: Daniel Koepke ([email protected])
 *   If a character is mounted on something, we dismount them.  If
 *   someone is mounting our character, then we dismount that someone.
 *   This is used for cleaning up after a mount is cancelled by
 *   something (either intentionally or by death, etc.)
 */
void dismount_char(struct char_data *ch) 
{
  if (RIDING(ch)) {
    RIDDEN_BY(RIDING(ch)) = NULL;
    RIDING(ch) = NULL;
    GET_POS(ch) = POS_STANDING;

  }
  
  if (RIDDEN_BY(ch)) {
    RIDING(RIDDEN_BY(ch)) = NULL;
    RIDDEN_BY(ch) = NULL;
    GET_POS(ch) = POS_STANDING;
  }
}
示例#2
0
文件: handler.c 项目: Calebros/aol
/* mount_char() / fr: Daniel Koepke ([email protected])
 *   Sets _ch_ to mounting _mount_.  This does not make any checks
 *   what-so-ever to see if the _mount_ is mountable, etc.  That is
 *   left up to the calling function.  This does not present any
 *   messages, either.
 */
void mount_char(struct char_data *ch, struct char_data *mount) 
{
  RIDING(ch) = mount;
  RIDDEN_BY(mount) = ch;
}
示例#3
0
文件: handler.c 项目: Calebros/aol
/* Extract a ch completely from the world, and leave his stuff behind */
void extract_char(struct char_data * ch)
{
  struct char_data *k, *temp;
  struct descriptor_data *t_desc;
  struct obj_data *obj;
  int i, freed = 0;
  //int j;

  extern struct char_data *combat_list;

  ACMD(do_return);

  void die_follower(struct char_data * ch);


  if (!IS_NPC(ch) && !ch->desc) {
    for (t_desc = descriptor_list; t_desc; t_desc = t_desc->next) {
      if (t_desc->original == ch) {
	do_return(t_desc->character, "", 0, 0);
      }
    }
  }

  if (ch->in_room == NOWHERE) {
    log("SYSERR: NOWHERE extracting char. (handler.c, extract_char)");
    exit(1);
  }

  if (ch->followers || ch->master) {
    die_follower(ch);
  }

  if (RIDING(ch) || RIDDEN_BY(ch))
   dismount_char(ch);

   REMOVE_BIT(PLR_FLAGS(ch), PLR_FISHING);

   REMOVE_BIT(PLR_FLAGS(ch), PLR_FISH_ON);

   REMOVE_BIT(PLR_FLAGS(ch), PLR_DIGGING);

   REMOVE_BIT(PLR_FLAGS(ch), PLR_DIG_ON);

   REMOVE_BIT(PLR_FLAGS(ch), PLR_FIRE_ON);

   REMOVE_BIT(PRF_FLAGS(ch), PRF_NOTSELF);

   //REMOVE_BIT(PRF_FLAGS(ch), PRF_DISGUISE);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_MAGE);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_MONK);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_KNIGHT);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_CLERIC);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_BARD);
   //REMOVE_BIT(PLR_FLAGS(ch), PLR_BEGGAR);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_COURIER);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_BEAR);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_BIRD);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_WOLF);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_RABBIT);
   REMOVE_BIT(PLR_FLAGS(ch), PLR_CAT);

  /* Forget snooping, if applicable */
  if (ch->desc) {
    if (ch->desc->snooping) {
      ch->desc->snooping->snoop_by = NULL;
      ch->desc->snooping = NULL;
    }

    if (ch->desc->snoop_by) {
      SEND_TO_Q("Your victim is no longer among us.\r\n",
		ch->desc->snoop_by);
      ch->desc->snoop_by->snooping = NULL;
      ch->desc->snoop_by = NULL;
    }
  }

  /* transfer objects to room, if any */
  while (ch->carrying) {
    obj = ch->carrying;
    obj_from_char(obj);
    obj_to_room(obj, ch->in_room);
  }

  /* transfer equipment to room, if any */
  for (i = 0; i < NUM_WEARS; i++) {
    if (GET_EQ(ch, i)) {
      obj_to_room(unequip_char(ch, i), ch->in_room);
    }
  }

  if (FIGHTING(ch)) {
    stop_fighting(ch);
  }

  for (k = combat_list; k; k = temp) {
    temp = k->next_fighting;
    if (FIGHTING(k) == ch) {
      stop_fighting(k);
    }
  }

  char_from_room(ch);

  /* pull the char from the list */
  REMOVE_FROM_LIST(ch, character_list, next);

  if (ch->desc && ch->desc->original) {
    do_return(ch, NULL, 0, 0);
  }

  if (!IS_NPC(ch)) {
    save_char(ch, NOWHERE);
    Crash_delete_crashfile(ch);
  } else {
    if (GET_MOB_RNUM(ch) > -1) {     /* if mobile */
      mob_index[GET_MOB_RNUM(ch)].number--;
    }
    clearMemory(ch);		/* Only NPC's can have memory */

    if (SCRIPT(ch)) {
      extract_script(SCRIPT(ch));
    }

    free_char(ch);
    freed = 1;
  }

  if (!freed && ch->desc != NULL) {
    STATE(ch->desc) = CON_MENU;
    SEND_TO_Q(MENU, ch->desc);
  } else {  /* if a player gets purged from within the game */
    if (ch->master || ch->followers)
      die_follower(ch);
    if (!freed) {
      free_char(ch);
    }
  }
}
示例#4
0
void 
dam_message (CHAR_DATA * ch, CHAR_DATA * victim, int dam, int dt, int p)
{
  char buf[256], buf1[256], buf2[256], buf3[256];
  char *tt;
  int ty;
  char hit_you_far[2000];
  char other_hit_far[2000];
  char subbuf[256], *bufptr;
  char attack[256];
  char bare[256];
  char punct;
  SINGLE_OBJECT *obj = NULL;
  you_hit[0] = '\0';
  bare[0] = '\0';
  attack[0] = '\0';
  other_hit[0] = '\0';
  hit_you[0] = '\0';
  hit_you_far[0] = '\0';
  other_hit_far[0] = '\0';
  nocolor = FALSE;
  if (FIGHTING (ch) != NULL && FIGHTING (ch)->position == POSITION_GROUNDFIGHTING && dam < 3)
    dam += 3;

  if(IS_MOB(ch) && ch->pIndexData->mobtype == MOB_DUMMY) return;
  general_hit (dam, ch, victim);

  punct = (dam <= 20) ? '.' : '!';
  if (IS_MOB (ch))
    {
      if (!ch->pIndexData->attackname || !str_cmp ("(null)", ch->pIndexData->attackname) || !str_cmp ("N/A", ch->pIndexData->attackname) || ch->pIndexData->attackname == NULL || ch->pIndexData->attackname[0] == ' ')
	{
	  if (!str_cmp (mob_type_attack (ch->pIndexData->mobtype), "punch") && FIGHTING (ch) != NULL &&
	      FIGHTING (ch)->position == POSITION_GROUNDFIGHTING)
	    strcpy (bare, "stomp");
	  else
	    strcpy (bare, mob_type_attack (ch->pIndexData->mobtype));
	}
      else
	{
	  if (!str_cmp (ch->pIndexData->attackname, "punch") && FIGHTING (ch) != NULL && FIGHTING (ch)->position == POSITION_GROUNDFIGHTING)
	    strcpy (bare, "stomp");
	  else
	    strcpy (bare, ch->pIndexData->attackname);
	}
    }
  else
    {
      if (FIGHTING (ch) != NULL && FIGHTING (ch)->position == POSITION_GROUNDFIGHTING)
	strcpy (bare, "stomp");
      else
	strcpy (bare, "punch");
      if (is_member(ch, GUILD_MONK))
      {
        int randhit = number_range(1,12);
        if (randhit == 1)
          strcpy (bare, "punch");
        else if (randhit == 2)
          strcpy (bare, "kick");
        else if (randhit == 3)
          strcpy (bare, "leg sweep");
        else if (randhit == 4)
          strcpy (bare, "elbow");
        else if (randhit == 5)
          strcpy (bare, "flipkick");
        else if (randhit == 6)
          strcpy (bare, "headbutt");
        else if (randhit == 7)
          strcpy (bare, "shinkick");
        else if (randhit == 8)
          strcpy (bare, "palm strike");
        else if (randhit == 9)
          strcpy (bare, "knee");
        else if (randhit == 10)
          strcpy (bare, "backfist");
        else if (randhit == 11)
          strcpy (bare, "uppercut");
        else if (randhit == 12)
          strcpy (bare, "quick jab");
      }
    }
  if (dt == gsn_circle)
    {
      if ((obj = get_item_held (ch, ITEM_WEAPON)) == NULL)
	return;
      if (dam > 0)
	{
	  sprintf (buf1, "\x1B[1;37m$n\x1B[0;37m sneaks up on $N... $n thrusts $p\x1B[0;37m into $S back!");
	  if (dam < 20)
	    sprintf (buf2, "You circle and thrust $p\x1B[0m into \x1B[1m$N\x1B[0m's back.");
	  if ((dam > 19) && (dam < 50))
	    sprintf (buf2, "You circle and thrust $p\x1B[0m into \x1B[1m$N\x1B[0m's back, causing cries of agony and pain.");
	  if ((dam > 49) && (dam < 100))
	    sprintf (buf2, "You circle your opponent.... $p\x1B[0m finds its mark in \x1B[1m$N\x1B[0m's back, causing $S body to spasm in pain.");
	  if ((dam > 99) && (dam < 200))
	    sprintf (buf2, "You circle your opponent.... $p\x1B[0m sinks deeply into \x1B[1m$N\x1B[0m's back, and blood runs over your hands.");
	  if ((dam > 199) && (dam < 275))
	    sprintf (buf2, "You circle your opponent.... $p\x1B[0m has struck a pressure point in \x1B[1m$N\x1B[0m's back!\n\rThat's gotta hurt!");
	  if ((dam > 274) && (dam < 350))
	    sprintf (buf2, "You circle around and twist $p\x1B[0m around several times in \x1B[1m$N\x1B[0m's back! That's gotta hurt!");
	  if (dam > 349)
	    sprintf(buf2, "Your $p\x1B[0m penetrates the base of \x1B[1m$N\x1B[0m's neck spraying spinal fluid onto your armor!");
	  sprintf (buf3, "\x1B[1m$n\x1B[0m is behind you before you know it, and slips $p\x1B[0m into your back.\n\r");
	}
    }
  else if (dt == gsn_backstab)
    {
      if ((obj = get_item_held (ch, ITEM_WEAPON)) == NULL)
	return;
      if (dam > 0)
	{ 
	  if (dam <100)  
	     sprintf (buf1, "\x1B[1;37m$n\x1B[0;37m thrusts $p\x1B[0;37m into \x1B[1;37m$N\x1B[0m's back.\n\r");
	  if ((dam > 99) && (dam < 200))
     	     sprintf (buf1, "Blood runs over \x1B[1;37m$n\x1B[0;37m hands as $p\x1B[0;37m\n\ris thrust into \x1B[1;37m$N\x1B[0m's back.\n\r");
	  if ((dam > 199) && (dam < 275))
     	     sprintf (buf1, "\x1B[1;37m$n\x1B[0;37m hits a pressure point as $p\x1B[0;37m\n\ris thrust into \x1B[1;37m$N\x1B[0m's back.\n\r");
	  if ((dam > 274) && (dam < 350))
     	     sprintf (buf1, "\x1B[1;37m$n\x1B[0;37m twists $p\x1B[0;37m around several times\n\rin \x1B[1;37m$N\x1B[0m's back.\n\r");
	  if ((dam > 349) && (dam < 425))
     	     sprintf (buf1, "Spinal fluid sprays as \x1B[1;37m$n\x1B[0;37m thrusts $p\x1B[0;37m\n\rinto \x1B[1;37m$N\x1B[0m's back. That had to HURT!\n\r");
	  if (dam > 424)
     	     sprintf (buf1, "\x1B[1;37m$n\x1B[0;37m uses $p\x1B[0;37m to punch a hole \n\rclean through \x1B[1;37m$N\x1B[0m's neck! Guts spray everywhere!\n\rThat REALLY had to HURT!");
	     
	  if (dam < 20)
	    sprintf (buf2, "You thrust $p\x1B[0m into \x1B[1m$N\x1B[0m's back.");
	  if ((dam > 19) && (dam < 50))
	    sprintf (buf2, "You thrust $p\x1B[0m into \x1B[1m$N\x1B[0m's back, causing cries of agony and pain.");
	  if ((dam > 49) && (dam < 100))
	    sprintf (buf2, "$p\x1B[0m finds its mark in \x1B[1m$N\x1B[0m's back, causing $s body to spasm.");
	  if ((dam > 99) && (dam < 200))
	    sprintf (buf2, "$p\x1B[0m sinks deeply into \x1B[1m$N\x1B[0m's back, and blood runs over your hands.");
	  if ((dam > 199) && (dam < 275))
	    sprintf (buf2, "$p\x1B[0m has struck a pressure point in \x1B[1m$N\x1B[0m's back! \n\rThat's gotta hurt!");
	  if ((dam > 274) && (dam < 350))
	    sprintf (buf2, "You twist $p\x1B[0m around several times in \x1B[1m$N\x1B[0m's back!\n\rThat's gotta hurt!");
	  if ((dam > 349) && (dam < 425))
	    sprintf(buf2, "Your $p\x1B[0m penetrates the base of \x1B[1m$N\x1B[0m's neck spraying spinal fluid onto your armor!\n\rThat REALLY had to HURT!");
	  if (dam > 424)
	    sprintf(buf2, "Your $p\x1B[0m punches a hole clean through \x1B[1m$N\x1B[0m's neck spraying guts all over you!\n\rThat REALLY had to HURT SEVERELY!");

	/* Added Damage Display for backstabee j. ellis (cyric) 2-6-01 */  

	if (dam <100)
	sprintf (buf3, "Before you know what's going on, \x1B[1m$n\x1B[0m\n\ris behind you, and thrusts $p\x1B[0m into your back.\n\r");
	if ((dam > 99) && (dam < 200))
 	   sprintf (buf3, "Blood runs all over \x1B[1m$n\x1B[0m's hands as $p\x1B[0m\n\ris thrust into your back.\n\r");
	if ((dam >199) && (dam < 275))
	   sprintf (buf3, "\x1B[1m$n\x1B[0m strikes a pressure point as $p\x1B[0m\n\ris thrust into your back.\n\r");
	if ((dam >274) && (dam < 350))
	   sprintf (buf3, "\x1B[1m$n\x1B[0m twists $p\x1B[0m around several times\n\rin your back! That HURT!");
	if ((dam >349) && (dam < 425))
	   sprintf (buf3, "\x1B[1m$n\x1B[0m penetrates the base of your neck with $p\x1B[0m\n\rYour spinal fluid sprays everywhere!\n\rThat REALLY HURT!");
	if (dam >424)
	   sprintf (buf3, "\x1B[1m$n\x1B[0m punches a hole clean through your neck with \n\r$p\x1B[0m, That REALLY HURT!");


/*	sprintf (buf3, "Before you know what's going on, \x1B[1m$n\x1B[0m\n\ris behind you, and thrusts $p\x1B[0m\n\r into your back.\n\r");*/
	}
      else
	{
	  sprintf (buf1, "\x1B[1m$n\x1B[0m fails to lunge $p\x1B[0m in \x1B[1m$N\x1B[0m's back.");
	  sprintf (buf2, "You fail to place $p\x1B[0m into \x1B[1m$N\x1B[0m's back.");
	  sprintf (buf3, "\x1B[1m$n\x1B[0m's \x1B[1;30mbackstab\x1B[0m just barely misses you.");
	}
    }

  else if (dt == gsn_fireshield)
  {
    if(dam > 0)
    {
      if( dam > 0 && dam <= 20 )
      {
        sprintf (buf1, "\x1B[1m$n\x1B[0m's shield of fire scorches \x1B[1m$N\x1B[0m!");
        sprintf (buf2, "Your shield of fire \x1B[1mburns\x1B[0m $N!");
        sprintf (buf3, "\x1B[1m$n\x1B[0m's \x1B[1;30mfire shield\x1B[0m chars you!");
      }
      else if( dam > 20 && dam <= 40)
      {
        sprintf (buf1, "\x1B[1m$n\x1B[0m's shield of fire engulfs \x1B[1m$N\x1B[0m!");
        sprintf (buf2, "Your shield of fire \x1B[1minflames\x1B[0m $N!");
        sprintf (buf3, "Ouch!! \x1B[1m$n\x1B[0m's \x1B[1;30mfire shield\x1B[0m engulfs you!");
      }
      else if( dam > 40 && dam < 100)
      {
        sprintf (buf1, "\x1B[1m$n\x1B[0m's shield of fire roasts \x1B[1m$N\x1B[0m!");
        sprintf (buf2, "Your shield of fire \x1B[1mROASTS\x1B[0m $N!");
        sprintf (buf3, "Oof!! \x1B[1m$n\x1B[0m's \x1B[1;30mfire shield\x1B[0m ROASTS you!");
      }
      else if( dam >= 100)
      {
        sprintf (buf1, "\x1B[1m$n\x1B[0m's shield of fire OBLITERATES \x1B[1m$N\x1B[0m!!");
        sprintf (buf2, "Your shield of fire \x1B[1mOBLITERATES\x1B[0m $N!");
        sprintf (buf3, "AARRGGHH!!! \x1B[1m$n\x1B[0m's \x1B[1;30mfire shield\x1B[0m OBLITERATES you!");
      }
      else
      {
        sprintf (buf1, "\x1B[1m$n\x1B[0m's shield of fire OBLITERATES \x1B[1m$N\x1B[0m!! [%d]",dam);
        sprintf (buf2, "Your shield of fire \x1B[1mOBLITERATES\x1B[0m $N! [%d]",dam);
        sprintf (buf3, "AARRGGHH!!! \x1B[1m$n\x1B[0m's \x1B[1;30mfire shield\x1B[0m OBLITERATES you! [%d]",dam);
      }
    }
    else
    {
      sprintf (buf1, "\x1B[1m$n\x1B[0m's fire shield fails to affect $p\x1B[0m in \x1B[1m$N\x1B[0m.");
      sprintf (buf2, "\x1B[1m$N\x1B[0m's attack goes right through your fire shield!.");
      sprintf (buf3, "\x1B[1m$n\x1B[0m's fire shield fails to protect him from your attack.");
    }
  }
  else if (dt == TYPE_HIT || dt < 0)
    {
      if (nocolor)
	{
	  sprintf (buf, "%s", other_hit);
	  sprintf (buf1, buf, bare);
	  sprintf (buf, "%s", you_hit);
	  sprintf (buf2, buf, bare);
	  sprintf (buf, "%s", hit_you);
	  sprintf (buf3, buf, bare);
	  if (RIDING (ch) != NULL)
	    {
	      send_to_char ("ACK! You are having problems punching while riding!\n\r", ch);
	    }
	}
      else
	{
	  sprintf (buf, "\x1B[1;37m%s\x1B[0m", other_hit);
	  sprintf (buf1, buf, bare);
	  sprintf (buf, "\x1B[1;35m%s\x1B[0m", you_hit);
	  sprintf (buf2, buf, bare);
	  sprintf (buf, "\x1B[1;36m%s\x1B[0m", hit_you);
	  sprintf (buf3, buf, bare);
	}
    }
  else
    {
      if (dt >= 0 && dt < SKILL_COUNT)
	{
	  SPELL_DATA *spell;
	  if ((spell = skill_lookup (NULL, dt)) == NULL)
	    return;
	  strcpy (attack, spell->noun_damage);
	}
      else if ((dt - TYPE_HIT) < MAX_ATTACK)
	{
	  strcpy (attack, attack_table[dt - TYPE_HIT].name);
	}
      else
	{
	  bug ("Dam_message: bad dt %d.", dt);
	  dt = TYPE_HIT;
	  strcpy (attack, attack_table[0].name);
	}
      if (nocolor)
	{
	  sprintf (buf, "%s", other_hit);
	  sprintf (buf1, buf, attack);
	  sprintf (buf, "%s", you_hit);
	  sprintf (buf2, buf, attack);
	  sprintf (buf, "%s", hit_you);
	  sprintf (buf3, buf, attack);
	}
      else
	{
	  sprintf (buf, "\x1B[1;37m%s\x1B[0m", other_hit);
	  sprintf (buf1, buf, attack);
	  sprintf (buf, "\x1B[1;35m%s\x1B[0m", you_hit);
	  sprintf (buf2, buf, attack);
	  sprintf (buf, "\x1B[1;36m%s\x1B[0m", hit_you);
	  sprintf (buf3, buf, attack);
	}
    }
  if ((bufptr = strstr (buf1, "hs ")))
    {
      sprintf (subbuf, bufptr + 2);
      *(bufptr + 1) = 'e';
      *(bufptr + 2) = 's';
      *(bufptr + 3) = '\0';
      strcat (buf1, subbuf);
    }
  if ((bufptr = strstr (buf2, "hs ")))
    {
      sprintf (subbuf, bufptr + 2);
      *(bufptr + 1) = 'e';
      *(bufptr + 2) = 's';
      *(bufptr + 3) = '\0';
      strcat (buf2, subbuf);
    }
  if ((bufptr = strstr (buf3, "hs ")))
    {
      sprintf (subbuf, bufptr + 2);
      *(bufptr + 1) = 'e';
      *(bufptr + 2) = 's';
      *(bufptr + 3) = '\0';
      strcat (buf3, subbuf);
    }
  if (dam <= 1)
    {
      act(buf1, ch, obj, victim, TO_NOTVICT_SPAM + 1000);
      act(buf2, ch, obj, victim, TO_CHAR_SPAM + 1000);
      act(buf3, ch, obj, victim, TO_VICT_SPAM + 1000);
    }
  else
    {
      act(buf1, ch, obj, victim, TO_NOTVICT + 1000);
      act(buf2, ch, obj, victim, TO_CHAR + 1000);
      act(buf3, ch, obj, victim, TO_VICT + 1000);
      if (victim->in_room != ch->in_room)
	{
	  ty = 0;
	  for (tt = buf1; *tt != '\0'; tt++)
	    {
	      if (*tt == '$')
		{
		  ty++;
		  tt++;
		  switch(*tt)
		    {
		    case 'N':
		      buf1[ty] = 'n';
		      break;
		    case 'n':
		      buf1[ty] = 'N';
		      break;
		    case 'S':
		      buf1[ty] = 's';
		      break;
		    case 's':
		      buf1[ty] = 'S';
		      break;
		    }
		}
	      ty++;
	    }
	  ty = 0;
	  for (tt = buf3; *tt != '\0'; tt++)
	    {
	      if (*tt == '$')
		{
		  ty++;
		  tt++;
		  switch(*tt)
		    {
		    case 'N':
		      buf3[ty] = 'n';
		      break;
		    case 'n':
		      buf3[ty] = 'N';
		      break;
		    case 'S':
		      buf3[ty] = 's';
		      break;
		    case 's':
		      buf3[ty] = 'S';
		      break;
		    }
		}
	      ty++;
	    }
	   act(buf1, victim, obj, ch, TO_NOTVICT + 1000);
	   act(buf3, victim, obj, ch, TO_CHAR + 1000);
	}
    }
  if (dt == gsn_backstab && dam > 0)
    check_social (victim, "wince", "");
  return;
}