Exemple #1
0
void do_group( CHAR_DATA * ch, char * argument ) {
  CHAR_DATA * victim;
  char        buf[ MAX_STRING_LENGTH ];
  char        arg[ MAX_INPUT_LENGTH  ];

  one_argument( argument, arg );

  if ( arg[ 0 ] == '\0' ) {
    CHAR_DATA * gch;
    CHAR_DATA * leader;

    leader = ( ch->leader ) ? ch->leader : ch;
    sprintf( buf, "%s's group:\n\r", visible_name( leader, ch, TRUE ) );
    send_to_char( AT_DGREEN, buf, ch );

    for ( gch = char_list; gch; gch = gch->next ) {
      if ( gch->deleted ) {
        continue;
      }

      if ( is_same_group( gch, ch ) ) {
        sprintf( buf,
                 "[&R%2d %s&G] %-12s &Y%4d/%4d &Ghp &C%4d/%4d &Gmana &P%4d/%4d &Gmv &R%5d &Gxp\n\r",
                 gch->level,
                 IS_NPC( gch ) ? "Mob"
                 : class_table[ prime_class( gch ) ].who_name,
                 capitalize( visible_name( gch, ch, TRUE ) ),
                 gch->hit,   MAX_HIT( gch ),
                 gch->mana,  MAX_MANA( gch ),
                 gch->move,  MAX_MOVE( gch ),
                 gch->exp );

        if ( gch->gspell && gch->gspell->timer > 0 ) {
          send_to_char( AT_YELLOW, buf, ch );
        } else {
          send_to_char( AT_GREEN, buf, ch );
        }
      }
    }

    return;
  }

  if ( !( victim = get_char_room( ch, arg ) ) ) {
    send_to_char( AT_DGREEN, "They aren't here.\n\r", ch );
    return;
  }

  if ( ch->master || ( ch->leader && ch->leader != ch ) ) {
    send_to_char( AT_DGREEN, "But you are following someone else!\n\r", ch );
    return;
  }

  if ( victim->master != ch && ch != victim ) {
    act( AT_DGREEN, "$N isn't following you.", ch, NULL, victim, TO_CHAR );
    return;
  }

  if ( is_same_group( victim, ch ) && ch != victim ) {
    victim->leader = NULL;
    act( AT_GREEN, "You remove $N from your group.", ch, NULL, victim, TO_CHAR );
    act( AT_GREEN, "$n removes you from $s group.",  ch, NULL, victim, TO_VICT );
    act( AT_GREEN, "$n removes $N from $s group.",   ch, NULL, victim, TO_NOTVICT );
    return;
  }

  if (   ch->level - victim->level < -8
         || ch->level - victim->level >  8 ) {
    act( AT_DGREEN, "$N cannot join your group.",  ch, NULL, victim, TO_CHAR );
    act( AT_DGREEN, "You cannot join $n's group.", ch, NULL, victim, TO_VICT );
    act( AT_DGREEN, "$N cannot join $n's group.",  ch, NULL, victim, TO_NOTVICT );
    return;
  }

  victim->leader = ch;
  act( AT_GREEN, "$N joins your group.", ch, NULL, victim, TO_CHAR );
  act( AT_GREEN, "You join $n's group.", ch, NULL, victim, TO_VICT );
  act( AT_GREEN, "$N joins $n's group.", ch, NULL, victim, TO_NOTVICT );
  return;
}
Exemple #2
0
/*
 * Implementation stuff
 */
void check_gcast( CHAR_DATA * ch ) {
  CHAR_DATA * gch;
  int         looper;
  int         casters[ MAX_CLASS ];
  int         sn;
  int         level = 0;
  int         total = 0;

  if ( !ch->gspell || ch->gspell->timer <= 0 ) {
    return;
  }

  sn = ch->gspell->sn;

  for ( looper = 0; looper < MAX_CLASS; looper++ ) {
    casters[ looper ] = 0;
  }

  for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) {
    if ( is_same_gspell( ch, gch ) ) {
      casters[ prime_class( gch ) ]++;
      total++;
      level = ( level / 4 ) + gch->gspell->level;
    }
  }

  for ( looper = 0; looper < MAX_CLASS; looper++ ) {
    if ( casters[ looper ] < gskill_table[ gslot_lookup( sn ) ].casters[ looper ] ) {
      send_to_char( AT_BLUE, "Ok.\n\r", ch );
      return;
    }
  }

  sn = slot_lookup( sn );
  ( *skill_table[ sn ].spell_fun )( sn, level, ch->leader ? ch->leader : ch,
                                    ch->gspell->victim );

  for ( gch = ch->in_room->people; gch; gch = gch->next_in_room ) {
    if ( is_same_gspell( ch, gch ) && ch != gch ) {
      end_gspell( gch );
    }
  }

  switch ( skill_table[ sn ].target ) {
    case TAR_GROUP_OFFENSIVE: {
      CHAR_DATA * victim = (CHAR_DATA *)ch->gspell->victim;

      rprog_cast_sn_trigger( ch->in_room, ch, sn, victim );

      if ( !victim->fighting ) {
        if ( IS_NPC( victim ) || ( ch->leader ? ch->leader : ch ) == victim ) {
          multi_hit( victim, ch->leader ? ch->leader : ch, TYPE_UNDEFINED );
        }
      }
    }
                              break;
    case TAR_GROUP_DEFENSIVE:
      rprog_cast_sn_trigger( ch->in_room, ch, sn, ch->gspell->victim );
      break;
    case TAR_GROUP_ALL:
      rprog_cast_sn_trigger( ch->in_room, ch, sn, ch );
      break;
    case TAR_GROUP_IGNORE:
      rprog_cast_sn_trigger( ch->in_room, ch, sn,
                             ( ch->gspell->victim ? ch->gspell->victim : ch ) );
      break;
    case TAR_GROUP_OBJ:

      if ( ch->gspell->victim ) {
        oprog_cast_sn_trigger( ch->gspell->victim, ch, sn, ch->gspell->victim );
        rprog_cast_sn_trigger( ch->in_room, ch, sn, ch->gspell->victim );
      }

      break;
  }

  end_gspell( ch );
  return;
}
Exemple #3
0
/*
 * Generic channel function.
 */
void talk_channel( CHAR_DATA * ch, char * argument, int channel, const char * verb ) {
  DESCRIPTOR_DATA * d;
  char              buf[ MAX_STRING_LENGTH ];
  int               position;

  if ( argument[ 0 ] == '\0' ) {
    sprintf( buf, "%s what?\n\r", verb );
    buf[ 0 ] = UPPER( buf[ 0 ] );
    return;
  }

  if ( !IS_NPC( ch ) && CHECK_BIT( ch->act, PLR_SILENCE ) ) {
    sprintf( buf, "You can't %s.\n\r", verb );
    send_to_char( AT_WHITE, buf, ch );
    return;
  }

  if ( CHECK_BIT( ch->in_room->room_flags, ROOM_SILENT ) && ( get_trust( ch ) < L_DIR ) ) {
    send_to_char( AT_WHITE, "You can't do that here.\n\r", ch );
    return;
  }

  REMOVE_BIT( ch->deaf, channel );

  switch ( channel ) {
    default:
      sprintf( buf, "You %s '%s'\n\r", verb, argument );
      send_to_char( AT_LBLUE, buf, ch );
      sprintf( buf, "$n %ss '$t'", verb );
      break;
    case CHANNEL_GOSSIP:
      sprintf( buf, "&cYou %s '&W%s&c'\n\r", verb, argument );
      send_to_char( C_DEFAULT, buf, ch );
      sprintf( buf, "&c$n %ss '&W$t&c'", verb );
      break;
    case CHANNEL_IMMTALK:
      sprintf( buf, "&C-&c=&B|&c<&C$n&c>&B|&c=&C-&B : $t" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_YELLOW, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_CLAN:
      sprintf( buf, "<%s&R> $n: '$t'", ( get_clan_index( ch->clan ) && ( get_clan_index( ch->clan ) )->name ? ( get_clan_index( ch->clan ) )->name : "Unclanned" ) );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_RED, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_CLASS:
      sprintf( buf, "{%s} $n: $t", class_table[ prime_class( ch ) ].who_long );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_LBLUE, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_HERO:
      sprintf( buf, "(HERO) $n: '$t'" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_GREEN, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
    case CHANNEL_OOC:
      sprintf( buf, "OOC - $n: '$t'" );
      position     = ch->position;
      ch->position = POS_STANDING;
      act( AT_PINK, buf, ch, argument, NULL, TO_CHAR );
      ch->position = position;
      break;
  }

  for ( d = descriptor_list; d; d = d->next ) {
    CHAR_DATA * och;
    CHAR_DATA * vch;

    och = d->original ? d->original : d->character;
    vch = d->character;

    if ( d->connected == CON_PLAYING && vch != ch && !CHECK_BIT( och->deaf, channel ) && !CHECK_BIT( och->in_room->room_flags, ROOM_SILENT ) ) {
      if ( IS_QUESTOR( och ) && channel != CHANNEL_YELL ) {
        continue;
      }

      if ( channel == CHANNEL_IMMTALK && !IS_IMMORTAL( och ) ) {
        continue;
      }

      if ( channel == CHANNEL_HERO && !IS_HERO( och ) ) {
        continue;
      }

      if ( ( channel == CHANNEL_CLASS ) && (( prime_class( vch ) != prime_class( ch ) ) || !IS_IMMORTAL( och )) ) {
        continue;
      }

      if ( ( channel == CHANNEL_CLAN ) && (( vch->clan != ch->clan ) || !IS_IMMORTAL( och )) ) {
        continue;
      }

      if ( channel == CHANNEL_YELL && vch->in_room->area != ch->in_room->area ) {
        continue;
      }

      position = vch->position;

      if ( channel != CHANNEL_YELL ) {
        vch->position = POS_STANDING;
      }

      switch ( channel ) {
        default:
          act( AT_LBLUE, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_GOSSIP:
          act( C_DEFAULT, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_IMMTALK:
          act( AT_YELLOW, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_HERO:
          act( AT_GREEN, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_CLAN:
          act( AT_RED, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_CLASS:
          act( AT_LBLUE, buf, ch, argument, vch, TO_VICT );
          break;
        case CHANNEL_OOC:
          act( AT_PINK, buf, ch, argument, vch, TO_VICT );
          break;
      }

      vch->position = position;
    }
  }

  return;
}
Exemple #4
0
void do_headbutt(CHAR_DATA * ch, char *argument)
{
	CHAR_DATA *victim;
	char arg[MAX_INPUT_LENGTH];
	int timer = 24;
	int mod;
	int dmg;
	if (ch->race != RACE_MINOTAUR) {
		send_to_char(AT_GREY,
			     "Wham!  Ouch!  You sure are no minotaur\n\r", ch);
		return;
	}
	if (ch->race_wait > 0)
		return;
	if (!ch->fighting) {
		send_to_char(C_DEFAULT, "You aren't fighting anyone.\n\r", ch);
		return;
	}

	one_argument(argument, arg);

	victim = ch->fighting;

	if (arg[0] != '\0')
		if (!(victim = get_char_room(ch, arg))) {
			send_to_char(C_DEFAULT, "They aren't here.\n\r", ch);
			return;
		}

	switch (prime_class(ch)) {
	case CLASS_MAGE:
	case CLASS_CLERIC:
		timer = 240;
		break;
	case CLASS_THIEF:
		timer = 180;
		break;
	case CLASS_WARRIOR:
		timer = 120;
		break;
	case CLASS_PSIONICIST:
	case CLASS_DRUID:
		timer = 240;
		break;
	case CLASS_RANGER:
	case CLASS_PALADIN:
	case CLASS_BARD:
	case CLASS_VAMPIRE:
		timer = 180;
		break;
	case CLASS_NECROMANCER:
		timer = 240;
		break;
	case CLASS_WEREWOLF:
		timer = 180;
		break;
	}
	mod = ch->level / 5;
	mod = UMAX(1, mod);
	timer = timer / mod;
	timer = (timer < 24) ? 24 : timer;
	ch->race_wait = timer;
	act(AT_YELLOW, "You slam your head into $N's!", ch, NULL, victim,
	    TO_CHAR);
	act(AT_YELLOW, "$n slams his head into yours!", ch, NULL, victim,
	    TO_VICT);
	act(AT_YELLOW, "$n slams his head into $N's!", ch, NULL, victim,
	    TO_NOTVICT);
	dmg = number_range(ch->level, ch->level * 5);
	damage(ch, victim, dmg, gsn_headbutt);
	STUN_CHAR(ch, 2, STUN_MAGIC);
	if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
		return;
	if (number_percent() < 15 && victim->position != POS_STUNNED) {
		act(AT_WHITE, "$N reels from the blow...", ch, NULL, victim,
		    TO_CHAR);
		act(AT_WHITE, "$N reels from the blow...", ch, NULL, victim,
		    TO_NOTVICT);
		act(AT_WHITE, "You real from the blow and feel disoriented.",
		    ch, NULL, victim, TO_VICT);
		STUN_CHAR(victim, 2, STUN_TOTAL);
		victim->position = POS_STUNNED;
	}
	return;
}