Posted by
| Zeno
USA (2,871 posts) Bio
|
Message
| Ah yes, since I only increase chars. Whoops, makes sense. Here is the redone function thanks to your suggestions.
void hanyou_dform_randoms( CHAR_DATA *ch )
{
int chars=0;
CHAR_DATA *rch;
sh_int door;
EXIT_DATA *pexit;
char buf[MAX_STRING_LENGTH];
if ( IS_NPC( ch ) || ch->race != RACE_HANYOU || ch->fighting || (ch->race == RACE_HANYOU && !xIS_SET(ch->act, PLR_TFORME$
return;
if ( IS_SET(ch->in_room->room_flags, ROOM_SAFE ) )
return;
if ( number_percent() < 30 )
return;
for ( rch = ch->in_room->first_person; rch; rch = rch->next_in_room )
{
if ( ch == rch || xIS_SET(rch->act, ACT_PACIFIST) )
continue;
if ( can_see( ch, rch ) )
{
chars++;
if ( number_percent() < 20 )
{
act( AT_FIRE, "In a frenzy, you jump at $N!", ch, NULL, rch, TO_CHAR );
act( AT_FIRE, "In a frenzy, $n jumps at you!", ch, NULL, rch, TO_VICT );
act( AT_FIRE, "In a frenzy, $n jumps at $N!", ch, NULL, rch, TO_NOTVICT );
sprintf(buf, "hyoukaiform: %s atk %s.", ch->name, rch->name );
to_channel( buf, CHANNEL_DEBUG, "Debug", LEVEL_IMMORTAL );
if ( IS_NPC(rch) )
{
do_kill( ch, rch->name );
break;
}
else if ( !IS_NPC(rch) )
{
do_murder( ch, rch->name );
break;
}
}
}
}
if ( chars == 0 )
{
door = number_door();
pexit = get_exit( ch->in_room, door );
if ( pexit != NULL && pexit->to_room && !IS_SET(pexit->exit_info, EX_CLOSED ) )
{
act( AT_PLAIN, "Finding no victims, you wander elsewhere.", ch, NULL, NULL, TO_CHAR );
sprintf(buf, "hyoukaiform: %s moves %s.", ch->name, dir_name[door] );
to_channel( buf, CHANNEL_DEBUG, "Debug", LEVEL_IMMORTAL );
move_char( ch, get_exit( ch->in_room, door ), 0, FALSE );
}
}
}
Do not mind the debugs. For my use. Does it look all good now? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|