Exemple #1
0
void Control::target_stuff()
{
    STACKTRACE;
    if (index == -1) {
        if (targets->N) {
            index = random() % targets->N;
            target = targets->item[index];
            goto validate;
        } else {
            goto done;
        }
    }
blah:
    if (index >= targets->N) {
        if (targets->N) {
            index -= 1;
            if (index < 0) index = 0;
            goto blah;
        } else {
            index = -1;
            target = NULL;
            goto change;
        }
    }
    if (target == targets->item[index]) {
        goto done;
    }
    else goto search;
search:
    int o;
    o = index;
    for (index = 0; index < targets->N; index += 1) {
        if (targets->item[index] == target) {
            goto done;
        }
    }
    index = o;
validate:
    if (!ship) {
        goto done;
    }
    int start;
    start = index;
    while (!valid_target(targets->item[index])) {
        index = (index + 1) % targets->N;
        if (index == start) {
            index = -1;
            target = NULL;
            goto change;
        }
    }
    target = targets->item[index];
change:
done:
    return;
}
Exemple #2
0
string validate_params(mapping param) {
	object apple;
	if( !valid_target(param) )
		return "You must cast the spell on a written paper.";
	if( !find_player(param["option"]) )
		return "Right now, you must cast the spell 'to' a currently logged in player.";
	if( !param["component"] )
		return "You must specify a piece of fruit 'with' which to cast the spell.";
	apple = single_present(param["component"], param["caster"]);
	if( !apple )
		return "You don't appear to be holding any such '"+param["component"]+"' to offer your messenger.";
	if( !apple->query_has_aspect( C_FRUIT ) )
		return capitalize(apple->query_specific())+" is not a piece of fruit.";
	return "ok";
}
Exemple #3
0
void Control::set_target(int i)
{
    STACKTRACE;
    if (i >= targets->N) {
        tw_error("oscar hamburger!!!!!!!!!");
    }
    if (i == -1) {
        index = i;
        target = NULL;
        return;
    }
    if (!valid_target(targets->item[i])) {
        tw_error("oscer hambuger");
    }
    index = i;
    target = targets->item[index];
    return;
}
Exemple #4
0
string validate_params(mapping param) {
	object apple;
	if( !valid_target(param) )
		return "You may only cast this spell on yourself or another player";
	return "ok";
}
Exemple #5
0
void select_target( CHAR_DATA * ch )
{
    /*
     * Find a new target for the group to go after
     */
    int average_level;
//   int        tmp   = 0;
    CHAR_DATA *vch;
    CHAR_DATA *victim = NULL;
    list<CHAR_DATA *>::iterator li;
    char buf[MAX_STRING_LENGTH];
    int force_index = 0;
    bool alone = TRUE;
    bool mob_is_leader = FALSE;
    short attempts;

    /*
     * mobs were doing ethereal travel too much... i've now lowered it to
     * * 15% of the time and only if they are not hunting
     */

    mob_is_leader = is_group_leader( ch );
    if ( ( number_percent(  ) < 15 ) && ( ch->hunting == NULL ) && ( ch->in_room->vnum != ROOM_VNUM_ETHEREAL_PLANE ) )

        /* was victim == NULL, that's always true at this point.. Zen */

    {
        if ( mob_is_leader == TRUE )
        {
            for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room )
            {
                if ( ( is_same_group( ch, vch ) ) == TRUE )
                {
                    if ( vch->mana < mana_cost( vch, skill_lookup( "ethereal travel" ) ) )
                    {
                        return;
                    }
                }
            }
        }
        if ( ch->mana < mana_cost( ch, skill_lookup( "ethereal travel" ) ) )
            return;

        do_say( ch, "This place is boring! I am gonna go somewhere else!" );
        for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room )
        {
            if ( ( is_same_group( vch, ch ) ) && ( ch != vch ) )
            {
                do_say( vch, "Yeah, it is--we're outta here!" );
                do_cast( vch, "ethereal" );
            }
        }
        do_cast( ch, "ethereal" );
    }
    else
    {
        /*
         * keeps checking until you've found a valid target
         */
        attempts = 0;
        while ( ( victim == NULL ) && ( attempts < 15 ) )
        {
// ZEN FIX set average level based on level of ngroup
            attempts++;
            average_level = ch->get_level("psuedo");

            force_index = number_range( 1, mob_index_list.size() );

            for ( li = char_list.begin(); li != char_list.end(); li++ )
            {
                vch = *li;
                if ( victim != NULL )
                    break;
                force_index--;
                if ( force_index > 0 )
                    continue;

                if ( valid_target( ch, vch, average_level ) )
                {
                    /*
                     * Trick used in  something else...
                     */
                    if ( number_range( 0, 1 ) == 0 )
                    {
                        victim = vch;
                    }
                    if ( victim == NULL ) /* screwed up somehow */
                    {
                        continue;
                    }
                    if ( !IS_NPC( victim ) )
                    {
                        for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room )
                        {
                            if ( is_same_group( ch, vch ) )
                            {
                                alone = FALSE;
                                break;
                            }
                        }
                        if ( alone == FALSE )
                        {
                            snprintf( buf, MSL, "%s We're coming for you!", victim->name.c_str() );
                            do_tell( ch, buf );
                        }
                        else
                        {
                            snprintf( buf, MSL, "%s I'm coming for you!", victim->name.c_str() );
                            do_tell( ch, buf );
                        }
                    }
                }
            }
        }

        if ( set_hunt( ch, NULL, victim, NULL, HUNT_WORLD | HUNT_PICKDOOR | HUNT_CR, HUNT_MERC ) )
        {
            snprintf( buf, MSL, "Right!  %s is our new target!!", victim->get_name() );
            do_say( ch, buf );
        }

        return;
    }
    return;

}
Exemple #6
0
string validate_params(mapping param) {
    object apple;
    if( !valid_target(param) )
        return "You must cast the spell on a whole squash of some sort or another.";
    return "ok";
}