/*----------------------------------------------------------------------------- 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; } }
/*----------------------------------------------------------------------------- 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); }
/*----------------------------------------------------------------------------- Name : aioCreateReconHarass Description : Creates the moves for a team to do a recon/harass mission Inputs : team - the team to do the recon/harassing Outputs : Creates a whole bunch of moves for the team Return : void ----------------------------------------------------------------------------*/ void aioCreateReconHarass(AITeam *team) { vector destination, origin = {0,0,0}; AITeamMove *move; AlternativeShips alternatives; aiplayerLog((aiIndex, "%x Issuing Recon Harass Order", team)); bitSet(team->teamFlags, HARASS_TEAM); destination = aiuFindEnemyMothershipCoords(aiCurrentAIPlayer->player); destination = aiuFindRangeStandoffPoint(destination, origin, HARASS_STANDOFF_DISTANCE); SetNumAlternatives(alternatives,2); SetAlternative(alternatives,0,HeavyInterceptor,HARASS_HEAVYINT_EQUIVNUM); SetAlternative(alternatives,1,AttackBomber,HARASS_BOMBER_EQUIVNUM); aimCreateFancyGetShips(team, LightInterceptor, HARASS_LIGHTINT_INITNUM, &alternatives, 0, 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); aimCreateCountShips(team, FALSE, FALSE); // 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); }
void aioCreateTakeoutMothershipHuge(struct AITeam *team,Ship *mothership) { AlternativeShips guardalternatives; AlternativeShips alternatives; AITeam *secondaryteam; // SelectCommand *selectone; AIVar *Var0; AIVar *Var1; char label[AIVAR_LABEL_MAX_LENGTH+1]; AITeamMove *move; aiplayerLog((aiIndex, "%x Issuing Takeout Mothership Huge Order", team)); secondaryteam = aitCreate(team->teamType); secondaryteam->cooperatingTeam = team; Var0 = aivarCreate(aivarLabelGenerate(label)); aivarValueSet(Var0, 0); Var1 = aivarCreate(aivarLabelGenerate(label)); aivarValueSet(Var1, 0); SetNumAlternativesFlags(guardalternatives,6,ALTERNATIVE_RANDOM); SetAlternative(guardalternatives,0,HeavyInterceptor,10); SetAlternative(guardalternatives,1,DefenseFighter,10); SetAlternative(guardalternatives,2,LightCorvette,15); SetAlternative(guardalternatives,3,HeavyCorvette,20); SetAlternative(guardalternatives,4,MultiGunCorvette,25); // SetAlternative(guardalternatives,5,DFGFrigate,50); // SetAlternative(guardalternatives,6,DDDFrigate,50); SetAlternative(guardalternatives,5,MissileDestroyer,100); aimCreateFancyGetShips(secondaryteam, HeavyDefender, (sbyte)10, &guardalternatives, 0, TRUE, FALSE); aimCreateVarSet(secondaryteam, aivarLabelGet(Var1), TRUE, FALSE, FALSE); move = aimCreateVarWait(secondaryteam, aivarLabelGet(Var0), TRUE, TRUE, FALSE); aieHandlerSetTeamDied(move, aihRemoveTeamDiedHandler); aimCreateVarDestroy(secondaryteam, aivarLabelGet(Var0), FALSE, FALSE); aimCreateFormation(secondaryteam, SPHERE_FORMATION, FALSE, FALSE); move = aimCreateGuardCooperatingTeam(secondaryteam, FALSE, FALSE); aieHandlerSetFuelLow(move, 15, TRUE, TRUE, aihGenericFuelLowHandler); aimCreateMoveDone(secondaryteam, FALSE, FALSE); SetNumAlternatives(alternatives,0); aimCreateFancyGetShips(team, HeavyCruiser, 1, &alternatives, 0, TRUE, FALSE); aimCreateVarSet(team, aivarLabelGet(Var0), TRUE, FALSE, FALSE); move = aimCreateVarWait(team, aivarLabelGet(Var1), TRUE, TRUE, FALSE); aieHandlerSetTeamDied(move, aihRemoveTeamDiedHandler); aimCreateVarDestroy(team, aivarLabelGet(Var1), FALSE, FALSE); aimCreateVarDec(team, aiCurrentAIPlayer->attackVarLabel, TRUE, FALSE); // aimCreateVarWait(team, aiCurrentAIPlayer->attackVarLabel, -1, TRUE, FALSE); aimCreateTempGuard(team, NO_FORMATION, AIO_TOUT_MSHIP_GUARD_TGRD_TACTICS, TRUE, FALSE); aimCreateArmada(team, NO_FORMATION, Aggressive, TRUE, FALSE); aimCreateMoveDone(team, FALSE, FALSE); //this team can hyperspace attack bitSet(team->teamFlags, TEAM_Hyperspaceable); }
/*----------------------------------------------------------------------------- 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); }