예제 #1
0
파일: castle.c 프로젝트: sean/dominionmud
/* Used by BANZAII-ing characters and King Welmar... */
struct char_data *get_victim(struct char_data * chAtChar)
{

  struct char_data *ch;
  int iNum_bad_guys = 0, iVictim;

  for (ch = world[chAtChar->in_room].people; ch; ch = ch->next_in_room)
    if (FIGHTING(ch) &&
	member_of_staff(FIGHTING(ch)))
      iNum_bad_guys++;

  if (!iNum_bad_guys)
    return NULL;

  iVictim = number(0, iNum_bad_guys);   /* How nice, we give them a chance */
  if (!iVictim)
    return NULL;

  iNum_bad_guys = 0;

  for (ch = world[chAtChar->in_room].people; ch; ch = ch->next_in_room)
    if (FIGHTING(ch) &&
	member_of_staff(FIGHTING(ch)) &&
	++iNum_bad_guys == iVictim)
      return ch;

  return NULL;
}
예제 #2
0
파일: castle.c 프로젝트: ryantm/deimos-mud
/* Function: get_victim. Returns a pointer to a randomly chosen character in 
 * the same room, fighting someone in the castle staff. Used by BANZAII-ing 
 * characters and King Welmar... */
struct char_data *get_victim(struct char_data *chAtChar)
{
  struct char_data *ch;
  int iNum_bad_guys = 0, iVictim;

  for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room)
    if (FIGHTING(ch) && member_of_staff(FIGHTING(ch)))
      iNum_bad_guys++;

  if (!iNum_bad_guys)
    return (NULL);

  iVictim = rand_number(0, iNum_bad_guys);	/* How nice, we give them a chance */
  if (!iVictim)
    return (NULL);

  iNum_bad_guys = 0;

  for (ch = world[IN_ROOM(chAtChar)].people; ch; ch = ch->next_in_room) {
    if (FIGHTING(ch) == NULL)
      continue;

    if (!member_of_staff(FIGHTING(ch)))
      continue;

    if (++iNum_bad_guys != iVictim)
      continue;

    return (ch);
  }

  return (NULL);
}
예제 #3
0
파일: castle.c 프로젝트: sean/dominionmud
/* Used by Tim/Tom at Kings bedroom and Dick/David at treasury */
int block_way(struct char_data * ch, int cmd, char *arg, int iIn_room,
		  int iProhibited_direction)
{

  if (cmd != ++iProhibited_direction || (ch->player.short_descr &&
		       !strncmp(ch->player.short_descr, "King Welmar", 11)))
    return FALSE;

  if ((ch->in_room == real_room(iIn_room)) && (cmd == iProhibited_direction)) {
    if (!member_of_staff(ch))
      act("The guard roars at $n and pushes $m back.",
	  FALSE, ch, 0, 0, TO_ROOM);
    send_to_char("The guard roars: 'Entrance is Prohibited!', and pushes you back.\r\n", ch);
    return (TRUE);
  }
  return FALSE;
}