Ok, I don't know much about timers, but what I just coded in gives me 3(6) bugs, but I don't know why or how. I tried a lot already, like making different do_functions for it, but it still didn't work. It probably is something easy, but yea...I can't figure it out lol.
I'll explain the idea for the code first:
I want to make it so that skills take up some time to use and their opponent can counter it with their skills.
I get the following errors:
magic.c: In function 'spell_water_dragon_blast':
magic.c:7338: error: syntax error before "ch_ret"
magic.c:7340: error: case label not within a switch statement
magic.c:7344: error: syntax error before "ch_ret"
magic.c:7347: error: case label not within a switch statement
magic.c:7351: error: syntax error before "ch_ret"
magic.c:7354: error: case label not within a switch statement
The code of the skill:
I'll explain the idea for the code first:
I want to make it so that skills take up some time to use and their opponent can counter it with their skills.
I get the following errors:
magic.c: In function 'spell_water_dragon_blast':
magic.c:7338: error: syntax error before "ch_ret"
magic.c:7340: error: case label not within a switch statement
magic.c:7344: error: syntax error before "ch_ret"
magic.c:7347: error: case label not within a switch statement
magic.c:7351: error: syntax error before "ch_ret"
magic.c:7354: error: case label not within a switch statement
The code of the skill:
ch_ret spell_water_dragon_blast( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
int dam;
level = UMAX(0, level);
level = UMIN(150, level);
dam = number_range( 1, 7 )*number_range( 50, 75 );
act( AT_MAGIC, "You start performing seals", ch, NULL, NULL, TO_CHAR);
act( AT_MAGIC, "$n starts performing seals", ch, NULL, NULL, TO_CHAR);
add_timer( ch, TIMER_NONE, 1, ch_ret spell_water_dragon_blast, 1 )
ch->alloc_ptr = str_dup( staticbuf );
case 1:
act( AT_MAGIC, "...ox tiger bird monkey rat ox...", ch, NULL, NULL, TO_CHAR);
act( AT_MAGIC, "...ox tiger bird monkey rat ox...", ch, NULL, NULL, TO_ROOM);
DISPOSE( ch->alloc_ptr );
add_timer( ch, TIMER_NONE, 2, ch_ret spell_water_dragon_blast, 2 )
ch->alloc_ptr = str_dup( staticbuf );
case 2:
act( AT_MAGIC, "You yell: '...Bird! Suiton Suiryuudan no Jutsu!'", ch, NULL, NULL, TO_CHAR);
act( AT_MAGIC, "$n yells: '...Bird! Suiton Suiryuudan no Jutsu!'", ch, NULL, NULL, TO_ROOM);
DISPOSE( ch->alloc_ptr );
add_timer( ch, TIMER_NONE, 3, ch_ret spell_water_dragon_blast, 3 )
ch->alloc_ptr = str_dup( staticbuf );
case 3:
act( AT_MAGIC, "A large dragon made completely of water rises up and charges at $N", ch, NULL, NULL, TO_ROOM);
act( AT_MAGIC, "A large dragon made completely of water rises up and charges at $N", ch, NULL, NULL, TO_CHAR);
DISPOSE( ch->alloc_ptr );
if ( IS_AFFECTED( victim, AFF_SHARINGAN ) )
{
if( victim->pcdata->learned[sn] )
{
return damage( ch, victim, dam, sn );
}
if( victim->mana < 150 )
{
return damage( ch, victim, dam, sn );
}
victim->pcdata->learned[sn] = 20;
victim->mana -= 150;
act( AT_FIRE, "Your sharingan starts spinning at a fast rate!\n\r", victim, NULL, NULL, TO_CHAR);
act( AT_YELLOW, "You just copied Water Dragon Blast!\n\r", victim, NULL, NULL, TO_CHAR );
act( AT_FIRE, "$n's sharingan starts spinning!\n\r", victim, NULL, NULL, TO_ROOM );
return damage( ch, victim, dam, sn );
}
if ( saves_spell_staff( level, victim ) )
dam /= 2;
return damage( ch, victim, dam, sn );
}