You have
void do_invoke( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *fire, *shard;
bool found;
int mana;
if( !can_use_skill( ch, 0, gsn_invoke ) )
{
send_to_char( "A skill such as this requires more magical ability than you have.\n\r", ch );
return;
}
if( argument[0] == '\0' )
{
send_to_char( "Invoke which element?\n\r", ch);
return;
}
mana = (ch->max_mana / 5);
if( !str_cmp( argument, "fireshard" ) )
{
found = FALSE;
for( fire = ch->in_room->first_content; fire; fire = fire->next_content )
{
if( fire->item_type == ITEM_FIRE )
{
found = TRUE;
break;
}
}
if( !found )
{
send_to_char(" There must be a fire here to invoke a FireShard.\n\r", ch);
return;
}
if( !can_use_skill( ch, number_percent( ), gsn_invoke ) )
{
set_char_color( AT_MAGIC, ch );
send_to_char( "You failed to make a FireShard.\n\r", ch );
// Decided against PCs learning from failure
//learn_from_failure( ch, gsn_invoke );
ch->mana -= ( mana );
return;
}
//SUCCESS
shard = create_object( get_obj_index( OBJ_VNUM_SM_FIRESHARD ), 0 );
learn_from_success(ch, gsn_invoke);
ch->mana -= (ch->mana / 10);
act( AT_MAGIC, "$n invokes the fire and creates a FireShard.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You invoke the fire and create a FireShard.", ch, NULL, NULL, TO_CHAR );
obj_to_char( shard, ch);
learn_noncombat( ch, SK_CHANNEL);
}
when this is so much easier to follow and look at
void do_invoke( CHAR_DATA * ch, char *argument )
{
OBJ_DATA *fire, *shard;
bool found;
int mana;
if( !can_use_skill( ch, 0, gsn_invoke ) )
{
send_to_char( "A skill such as this requires more magical ability than you have.\n\r", ch );
return;
}
if( argument[0] == '\0' )
{
send_to_char( "Invoke which element?\n\r", ch);
return;
}
mana = (ch->max_mana / 5);
if( !str_cmp( argument, "fireshard" ) )
{
found = FALSE;
for( fire = ch->in_room->first_content; fire; fire = fire->next_content )
{
if( fire->item_type == ITEM_FIRE )
{
found = TRUE;
break;
}
}
if( !found )
{
send_to_char(" There must be a fire here to invoke a FireShard.\n\r", ch);
return;
}
if( !can_use_skill( ch, number_percent( ), gsn_invoke ) )
{
set_char_color( AT_MAGIC, ch );
send_to_char( "You failed to make a FireShard.\n\r", ch );
// Decided against PCs learning from failure
// learn_from_failure( ch, gsn_invoke );
ch->mana -= ( mana );
return;
}
// SUCCESS
shard = create_object( get_obj_index( OBJ_VNUM_SM_FIRESHARD ), 0 );
learn_from_success(ch, gsn_invoke);
ch->mana -= (ch->mana / 10);
act( AT_MAGIC, "$n invokes the fire and creates a FireShard.", ch, NULL, NULL, TO_ROOM );
act( AT_MAGIC, "You invoke the fire and create a FireShard.", ch, NULL, NULL, TO_CHAR );
obj_to_char( shard, ch);
learn_noncombat( ch, SK_CHANNEL);
}
You would be amazed by how much faster an issue can be found and fixed in a nicely formated code compared to one where you spend time trying to figure out what is going on first.