void _adrenaline_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Adrenaline Channeling");
        break;
    case SPELL_DESC:
        var_set_string(res, "Removes fear and stun. Gives heroism and speed. Heals HP a little unless "
                              "you already have heroism and temporary speed boost.");
        break;
    case SPELL_SPOIL_DESC:
        var_set_string(res, "Removes stun. Heals 10 + 1d(L*3/2). Grants heroism and haste.");
        break;
    case SPELL_CAST:
    {
        int dur = spell_power(15 + randint1(p_ptr->lev*3/2));
        bool heal = !IS_FAST() || !IS_HERO(); /* Prevent spamming this as a weak healing spell */

        set_stun(0, TRUE);

        set_hero(dur, FALSE);
        set_fast(dur, FALSE);

        if (heal) /* Heal after granting Heroism to fill the +10 mhp */
            hp_player(p_ptr->lev);

        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
Exemple #2
0
/*
 * 英雄扔掉一件装备,box_id为哪一个格子
 */
int takeoff_equip(LIFE_S *self, int box_id)
{
    EQUIPMENT_S *eqp = NULL;
    HMAA_S tmp = {0, 0, 0, 0};
    unsigned long long time = 0;
    unsigned long long used_time = 0;
    unsigned short cd = 0;

    DOTA_RETURN_IF_NULL(self, ERR_NULL_POINTER);
    if (box_id >= EQUIP_MAX)
        return ERR_UNKNOW_EQP;

    if (!IS_HERO(self))
        return ERR_WRONG_OBJ;

    eqp = self->equips[box_id].eqp;
    if (!eqp)
        return DOTA_OK;

    /*
     * 处于冷却状态下的装备是不能扔掉的
     */
    time = get_current_time();
    used_time = self->equips[box_id].used_time;
    cd = eqp->skl_attr.cold_down;
    if (used_time && (used_time + cd < time))
        return ERR_COLD_DOWN;

    ASM_TO_HMAA(&(eqp->bsc_attr), &tmp);

    /*
     * 测试发现,在扔掉装备扣除血量时,是根据百分比来扣除的。比如
     * 羊刀给某英雄增加了100点血量,假设英雄装备羊刀后满血的血量
     * 为500点,那么在某一时刻,假设英雄的血量为300点,此时若扔掉
     * 羊刀这件物品,英雄的血量不是300 - 100 = 200,而是300*(4/5)
     * 等于240点,HMAA的其他成员也应该遵守此规矩。
     */
    MINUS_HAMM_PER(&(self->cur_hmaa), &(self->org_hmaa), &tmp);
    MINUS_HAMM(&self->org_hmaa, &tmp);

    MINUS_ASM(&(self->org_asm), &(eqp->bsc_attr));
    MINUS_ASM(&(self->cur_asm), &(eqp->bsc_attr));

    /* 扔掉 */
    self->equips[box_id].eqp = NULL;
    self->equips[box_id].used_time = 0;
    return DOTA_OK;
}
Exemple #3
0
void do_follow( CHAR_DATA * ch, char * argument ) {
  CHAR_DATA * victim;
  char        arg[ MAX_INPUT_LENGTH ];

  one_argument( argument, arg );

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

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

  if ( IS_AFFECTED( ch, AFF_CHARM ) && ch->master ) {
    act( AT_DGREEN, "But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR );
    return;
  }

  if ( victim == ch ) {
    if ( !ch->master ) {
      send_to_char( AT_DGREEN, "Silly...you already follow yourself.\n\r", ch );
      return;
    }

    stop_follower( ch );
    return;
  }

  if ( ( ch->level - victim->level < -8
         || ch->level - victim->level >  8 )
       && !IS_HERO( ch ) ) {
    send_to_char( AT_DGREEN, "You feel unworthy to follow.\n\r", ch );
    return;
  }

  if ( ch->master ) {
    stop_follower( ch );
  }

  add_follower( ch, victim );
  return;
}
Exemple #4
0
bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote )
{
    if ( !str_cmp( ch->name, pnote->sender ) )
	return TRUE;

    if ( is_name( "all", pnote->to_list ) )
	return TRUE;

    if ( IS_HERO(ch) && is_name( "immortal", pnote->to_list ) )
	return TRUE;

    if ( is_name( ch->name, pnote->to_list ) )
	return TRUE;

    if( IS_IMMORTAL(ch) && ch->level > 990 )
	return TRUE;

    return FALSE;
}
Exemple #5
0
bool is_note_to( CHAR_DATA *ch, NOTE_DATA *pnote )
{
    if ( !str_cmp( ch->name, pnote->sender ) )
	return TRUE;

    if ( is_name( "all", pnote->to_list ) )
	return TRUE;

    if ( IS_HERO( ch ) && (   is_name( "immortal",  pnote->to_list )
			   || is_name( "immortals", pnote->to_list )
			   || is_name( "imm",       pnote->to_list )
			   || is_name( "immort",    pnote->to_list ) ) )

	return TRUE;

    if ( is_name( ch->name, pnote->to_list ) )
	return TRUE;

    return FALSE;
}
void wiznet( char *string, CHAR_DATA * ch, OBJ_DATA * obj, long flag, long flag_skip, int min_level )
{
   char buf[MAX_STRING_LENGTH];
   DESCRIPTOR_DATA *d;

   xprintf( buf, "#W%s#n", string );
   for( d = descriptor_list; d != NULL; d = d->next )
   {
	  if(!d->character) return;
      if( d->connected == CON_PLAYING && ( IS_HERO( d->character ) ) && IS_SET( d->character->wiznet, WIZ_ON )
          && ( !flag || IS_SET( d->character->wiznet, flag ) ) && ( !flag_skip
                                                                    || !IS_SET( d->character->wiznet, flag_skip ) )
          && get_trust( d->character ) >= min_level && d->character != ch )
      {
         if( IS_SET( d->character->wiznet, WIZ_PREFIX ) )
            send_to_char( "#Y-->#n ", d->character );
         act( buf, d->character, obj, ch, TO_CHAR );
      }
   }

   return;
}
Exemple #7
0
/*
 * Generic channel function.
 */
void talk_channel( CHAR_DATA *ch, const 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 ) && IS_SET( ch->act, PLR_SILENCE ) )
    {
	sprintf( buf, "You can't %s.\n\r", verb );
	send_to_char( buf, ch );
	return;
    }

    if ( IS_AFFECTED( ch, AFF_MUTE )
        || IS_SET( ch->in_room->room_flags, ROOM_CONE_OF_SILENCE ) )
    {
        send_to_char( "You can't seem to break the silence.\n\r", ch );
        return;
    }

    REMOVE_BIT( ch->deaf, channel );

    switch ( channel )
    {
    default:
	sprintf( buf, "You %s '%s'\n\r", verb, argument );
	send_to_char( buf, ch );
	sprintf( buf, "$n %ss '$t'",     verb );
	break;

    case CHANNEL_IMMTALK:
	sprintf( buf, "$n: $t" );
	position	= ch->position;
	ch->position	= POS_STANDING;
	act( 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
	    && !IS_SET( och->deaf, channel )
	    && !IS_SET( och->in_room->room_flags, ROOM_CONE_OF_SILENCE ) )
	{
	    if ( channel == CHANNEL_IMMTALK && !IS_HERO( och ) )
		continue;
	    if ( channel == CHANNEL_YELL
		&& vch->in_room->area != ch->in_room->area )
	        continue;

	    position		= vch->position;
	    if ( channel != CHANNEL_SHOUT && channel != CHANNEL_YELL )
		vch->position	= POS_STANDING;
	    act( buf, ch, argument, vch, TO_VICT );
	    vch->position	= position;
	}
    }

    return;
}
Exemple #8
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 #9
0
/*
 * Generic channel function.
 */
void talk_channel( CHAR_DATA *ch, char *argument, int channel, const char *verb )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;
    int position;
    char *color = "&n";

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

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

    if( ch ) 
	    REMOVE_BIT(ch->deaf, channel);

    switch( channel ) /* for colors only */
    {
    case CHANNEL_CHAT:		color = "&+m";	break;
    case CHANNEL_SHOUT:		color = "&+Y";	break;
    case CHANNEL_YELL:		color = "&+y";	break;
    case CHANNEL_MUSIC:		color = "&+M";	break;
    default:					break;
    }

    switch ( channel )
    {
    default:
	sprintf( buf, "%sYou %s '%s&n%s'.\n\r", color, verb, argument, color );
	send_to_char( buf, ch );
	sprintf( buf, "%s$n %ss '$t&n%s'.", color, verb, color );
	break;

    case CHANNEL_WARMESSAGE:
	    sprintf( buf, "**** %s ****", argument );
	    do_echo( ch, buf );
	    return;

    case CHANNEL_IMMTALK:
	sprintf( buf, "&+c$n: $t." );
	position	= ch->position;
	ch->position	= POS_STANDING;
	act( buf, ch, argument, NULL, TO_CHAR );
	ch->position	= position;
	break;
    }

    for ( d = descriptor_list; d != NULL; 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
	&&  !IS_SET(och->deaf, channel) )
	{
	    if ( channel == CHANNEL_IMMTALK && !IS_HERO(och) )
		continue;
	    if ( channel == CHANNEL_YELL
	    &&   vch->in_room->area != ch->in_room->area )
		continue;

	    position		= vch->position;
	    if ( channel != CHANNEL_SHOUT && channel != CHANNEL_YELL )
		vch->position	= POS_STANDING;
	    act( buf, ch, argument, vch, TO_VICT );
	    vch->position	= position;
	}
    }

    return;
}