Ejemplo n.º 1
0
void get_mob_group( CHAR_DATA * ch, CHAR_DATA * target )
{
    CHAR_DATA *vch;
    bool ch_is_leader = FALSE;
    bool tar_is_leader = FALSE;
    bool is_hunting = FALSE;
    bool ch_is_higher = FALSE;
    char buf[MAX_STRING_LENGTH];
    int number_of_tar_group = 1;
    int number_of_ch_group = 1;

    ch_is_leader = is_group_leader( ch );
    tar_is_leader = is_group_leader( target );

    if ( tar_is_leader == TRUE )
    {
        for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room )
        {
            if ( !AI_MOB( vch ) )
            {
                continue;
            }
            if ( vch != target && is_same_group( vch, target ) )
            {
                number_of_tar_group = number_of_tar_group + 1;
                continue;
            }
            if ( vch != ch && is_same_group( ch, vch ) )
            {
                number_of_ch_group = number_of_ch_group + 1;
                continue;
            }
        }
    }

    do_say( ch, "Hello there.  What are you up to?" );

//   WAIT_STATE( target, 560 );

    if ( target->hunting != NULL )
    {
        is_hunting = TRUE;
        if ( tar_is_leader == TRUE )
        {
            snprintf( buf, MSL, "We're planning on killing %s.", target->hunting->get_name() );
        }
        else
        {
            snprintf( buf, MSL, "I'm planning on killing %s.", target->hunting->get_name() );
        }
        do_say( target, buf );
    }
    else
    {
        do_say( target, "Nothing.  Just hanging around." );
    }

    WAIT_STATE( ch, 275 );

    /*
     * check to see which of the two is higher. the higher mob will lead
     */
    if ( ch->get_level("psuedo") >= target->get_level("psuedo") )
        ch_is_higher = TRUE;

    /*
     * if ch is higher in levels and victim is hunting, then say
     * * appropriate line.
     */
    if ( ( ch_is_higher == FALSE ) && ( is_hunting == TRUE ) )
    {
        do_say( ch, "Oh really?  Cool!  Need any help?" );
    }
    else if ( ( ch_is_higher == FALSE ) && ( is_hunting == FALSE ) )
    {
        do_say( ch, "Great!  Since you're not doing anything, wanna group?" );
    }
    else if ( ( ch_is_higher == TRUE ) && ( is_hunting == TRUE ) )
    {
        if ( ch_is_leader == TRUE )
        {
            snprintf( buf, MSL, "Want to help us kill %s instead?", ch->hunting->get_name() );
            do_say( ch, buf );
        }
        else if ( ch_is_leader == FALSE )
        {
            snprintf( buf, MSL, "Want to help me kill %s instead?", ch->hunting->get_name() );
            do_say( ch, buf );
        }
    }
    else if ( ( ch_is_higher == TRUE ) && ( ch->hunting == FALSE ) )
    {
        do_say( ch, "Want to group?" );
    }
    WAIT_STATE( target, 275 );

    if ( ch_is_higher == TRUE )
    {
        do_say( target, "Ok sure!  Thanks for asking." );

        if ( tar_is_leader == TRUE )
        {
            mob_group_follow( target, ch );
        }
        do_follow( target, const_cast<char *>(ch->name.c_str()) );
        do_group( ch, const_cast<char *>(target->name.c_str()) );
    }
    else
    {
        do_say( target, "Ok, why not!?  Follow me." );

        WAIT_STATE( ch, 275 );

        do_say( ch, "Cool!" );

        if ( ch_is_leader == TRUE )
        {
            mob_group_follow( ch, target );
        }
        do_follow( ch, const_cast<char *>(target->name.c_str()) );
        do_group( target, const_cast<char *>(target->name.c_str()) );
    }
    return;
}
Ejemplo n.º 2
0
void do_resurrect(CHAR_DATA *ch, char *argument )
{
    char buf2[MAX_STRING_LENGTH];
    char buf [MAX_INPUT_LENGTH];
    char arg [MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    AFFECT_DATA af;
    OBJ_DATA *obj;
    one_argument(argument,arg);
    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }
    if (arg[0] == '\0')
    {
        send_to_char("Resurrect what corpse?\n\r",ch);
        return;
    }
    if ( IS_CLASS(ch, CLASS_WIZARD) && ch->pcdata->powers[WL_SKILLS] < 1 )
    {
        stc("You need level 1 in Wizard Skills\n\r",ch);
        return;
    }
    if (ch->pcdata->followers > 5)
    {
        send_to_char("Nothing happens.\n\r",ch);
        return;
    }
    if ((obj = get_obj_carry(ch,arg)) == NULL)
    {
        send_to_char("You dont have that corpse.",ch);
        return;
    }
    if (obj->item_type != ITEM_CORPSE_NPC)
    {
        send_to_char("You can only Resurrect original corpses.\n\r",ch);
        return;
    }
    ch->pcdata->followers++;

    victim=create_mobile( get_mob_index( obj->value[2] ) );
    sprintf(buf,"Resurrection of %s",victim->short_descr);
    sprintf(buf2,"Resurrection of %s is here.\n\r",victim->short_descr);
    free_string(victim->short_descr);
    victim->short_descr = str_dup(buf);
    free_string(victim->name);
    SET_BIT(victim->act, ACT_NOEXP);
    if ( IS_SET(victim->act,ACT_QUEST) ) REMOVE_BIT(victim->act,ACT_QUEST);
    victim->name = str_dup(buf);
    free_string(victim->long_descr);
    victim->long_descr= str_dup(buf2);
    victim->spec_fun = NULL;
    sprintf(buf,"I invoke the rebirth of %s!",victim->name);
    do_say( ch, buf );
    sprintf(buf, "%s clambers back up to its feet.\n\r",obj->short_descr);
    act(buf,ch,NULL,NULL,TO_ROOM);
    send_to_char(buf,ch);
    char_to_room( victim, ch->in_room );

    WAIT_STATE(ch,10);
    extract_obj(obj);

    if(victim->level > ((ch->pcdata->upgrade_level + 1) * 500))
    {
        send_to_char("You are unable to control the resurrected creature.\n\r", ch);
        return;
    }

    add_follower( victim, ch );
    af.type      = skill_lookup ("charm person");
    af.duration  = 666;
    af.location  = APPLY_NONE;
    af.modifier  = 0;
    af.bitvector = AFF_CHARM;
    affect_to_char( victim, &af );
    sprintf(buf,"%s",victim->name);
    do_group(ch,buf);
    return;
}
Ejemplo n.º 3
0
void mob_group_follow( CHAR_DATA * ch, CHAR_DATA * target )
{
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *vch;
    int num;


    if ( ( ch == NULL ) || ( target == NULL ) )
    {
        snprintf( buf, MSL, "%s", "Null ch and/or target in mob_group_follow, exiting." );
        monitor_chan( buf, MONITOR_MOB );
        return;
    }
    snprintf( buf, MSL, "Ok guys, let's all follow %s.", target->get_name() );
    do_say( ch, buf );

    for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room )
    {
        if ( ( ch != vch ) && ( AI_MOB( vch ) ) && ( is_same_group( ch, vch ) ) )
        {
            if ( vch->position != POS_STANDING )
                do_stand( vch, "" );

            num = number_percent(  );

//  WAIT_STATE( vch, 275 );

            if ( num > 85 )
                do_say( vch, "Ok boss.  Whatever you say." );
            else if ( num > 70 )
                do_say( vch, "Alright!  More people, more power!" );
            else if ( num > 55 )
                do_say( vch, "Whoo Hooo!" );
            else if ( num > 35 )
                do_say( vch, "Sure thing." );
            else if ( num > 29 )
            {
                if ( num > 32 )
                    snprintf( buf, MSL, "Man I don't want to join %s's group!", target->get_name() );
                else
                    snprintf( buf, MSL, "I hate big groups." );
                do_say( vch, buf );
                do_follow( vch, const_cast<char *>(vch->name.c_str()) );
                do_say( vch, "I'm outta here." );
                do_recall( vch, "" );
                continue;
            }

            if ( !can_see( vch, target ) )
            {
                vch->master = target;
                vch->leader = NULL;
            }
            else
            {
                do_follow( vch, const_cast<char *>(target->name.c_str()) );
            }
            do_group( target, "all" );

        }
    }
    return;
}