Example #1
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 #2
0
/*-----------------------------------------------------------------------------
    Name        : aihGravWellEnemyNotNearbyHandler
    Description : Turns off the grav well generator no more enemy ships are nearby
    Inputs      : team - the grav well generator team
    Outputs     : Turns off the special ability of the gravwell generator
    Return      : void
----------------------------------------------------------------------------*/
void aihGravWellEnemyNotNearbyHandler(AITeam *team)
{
    AITeamMove *thisMove = team->curMove;

    aiuWrapSpecial(team->shipList.selection, NULL);
    thisMove->events.enemyNotNearby.handler = NULL;
    aieHandlerSetEnemyNearby(thisMove,
                             (((GravWellGeneratorStatics *) ((ShipStaticInfo *)(team->shipList.selection->ShipPtr[0]->staticinfo))->custstatinfo)->GravWellRadius)*0.8,
                             FALSE, aihGravWellEnemyNearbyHandler);
    //later cancel attack move on cooperating team???
}