Example #1
0
void aioCreateTakeoutMothershipBig(struct AITeam *team,Ship *mothership, bool ForceBig)
{
    AlternativeShips alternatives1,alternatives2;
//    SelectCommand *selectone;
    AITeamMove *attackmove;

    if (!aiCurrentAIPlayer->player->PlayerMothership)
    {
        return;
    }

    aiplayerLog((aiIndex, "%x Issuing Takeout Mothership Big Order", team));

    if ((aiCurrentAIPlayer->player->PlayerMothership->shiptype == Mothership) || ForceBig)
    {
        SetNumAlternativesFlags(alternatives1,1,ALTERNATIVE_RANDOM);
        SetAlternative(alternatives1,0,StandardDestroyer,30);

        SetNumAlternativesFlags(alternatives2,2,ALTERNATIVE_RANDOM);
        SetAlternative(alternatives2,0,MissileDestroyer,30);
        SetAlternative(alternatives2,1,MissileDestroyer,30);
    }
    else if (aiCurrentAIPlayer->player->PlayerMothership->shiptype == Carrier)
    {
        SetNumAlternativesFlags(alternatives1,0,ALTERNATIVE_RANDOM);

        SetNumAlternativesFlags(alternatives2,0,ALTERNATIVE_RANDOM);
//        SetAlternative(alternatives2,0,DDDFrigate,10);
    }
    else
    {
        aiplayerLog((aiIndex, "Unknown Mothership Type"));
        return;
    }

    aimCreateFancyGetShips(team, IonCannonFrigate, 2, &alternatives1, 0, TRUE, FALSE);
    aimCreateFancyGetShips(team, StandardFrigate,  2, &alternatives2, REQUESTSHIPS_HIPRI, TRUE, FALSE);

    aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE);
//    aimCreateVarWait(team, aiCurrentAIPlayer->attackVarLabel, -1, TRUE, FALSE);
    aimCreateTempGuard(team, AIO_TOUT_MSHIP_BIG_TGRD_FORMATION, AIO_TOUT_MSHIP_BIG_TGRD_TACTICS, TRUE, FALSE);

//    selectone = memAlloc(sizeofSelectCommand(1),"takeoutsel",0);
//    selectone->numShips = 1;
//    selectone->ShipPtr[0] = mothership;
//    attackmove = aimCreateAttack(team, selectone, WALL_FORMATION, TRUE, FALSE);
    attackmove = aimCreateArmada(team, WALL_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(attackmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(attackmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);

    aimCreateMoveDone(team, FALSE, FALSE);

    //this team can hyperspace attack
    bitSet(team->teamFlags, TEAM_Hyperspaceable);
}
Example #2
0
sdword aimProcessKamikaze(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;
    SelectCommand *selection = team->shipList.selection;

    if (selection->numShips == 0)
    {
        aiplayerLog((aiIndex,"Kamikaze Move, Zero Sized Team"));
        return TRUE;
    }

    if (!thisMove->processing)
    {
        if ((selection->numShips > 0) && (thisMove->params.kamikaze.ships->numShips > 0))
        {
            if (aiuWrapSetTactics(selection,Aggressive))
            {
                if (aiuWrapAttack(selection, thisMove->params.kamikaze.ships))
                {
                    aiuWrapSetKamikaze(selection);
                    thisMove->processing = TRUE;
                }
            }
        }
        else
        {
            aiplayerLog((aiIndex,"Warning: no ships to kamikaze into"));
            thisMove->processing = TRUE;
        }

        return FALSE;
    }
    else
    {
        if ((selection->numShips == 0) || (thisMove->params.kamikaze.ships->numShips == 0) ||
            (aiuShipsNoLongerAttacking(selection)))
        {
            // we're done
            memFree(thisMove->params.kamikaze.ships);
            thisMove->params.kamikaze.ships = NULL;

            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
}
Example #3
0
sdword aimProcessGuardCooperatingTeam(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;
    SelectCommand *selection = team->shipList.selection;
    SelectCommand *guardselection = NULL;

    dbgAssert(!thisMove->processing);

    if (team->shipList.selection->numShips == 0)
    {
        return FALSE;
    }

    if (team->cooperatingTeam != NULL)
    {
        guardselection = team->cooperatingTeam->shipList.selection;
    }

    if ((selection->numShips > 0) && (guardselection != NULL) && (guardselection->numShips > 0))
    {
        aiuWrapProtect(selection,guardselection);
    }
    else
    {
        aiplayerLog((aiIndex,"Warning: no ships to guard"));
    }
    thisMove->processing = TRUE;

    return TRUE;
}
Example #4
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateFighterStrike
    Description : Creates the moves to create and do stuff with a fighter
                  strike force
    Inputs      : team
    Outputs     : Creates a bunch'a moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateFighterStrike(AITeam *team)
{
    AlternativeShips alternatives;
    AITeamMove *newmove;

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

    SetNumAlternativesFlags(alternatives,9,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,LightInterceptor,12);
    SetAlternative(alternatives,1,HeavyInterceptor,7);
    SetAlternative(alternatives,2,HeavyInterceptor,7);
    SetAlternative(alternatives,3,HeavyInterceptor,7);
    SetAlternative(alternatives,4,AttackBomber,10);
    SetAlternative(alternatives,5,AttackBomber,10);
    SetAlternative(alternatives,6,AttackBomber,10);
    SetAlternative(alternatives,7,HeavyDefender,8);
    SetAlternative(alternatives,8,CloakedFighter,10);

    aimCreateFancyGetShips(team, AttackBomber, 15, &alternatives, 0, TRUE, FALSE);

    aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE);
//later put formation in aiscript
    newmove = aimCreateTempGuard(team, DELTA_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(newmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    newmove = aimCreateArmada(team, CLAW_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(newmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
/*-----------------------------------------------------------------------------
    Name        : airDumbResearchRequests
    Description : Uses the Researchers to build variable to determine of a new
                  research ship needs to be built
    Inputs      :
    Outputs     :
    Return      : Whether or not a new research ship has been requested at high priority
----------------------------------------------------------------------------*/
bool airDumbResearchRequests(bool *requestedResearch)
{
    if (aiCurrentAIPlayer->ResearchersToBuild)
    {
        sdword totalResearch = aiCurrentAIPlayer->airNumResearchShips + aiCurrentAIPlayer->NumResearchShipsBeingBuilt;

        if (totalResearch < aiCurrentAIPlayer->ResearchersToBuild)
        {
            if (aiuCanBuildShipType(ResearchShip,FALSE))
            {
                if (!totalResearch)
                {
                    aifResourceManRequestsShipsCB(ResearchShip, 1, REQUESTSHIPS_HIPRI);
                    *requestedResearch = TRUE;
                    return TRUE;
                }
                else
                {
                    aifResourceManRequestsShipsCB(ResearchShip, 1, 0);
                    *requestedResearch = TRUE;
                }
            }
        }
    }
    else
    {
        //later maybe add a bonehead move variable as well to build up to 6
        aiCurrentAIPlayer->ResearchersToBuild = randyrandombetween(RANDOM_AI_PLAYER, 1, 3);
        aiplayerLog((aiIndex, "Using Dumb Research - %i Research Ships", aiCurrentAIPlayer->ResearchersToBuild));
    }
    return FALSE;
}
Example #6
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateCorvetteStrike
    Description : Creates the moves to create and do stuff with a fighter
                  strike force
    Inputs      : team
    Outputs     : Creates a bunch'a moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateCorvetteStrike(AITeam *team)
{
    AlternativeShips alternatives;
    AITeamMove *newmove;

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

    SetNumAlternativesFlags(alternatives,7,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,LightCorvette,13);
    SetAlternative(alternatives,1,HeavyCorvette,10);
    SetAlternative(alternatives,2,HeavyCorvette,10);
    SetAlternative(alternatives,3,HeavyCorvette,10);
    SetAlternative(alternatives,4,HeavyCorvette,10);
    SetAlternative(alternatives,5,MultiGunCorvette,7);
    SetAlternative(alternatives,6,MinelayerCorvette,7);

    aimCreateFancyGetShips(team, HeavyCorvette, 9, &alternatives, 0, TRUE, FALSE);

    aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE);
//later put formation in aiscript
    newmove = aimCreateTempGuard(team, DELTA3D_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(newmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    newmove = aimCreateArmada(team, WALL_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(newmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #7
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateSlowRovingDefense
    Description : Creates a team of slowly roving ships that guard against baddies
    Inputs      : team - the team to the roving
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateSlowRovingDefense(AITeam *team)
{
    AlternativeShips alternatives;
    AITeamMove *move;

    aiplayerLog((aiIndex, "%x Issuing Slow Roving Defense Order", team));

    SetNumAlternativesFlags(alternatives,7,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,HeavyCorvette,10);
    SetAlternative(alternatives,1,HeavyCorvette,10);
    SetAlternative(alternatives,2,HeavyCorvette,10);
    SetAlternative(alternatives,3,MultiGunCorvette,10);
    SetAlternative(alternatives,4,LightCorvette,7);
    SetAlternative(alternatives,5,StandardFrigate,30);
    SetAlternative(alternatives,6,DDDFrigate,30);

    aimCreateFancyGetShips(team, MultiGunCorvette, 3, &alternatives, 0, TRUE, FALSE);
//    aimCreateFormation(team, DELTA_FORMATION, FALSE, FALSE);
    move = aimCreateActivePatrol(team, AIT_SLOW_PATROL, TRUE, FALSE);
    aieHandlerSetFuelLow(move, AIO_SLOWROVING_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetTeamDied(move, aihSlowDefenseTeamDiedHandler);
    aieHandlerSetNumbersLow(move, AIO_SLOWROVING_NUMBERS_LOW, 0, FALSE, aihSlowDefenseNumbersLowHandler);
    aieHandlerSetGettingRocked(move, FALSE, aihGenericGettingRockedHandler);
    aieHandlerSetInterrupt(move, (udword *)&(aiCurrentAIPlayer->aidDefenseTargets), 3, FALSE, aihSlowDefenseDistressHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #8
0
sdword aimProcessFormation(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;
    SelectCommand *selection = team->shipList.selection;

    dbgAssert(!thisMove->processing);

    if (team->shipList.selection->numShips == 0)
    {
        return FALSE;
    }

    if (selection->numShips > 0)
    {
        if (!aiuWrapFormation(selection,thisMove->params.formation.formationtype))
        {
            return FALSE;
        }
    }
    else
    {
        aiplayerLog((aiIndex,"Warning: no ships to put in formation"));
    }
    thisMove->processing = TRUE;

    //
    //  future enhancement:
    //  it might be nice to pay attention to the thisMove->wait flag here,
    //  and not return TRUE until the ships were actually in their formation
    //
    return TRUE;
}
Example #9
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateSpecialDefense
    Description : Creates a team to do some cloaking
    Inputs      : team - the team to do the cloaking
    Outputs     : Creates some new moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateSpecialDefense(AITeam *team, ShipType type)
{
    AITeamMove *move;
    ShipStaticInfo *gravstatics;

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

    aimCreateGetShips(team, type, 1, 0, TRUE, FALSE);

    move = aimCreateSpecialDefense(team, TRUE, FALSE);

    if (type == GravWellGenerator)
    {
        gravstatics = GetShipStaticInfo(GravWellGenerator, R1);

        if (gravstatics)
        {
            aieHandlerSetEnemyNearby(move,
                                     (((GravWellGeneratorStatics *) gravstatics->custstatinfo)->GravWellRadius)*0.8,
                                     FALSE, aihGravWellEnemyNearbyHandler);
            aieHandlerSetTeamDied(move, aihRemoveTeamDiedHandler);
        }
        else
        {
            dbgAssert(FALSE);
        }
    }

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #10
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateFastRovingDefense
    Description : Creates a team of roving ships that guard against baddies
    Inputs      : team - the team to do the roving
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateFastRovingDefense(AITeam *team)
{
    AlternativeShips alternatives;
    AITeamMove *move;

    aiplayerLog((aiIndex, "%x Issuing Fast Roving Defense Order", team));

    SetNumAlternativesFlags(alternatives,6, ALTERNATIVE_RANDOM)
    SetAlternative(alternatives,0,HeavyDefender,14);
    SetAlternative(alternatives,1,HeavyDefender,14);
    SetAlternative(alternatives,2,HeavyDefender,14);
    SetAlternative(alternatives,3,HeavyInterceptor,14);
    SetAlternative(alternatives,4,AttackBomber,15);
    SetAlternative(alternatives,5,AttackBomber,15);

    aimCreateFancyGetShips(team, LightInterceptor, 15, &alternatives, 0, TRUE, FALSE);
//    aimCreateFormation(team, WALL_FORMATION, FALSE, FALSE);
    move = aimCreateActivePatrol(team, AIT_FAST_PATROL, TRUE, FALSE);
    aieHandlerSetFuelLow(move, AIO_FASTROVING_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetTeamDied(move, aihFastDefenseTeamDiedHandler);
    aieHandlerSetNumbersLow(move, AIO_FASTROVING_NUMBERS_LOW, 0, FALSE, aihFastDefenseNumbersLowHandler);
    aieHandlerSetGettingRocked(move, FALSE, aihGenericGettingRockedHandler);
    aieHandlerSetInterrupt(move, (udword *)&(aiCurrentAIPlayer->aidDefenseTargets), 0, FALSE, aihFastDefenseDistressHandler);

//    aieHandlerSetEnemyNearby(move, 2000, FALSE, aihPatrolEnemyNearbyHandler);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #11
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateFrigateStrike
    Description : Creates the moves to create and do stuff with a fighter
                  strike force
    Inputs      : team
    Outputs     : Creates a bunch'a moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateFrigateStrike(AITeam *team)
{
    AlternativeShips alternatives;
    AITeamMove *newmove;

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

    SetNumAlternativesFlags(alternatives,1,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,IonCannonFrigate,10);
//    SetAlternative(alternatives,1,DDDFrigate,10);

    aimCreateFancyGetShips(team, StandardFrigate, 5, &alternatives, 0, TRUE, FALSE);

    aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE);
//later put formation in aiscript
    newmove = aimCreateTempGuard(team, WALL_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    newmove = aimCreateArmada(team, CLAW_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(newmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetNumbersLow(newmove, 20, 0, TRUE, aihHarassNumbersLowHandler);

    aimCreateMoveDone(team, FALSE, FALSE);

    //this team can hyperspace attack
    bitSet(team->teamFlags, TEAM_Hyperspaceable);

}
Example #12
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateSwarmSupport
    Description : Creates a team of swarmers (P2 Pirates)
    Inputs      : team - the team to do the swarming
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateSwarmSupport(AITeam *team)
{
    aiplayerLog((aiIndex, "Issuing Swarm Support Order"));

    aimCreateSwarmPod(team, TRUE, FALSE);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #13
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateResourcer
    Description : Creats the moves to have a team collect resources autonomously
    Inputs      : team - the team
    Outputs     : Creates sum moooooves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateResourcer(AITeam *team)
{
    aiplayerLog((aiIndex, "%x Issuing Resourcer Order", team));

    //assumes that ships will be added, therefore does not request them
    aimCreateActiveResource(team, TRUE, FALSE);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #14
0
//generic bandbox attack move
sdword aimProcessAttack(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;
    SelectCommand *selection = team->shipList.selection/*, *targets*/;

    if (team->shipList.selection->numShips == 0)
    {
        aiplayerLog((aiIndex,"Attack Move, Zero Sized Team"));
        return TRUE;
    }

    if (!thisMove->processing)
    {
        if ((selection->numShips > 0) && (thisMove->params.attack.ships->numShips > 0))
        {
            aiuWrapAttack(team->shipList.selection, thisMove->params.attack.ships);
//            targets = aiuWrapAttack(team, thisMove->params.attack.ships);
//            aiumemFree(targets);
            thisMove->processing = TRUE;
        }
        else
        {
            aiplayerLog((aiIndex,"Warning: no ships to attack"));
            thisMove->processing = TRUE;
        }

        return !thisMove->wait;
    }
    else
    {
        if ((selection->numShips == 0) || (thisMove->params.attack.ships->numShips == 0) ||
            (aiuShipsNoLongerAttacking(selection)))
        {
            // we're done
            memFree(thisMove->params.attack.ships);
            thisMove->params.attack.ships = NULL;

            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
}
Example #15
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateCapture
    Description : Creates a team to do some capturin'
    Inputs      : team - the team to do some capturin'
    Outputs     : Creates some new moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateCapture(AITeam *team)
{
    aiplayerLog((aiIndex, "%x Issuing Capture Order", team));

    aimCreateGetShips(team, SalCapCorvette, (sbyte)(randyrandombetween(RAN_AIPlayer, 3, 7)), 0, TRUE, FALSE);

    aimCreateActiveCapture(team, TRUE, FALSE);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #16
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateMine
    Description : Creates a team to do some minin'
    Inputs      : team - the minin' team
    Outputs     : Creates some new moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateMine(AITeam *team)
{
    aiplayerLog((aiIndex, "%x Issuing Mine Order", team));

    aimCreateGetShips(team, MinelayerCorvette, (sbyte)(randyrandombetween(RAN_AIPlayer, 2, 5)), 0, TRUE, FALSE);

    aimCreateActiveMine(team, TRUE, FALSE);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #17
0
//special move
sdword aimProcessSpecial(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;
    SelectCommand *selection = team->shipList.selection;

    if (team->shipList.selection->numShips == 0)
    {
        aiplayerLog((aiIndex,"Special Move, Zero Sized Team"));
        return TRUE;
    }

    if (!thisMove->processing)
    {
        if ((selection->numShips > 0) &&
            ((thisMove->params.attack.ships == NULL) ||
             (thisMove->params.attack.ships->numShips > 0)))
        {
            aiuWrapSpecial(team->shipList.selection, thisMove->params.attack.ships);
            thisMove->processing = TRUE;
        }
        else
        {
            aiplayerLog((aiIndex,"Warning: no ships to special stuff with"));
            thisMove->processing = TRUE;
        }

        return FALSE;
    }
    else
    {
        if ((selection->numShips == 0) ||
            (!aitTeamIsDoingSpecialOp(team)))
        {
            // we're done
            aiumemFree(thisMove->params.attack.ships);

            return TRUE;
        }
        else
        {
            return (!thisMove->wait);
        }
    }
}
Example #18
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateReconaissance
    Description : Creates a the moves for a team to do a reconaissance mission
    Inputs      : team - the team to do the reconaissancing
    Outputs     : Creates a whole bunch of moves for the team
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateReconaissance(AITeam *team, ReconType type)
{
    vector destination, origin = ORIGIN_VECTOR;
    AlternativeShips alternatives;
    AITeamMove *move;

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

    switch (type)
    {
    case RECON_MOTHERSHIP:
        //later if there's more than one enemy, need to find both of their mo'ships
        destination = aiuFindEnemyMothershipCoords(aiCurrentAIPlayer->player);
        destination = aiuGenerateRandomStandoffPoint(destination, RECON_STANDOFF_DISTANCE, origin, RSP_NEAR);

        SetNumAlternatives(alternatives, 2);
        SetAlternative(alternatives,0,CloakedFighter,10);
        SetAlternative(alternatives,1,LightInterceptor,10);

        aimCreateFancyGetShips(team, Probe, 1, &alternatives, REQUESTSHIPS_HIPRI, TRUE, FALSE);
        aimCreateMoveTeam(team, destination, NO_FORMATION, TRUE, FALSE);
        aimCreateCountShips(team, FALSE, FALSE);
        move = aimCreateActiveRecon(team, TRUE, NO_FORMATION, Evasive, TRUE, FALSE);
        aieHandlerSetFuelLow(move, 15, TRUE, TRUE, aihGenericFuelLowHandler);
        aieHandlerSetTeamDied(move, aihReconaissanceTeamDiedHandler);
        aimCreateMoveDone(team, FALSE, FALSE);
        break;

    case RECON_ACTIVE_GENERAL:
        SetNumAlternatives(alternatives, 1);
        SetAlternative(alternatives,0,CloakedFighter,10);

        aimCreateFancyGetShips(team, LightInterceptor, 1, &alternatives, REQUESTSHIPS_HIPRI, TRUE, FALSE);
        move = aimCreateActiveRecon(team, FALSE, NO_FORMATION, Evasive, TRUE, FALSE);
        aieHandlerSetFuelLow(move, 15, TRUE, TRUE, aihGenericFuelLowHandler);
        aieHandlerSetTeamDied(move, aihReconaissanceTeamDiedHandler);
        aimCreateMoveDone(team, FALSE, FALSE);
        break;

    case RECON_ACTIVE_ENEMY:
        SetNumAlternatives(alternatives, 1);
        SetAlternative(alternatives,0,CloakedFighter,10);

        aimCreateFancyGetShips(team, LightInterceptor, 1, &alternatives, REQUESTSHIPS_HIPRI, TRUE, FALSE);
        move = aimCreateActiveRecon(team, TRUE, NO_FORMATION, Evasive, TRUE, FALSE);
        aieHandlerSetFuelLow(move, 15, TRUE, TRUE, aihGenericFuelLowHandler);
        aieHandlerSetTeamDied(move, aihReconaissanceTeamDiedHandler);
        aimCreateMoveDone(team, FALSE, FALSE);
        break;

    default:
        break;
    }


}
Example #19
0
AITeamMove *aimCreateSpecialNoAdd(AITeam *team, SelectCommand *targets,TypeOfFormation formation, TacticsType tactics, bool8 wait, bool8 remove)
{
    AITeamMove *newMove = (AITeamMove *)memAlloc(sizeof(AITeamMove), "special", 0);

    InitNewMove(newMove,MOVE_SPECIAL,wait,remove,formation,tactics,aimProcessSpecial,aimSpecialShipDied,aimSpecialClose);
    newMove->params.attack.ships = targets;

    aiplayerLog((aiIndex,"Created Special Move"));

    return newMove;
}
Example #20
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateSwarmDefense
    Description : Creates a team of swarmers (P2 Pirates)
    Inputs      : team - the team to do the swarming
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateSwarmDefense(AITeam *team, SelectCommand *Pod)
{
    AITeamMove *newmove;

    aiplayerLog((aiIndex, "Issuing Swarm Defense Order"));

    newmove = aimCreateSwarmDefense(team, Pod, TRUE, FALSE);
    aieHandlerSetFuelLow(newmove, 0, TRUE, FALSE, aihSwarmerEmptyFuelHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #21
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateSwarmAttack
    Description : Creates a team of swarmers (P2 Pirates)
    Inputs      : team - the team to do the swarming
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateSwarmAttack(AITeam *team)
{
    AITeamMove *newmove;

    aiplayerLog((aiIndex, "Issuing Swarm Attack Order"));

    newmove = aimCreateSwarmAttack(team, TRUE, FALSE);
    aieHandlerSetFuelLow(newmove, 0, TRUE, FALSE, aihSwarmerEmptyFuelHandler);

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #22
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateActiveSupport
    Description : Creates the moves to get a team to support another team (i.e. AdvanceSupportFrigate and Repair Corvette)
    Inputs      : team - the team doing the supporting,
                  ships - the ships to support
                    NOTE: ships can be NULL.
    Outputs     : Creates a whole whack of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateActiveSupport(AITeam *team, SelectCommand *ships, SupportType type)
{
    AlternativeShips alternatives;

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

    if (type == SUPPORT_STRIKECRAFT)
    {
        if (!team->shipList.selection->numShips)
        {
            SetNumAlternatives(alternatives, 1);
            SetAlternative(alternatives,0,RepairCorvette,3);

            aimCreateFancyGetShips(team, AdvanceSupportFrigate, 1, &alternatives, 0, TRUE, FALSE);
        }

        aimCreateSupport(team, ships, BROAD_FORMATION, Evasive, TRUE, FALSE);
    }
    else if (type == SUPPORT_RESOURCE)
    {
        if (!team->shipList.selection->numShips)
        {
            aimCreateGetShips(team, ResourceController, 1, 0, TRUE, FALSE);
        }

        aimCreateControlResources(team, ships, TRUE, FALSE);
    }
    else if (type == SUPPORT_MOTHERSHIP)
    {
        dbgAssert(team->shipList.selection->numShips);

        aimCreateMothershipMove(team, TRUE, FALSE);
    }
    else
    {
        aiplayerLog((aiIndex, "Error - unknown support type issued"));
        dbgAssert(FALSE);
    }

    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #23
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateDefendMothership
    Description : Creates the moves for a team to defend the mothership
                  - this order is not a long term one, it is there for
                    immediate defense of the mothership when it's
                    under attack
    Inputs      : team - the team the order is meant for
                  enemy - the dirty rotten scum sucking low lifes attacking
                  the poor mothership
    Outputs     : Creates a few moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateDefendMothership(AITeam *team)
{
    AITeamMove *move;

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

    //note: ships are assigned to these teams by the defense manager
    //      so there is no getships move
    move = aimCreateDefendMothership(team, TRUE, FALSE);
    aieHandlerSetFuelLow(move, AIO_DEFMOTHERSHIP_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #24
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateGuardShips
    Description : Creates an order to get a team to guard ships
    Inputs      : team - the team that will execute the order, ships - the ships to guard
    Outputs     : Creates a whole bunch of orders
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateGuardShips(AITeam *team, SelectCommand *ships)
{
    AlternativeShips alternatives;
    sbyte numShipsToUse;
    AITeamMove *move;

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

    SetNumAlternativesFlags(alternatives,5, ALTERNATIVE_RANDOM)
//    SetAlternative(alternatives,0,DefenseFighter,10);
    SetAlternative(alternatives,0,HeavyInterceptor,15);
    SetAlternative(alternatives,1,LightInterceptor,10);
    SetAlternative(alternatives,2,LightCorvette,18);
    SetAlternative(alternatives,3,HeavyCorvette,24);
    SetAlternative(alternatives,4,MultiGunCorvette,24);

    if (aiuAnyShipsAreCapitalShips(ships))
    {
        numShipsToUse = AIO_GUARD_SHIPS_NUM_CAPITAL;
    }
    else
    {
        numShipsToUse = AIO_GUARD_SHIPS_NUM_NONCAPITAL;
    }

    aimCreateFancyGetShips(team, HeavyDefender, numShipsToUse, &alternatives, 0, TRUE, FALSE);

#if 0
    if (ships->numShips > 2)
    {
        numShipsToUse = ships->numShips * 3;
    }
    else
    {
        numShipsToUse = ships->numShips * 4;
    }
#endif
#if 0
    if (ships->numShips > 2)
    {
        aimCreateGetShips(team, HeavyDefender, 6, 0, TRUE, FALSE);
        aimCreateGetShips(team, MultiGunCorvette, (sbyte)(ships->numShips-2), 0, TRUE, FALSE);
    }
    else
        aimCreateGetShips(team, HeavyDefender, (sbyte)(ships->numShips*3), 0, TRUE, FALSE);
#endif

    aimCreateFormation(team, SPHERE_FORMATION, FALSE, FALSE);  // vary the formation?
    move = aimCreateGuardShips(team, ships, FALSE, FALSE);
    aieHandlerSetFuelLow(move, AIO_GUARD_SHIPS_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetTeamDied(move, aihGuardShipsTeamDiedHandler);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #25
0
void aioCreateTakeoutTargetsWithCurrentTeam(struct AITeam *team,SelectCommand *targets)
{
    AITeamMove *attackmove;

    dbgAssert(team->shipList.selection->numShips > 0);

    aiplayerLog((aiIndex, "%x Issuing Takeout Targets With Current Team Order", team));

    attackmove = aimCreateAttack(team, targets, AIO_TOUT_TARG_WCUR_FORMATION, /*AIO_TOUT_TARG_WCUR_TACTICS*/  TRUE, FALSE);
    aieHandlerSetGettingRocked(attackmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(attackmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #26
0
//note: this function isn't really used.
//      instead, use fast roving or slow roving defense
void aioCreatePatrol(AITeam *team, Path *path)
{
    AITeamMove *move;

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

    aimCreateGetShips(team, HeavyCorvette, 3, 0, TRUE, FALSE);
//    aimCreateFormation(team, DELTA_FORMATION, FALSE, FALSE);
    move = aimCreatePatrolMove(team, path, 0, DELTA_FORMATION, Aggressive, TRUE, FALSE);
    //create a enemynearby handler as well...
    aieHandlerSetFuelLow(move, AIO_PATROL_FUEL_LOW, TRUE, TRUE, aihGenericFuelLowHandler);
    aieHandlerSetNumbersLow(move, AIO_PATROL_NUMBERS_LOW, 3, TRUE, aihHarassNumbersLowHandler);
//    aieHandlerSetTeamDied(move, aihPatrolTeamDied);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #27
0
void aioCreateTakeoutTargetWithCurrentTeam(struct AITeam *team,Ship *ship)
{
    SelectCommand *selectone;
    AITeamMove *attackmove;

    dbgAssert(team->shipList.selection->numShips > 0);

    aiplayerLog((aiIndex, "%x Issuing Takeout Target With Current Team Order", team));

    selectone = memAlloc(sizeofSelectCommand(1),"takeoutsel",0);
    selectone->numShips = 1;
    selectone->ShipPtr[0] = ship;

    attackmove = aimCreateAttack(team,selectone, AIO_TOUT_TARG_WCUR_FORMATION, /*AIO_TOUT_TARG_WCUR_TACTICS*/ TRUE, FALSE);
    aieHandlerSetGettingRocked(attackmove, TRUE, aihGenericGettingRockedHandler);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #28
0
void aioCreateTakeoutMothershipFast(struct AITeam *team,Ship *mothership)
{
    AlternativeShips alternatives;
//    SelectCommand *selectone;
    AITeamMove *attackmove;

    aiplayerLog((aiIndex, "%x Issuing Takeout Mothership Fast Order", team));

    SetNumAlternativesFlags(alternatives,11,ALTERNATIVE_RANDOM);
    SetAlternative(alternatives,0,IonCannonFrigate,10);
    SetAlternative(alternatives,1,IonCannonFrigate,10);
    SetAlternative(alternatives,2,IonCannonFrigate,10);
    SetAlternative(alternatives,3,IonCannonFrigate,30);
    SetAlternative(alternatives,4,MissileDestroyer,30);
    SetAlternative(alternatives,5,StandardDestroyer,30);
    SetAlternative(alternatives,6,StandardFrigate,10);
    SetAlternative(alternatives,7,StandardFrigate,10);
    SetAlternative(alternatives,8,MinelayerCorvette,7);
    SetAlternative(alternatives,9,HeavyCorvette,3);
    SetAlternative(alternatives,10,MultiGunCorvette,3);

    aimCreateFancyGetShips(team, IonCannonFrigate, 3, &alternatives, 0, TRUE, FALSE);

    aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE);
//    aimCreateVarWait(team, aiCurrentAIPlayer->attackVarLabel, -1, TRUE, FALSE);
    aimCreateTempGuard(team, AIO_TOUT_MSHIP_FAST_TGRD_FORMATION, AIO_TOUT_MSHIP_FAST_TGRD_TACTICS, TRUE, FALSE);

    // aimCreateRequestGuardTeam();

//    selectone = memAlloc(sizeofSelectCommand(1),"takeoutsel",0);
//    selectone->numShips = 1;
//    selectone->ShipPtr[0] = mothership;
//    attackmove = aimCreateFlankAttack(team, selectone, FALSE, TRUE, FALSE);
    attackmove = aimCreateArmada(team, BROAD_FORMATION, Aggressive, TRUE, FALSE);
    aieHandlerSetGettingRocked(attackmove, TRUE, aihGenericGettingRockedHandler);
    aieHandlerSetFuelLow(attackmove, 15, TRUE, TRUE, aihGenericFuelLowHandler);

    aimCreateMoveDone(team, FALSE, FALSE);

    //this team can hyperspace attack
    bitSet(team->teamFlags, TEAM_Hyperspaceable);
}
Example #29
0
/*-----------------------------------------------------------------------------
    Name        : aioCreateReinforcements
    Description : Creates the moves to get the team to reinforce the other team
    Inputs      : team - the team that will be reinforcing,
                  reinforceteam - the team to reinforce
                  shiptype - the type of ships to reinforce with
                  num - the number of ships to reinforce with
                    NOTE: if num == 0, the team is considered to already have ships
                          and none are requested
                  alternatives - alternative ships for reinforcement
                    NOTE: if alternatives == NULL, no alternatives are requested
                  priority - the priority of the build request
    Outputs     : Creates a bunch of moves
    Return      : void
----------------------------------------------------------------------------*/
void aioCreateReinforcements(AITeam *team, AITeam *reinforceteam, ShipType shiptype,
                             sbyte num, AlternativeShips *alternatives, sdword priority)
{
    aiplayerLog((aiIndex, "%x Issuing Reinforcements Order", team));

    if (num)
    {
        if (alternatives)
        {
            aimCreateFancyGetShips(team, shiptype, num, alternatives, priority, TRUE, FALSE);
        }
        else
        {
            aimCreateGetShips(team, shiptype, num, priority, TRUE, FALSE);
        }
    }

    aimCreateReinforce(team, reinforceteam, BROAD_FORMATION, Evasive, TRUE, FALSE);
    aimCreateMoveDone(team, FALSE, FALSE);
}
Example #30
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);
}