Beispiel #1
0
/*-----------------------------------------------------------------------------
    Name        : aihFastDefenseNumbersLowHandler
    Description : Handles the fast roving defense team being decimated
    Inputs      : team - the team being decimated
    Outputs     :
    Return      : void
----------------------------------------------------------------------------*/
void aihFastDefenseNumbersLowHandler(AITeam *team)
{
    AITeamMove *thisMove = team->curMove, *newMove;
    AlternativeShips alternatives;
    vector gathering_point;
    vector origin = ORIGIN_VECTOR;
    SelectCommand *teamsel = team->shipList.selection;
    sdword original_number = thisMove->events.numbersLow.watchBaseCount;

    //later maybe change to "reinforce" move, maybe along with harass team getting out
    //of there to attack someone else.
    if (aiCurrentAIPlayer->player->PlayerMothership)
    {
        gathering_point = aiCurrentAIPlayer->player->PlayerMothership->posinfo.position;
    }
    else
    {
        vecZeroVector(gathering_point);
    }

    gathering_point = aiuFindRangeStandoffPoint(gathering_point,origin, AIH_FASTDEF_NUMLOW_STANDOFF_DIST);

    thisMove->processing = FALSE;
    thisMove->events.numbersLow.triggered = FALSE;

    //add a move, getships, formation
    newMove = aimCreateMoveTeamNoAdd(team, gathering_point, AIH_FASTDEF_NUMLOW_FORMATION, FALSE, TRUE);
    aitAddmoveBeforeAndMakeCurrent(team, newMove, thisMove);

    if (teamsel->numShips)
    {
        if (teamsel->numShips < original_number)
        {
            newMove = aimCreateGetShipsNoAdd(team, teamsel->ShipPtr[0]->shiptype, (sbyte)(original_number - teamsel->numShips), 0, TRUE, TRUE);
        }
        else
        {
            //just add one ship (to prevent infinite loops)
            newMove = aimCreateGetShipsNoAdd(team, teamsel->ShipPtr[0]->shiptype, 1, 0, TRUE, TRUE);
        }

    }
    else
    {
        SetNumAlternativesFlags(alternatives,3, ALTERNATIVE_RANDOM)
        SetAlternative(alternatives,0,HeavyDefender,14);
        SetAlternative(alternatives,1,HeavyInterceptor,14);
        SetAlternative(alternatives,2,AttackBomber,15);

        newMove = aimCreateFancyGetShipsNoAdd(team, LightInterceptor, 12, &alternatives, 0, TRUE, FALSE);
    }

    thisMove->events.numbersLow.watchBaseCount = 0;
    thisMove->processing = FALSE;

    listAddNodeBefore(&(thisMove->listNode), &(newMove->listNode), newMove);

//    newMove = aimCreateFormationNoAdd(team, WALL_FORMATION, FALSE, TRUE);
//    listAddNodeBefore(&(thisMove->listNode), &(newMove->listNode), newMove);
}
Beispiel #2
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateHarass
    Description : Creates the moves for a team to perform the harass order
    Inputs      : team - the team to do the harassing
    Outputs     : Creates a whole bunch of moves for the team
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateHarass(AITeam *team)
{
    vector destination, origin = ORIGIN_VECTOR;
    AlternativeShips alternatives;
    AITeamMove *move;

    aiplayerLog((aiIndex, "%x Issuing Harass Order", team));

    bitSet(team->teamFlags, HARASS_TEAM);

    destination = aiuFindEnemyMothershipCoords(aiCurrentAIPlayer->player);
    destination = aiuFindRangeStandoffPoint(destination, origin, HARASS_STANDOFF_DISTANCE);

    SetNumAlternativesFlags(alternatives,6,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,HeavyInterceptor,HARASS_HEAVYINT_EQUIVNUM);
    SetAlternative(alternatives,1,HeavyInterceptor,HARASS_HEAVYINT_EQUIVNUM);
    SetAlternative(alternatives,2,AttackBomber,HARASS_BOMBER_EQUIVNUM);
    SetAlternative(alternatives,3,AttackBomber,HARASS_BOMBER_EQUIVNUM);
    SetAlternative(alternatives,4,CloakedFighter,10);
    SetAlternative(alternatives,5,CloakedFighter,10);

    aimCreateFancyGetShips(team, LightInterceptor, HARASS_LIGHTINT_INITNUM, &alternatives, REQUESTSHIPS_HIPRI, TRUE, FALSE);

    move = aimCreateMoveTeam(team, destination, AIO_HARASS_INITIAL_MOVE_FORMATION, TRUE, FALSE);
    aieHandlerSetFuelLow(move, AIO_HARASS_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(move, AIO_HARASS_NUMBERS_LOW, 0, TRUE, aihHarassNumbersLowHandler);
    aieHandlerSetGettingRocked(move, FALSE, aihGenericGettingRockedHandler);
    aieHandlerSetTeamDied(move, aihHarassTeamDiedHandler);

//    aimCreateFormation(team, CLAW_FORMATION, FALSE, FALSE);

    move = aimCreateHarassAttack(team, TRUE, FALSE);
    aieHandlerSetFuelLow(move, AIO_HARASS_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(move, AIO_HARASS_NUMBERS_LOW, 0, TRUE, aihHarassNumbersLowHandler);
    aieHandlerSetGettingRocked(move, FALSE, aihGenericGettingRockedHandler);
    aieHandlerSetTeamDied(move, aihHarassTeamDiedHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Beispiel #3
0
/*-----------------------------------------------------------------------------
    Name        : aihHarassNumbersLowHandler
    Description : Handles the harass team being decimated
    Inputs      : team - the team being decimated
    Outputs     :
    Return      : void
----------------------------------------------------------------------------*/
void aihHarassNumbersLowHandler(AITeam *team)
{
    AITeamMove *thisMove = team->curMove, *newMove;
    AlternativeShips alternatives;
    vector gathering_point;
    vector origin = ORIGIN_VECTOR;

//commented code is the reinforce type numbers low handler
/*    udword i;

    for (i = 0; i < aiCurrentAIPlayer->numGuardTeams; i++)
    {
        //later need to actually remove team from guardTeams array
        if (bitTest(aiCurrentAIPlayer->guardTeams[i]->teamFlags, FAST_ROVING_GUARD) &&
            (aiCurrentAIPlayer->guardTeams[i]->shipList.selection->numShips))
        {
            bitClear(aiCurrentAIPlayer->guardTeams[i]->teamFlags, FAST_ROVING_GUARD);
            aiCurrentAIPlayer->guardTeams[i]->curMove = aimCreateReinforce(aiCurrentAIPlayer->guardTeams[i], team, TRUE, FALSE);
            aimCreateMoveDone(aiCurrentAIPlayer->guardTeams[i], FALSE, FALSE);
            return;
        }
    }
*/
    //later maybe change to "reinforce" move, maybe along with harass team getting out
    //of there to attack someone else.
    //later - very important to get the same ships that were requested in the first place
    //        this isn't all that "generic"
    if (aiCurrentAIPlayer->player->PlayerMothership)
    {
        gathering_point = aiCurrentAIPlayer->player->PlayerMothership->posinfo.position;
    }
    else
    {
        vecZeroVector(gathering_point);
    }

    while ((thisMove->type == MOVE_ATTACK) || (thisMove->type == MOVE_ADVANCEDATTACK))
    {
        if (thisMove->remove)
        {
            aitDeleteCurrentMove(team);
        }
        else
        {
            team->curMove = (AITeamMove *)listGetStructOfNode(team->curMove->listNode.next);
        }

        thisMove = team->curMove;

        dbgAssert(thisMove);
    }

    gathering_point = aiuFindRangeStandoffPoint(gathering_point,origin, AIH_HARASS_NUMLOW_STANDOFF_DIST);

    thisMove->processing = FALSE;
    thisMove->events.numbersLow.triggered = FALSE;

    //add a move, getships, formation
    newMove = aimCreateMoveTeamNoAdd(team, gathering_point, AIH_HARASS_NUMLOW_FORMATION, FALSE, TRUE);
//band-aid solution... change moveteam move so that tactics are there...
    newMove->tactics = Evasive;
    aitAddmoveBeforeAndMakeCurrent(team, newMove, thisMove);

    SetNumAlternatives(alternatives,2);
    SetAlternative(alternatives,0,HeavyInterceptor,HARASS_HEAVYINT_EQUIVNUM);
    SetAlternative(alternatives,1,AttackBomber, HARASS_BOMBER_EQUIVNUM);

    newMove = aimCreateFancyGetShipsNoAdd(team, LightInterceptor, 16, &alternatives, REQUESTSHIPS_HIPRI, TRUE, TRUE);
    listAddNodeBefore(&(thisMove->listNode), &(newMove->listNode), newMove);

    bitClear(team->teamFlags, TEAM_NEEDS_SUPPORT);
}