public BaseAttackShipControl(App game, TacticalObjective to, CombatAI commanderAI)
     : base(game, to, commanderAI)
 {
     this.m_ClearTargetsUpdate    = 0;
     this.m_UpdateTargetSelection = 0;
     this.m_CanMerge = false;
 }
Beispiel #2
0
 public TaskGroup(App game, CombatAI commandAI)
 {
     this.m_Game                   = game;
     this.m_CommanderAI            = commandAI;
     this.m_Objective              = (TacticalObjective)null;
     this.m_Orders                 = TaskGroupOrders.None;
     this.m_Type                   = TaskGroupType.Aggressive;
     this.m_bIsPlayerOrder         = false;
     this.m_bIsInContactWithEnemy  = false;
     this.m_EnemyGroupInContact    = (EnemyGroup)null;
     this.m_Ships                  = new List <Ship>();
     this.m_Targets                = new List <Ship>();
     this.m_ShipControls           = new List <TaskGroupShipControl>();
     this.m_TargetGroup            = (EnemyGroup)null;
     this.m_TargetTaskGroup        = (TaskGroup)null;
     this.m_PatrolType             = PatrolType.Circular;
     this.m_RequestedObjectiveType = ObjectiveType.NO_OBJECTIVE;
     this.m_NumShipTypes           = new int[14];
     for (int index = 0; index < 14; ++index)
     {
         this.m_NumShipTypes[index] = 0;
     }
     this.m_GroupSpeed = 0.0f;
     this.m_RequestRefreshShipControls = false;
     this.m_ChangeAttackTime           = 4800;
     this.m_CurrentChangeAttackDelay   = this.m_ChangeAttackTime;
 }
Beispiel #3
0
        public override void Update(List <IGameObject> objs)
        {
            base.Update(objs);
            if (this.m_IsPirateBase)
            {
                return;
            }
            this.m_BoardingPodControls = this.m_ShipWeaponControls.OfType <BoardingPodLaunchControl>().ToList <BoardingPodLaunchControl>();
            this.m_DroneControls       = this.m_ShipWeaponControls.OfType <DroneLaunchControl>().ToList <DroneLaunchControl>();
            foreach (BoardingPodLaunchControl boardingPodControl in this.m_BoardingPodControls)
            {
                if (boardingPodControl.ControlledShip != null)
                {
                    if (boardingPodControl.ControlledShip.Target is Ship)
                    {
                        Ship target = boardingPodControl.ControlledShip.Target as Ship;
                        boardingPodControl.DisableWeaponFire = target.ShipRole != ShipRole.FREIGHTER;
                    }
                    else
                    {
                        boardingPodControl.DisableWeaponFire = true;
                    }
                }
            }
            foreach (DroneLaunchControl droneControl in this.m_DroneControls)
            {
                if (droneControl.ControlledShip != null)
                {
                    if (droneControl.ControlledShip.Target is Ship)
                    {
                        Ship target = droneControl.ControlledShip.Target as Ship;
                        droneControl.DisableWeaponFire = target.ShipRole == ShipRole.FREIGHTER && this.m_BoardingPodControls.Count > 0;
                    }
                    else
                    {
                        droneControl.DisableWeaponFire = true;
                    }
                }
            }
            bool flag = this.m_Enemy.Any <Ship>((Func <Ship, bool>)(x => x.ShipRole == ShipRole.FREIGHTER));

            if (this.m_bEnemyShipsInSystem && flag)
            {
                return;
            }
            foreach (TaskGroup taskGroup in this.m_TaskGroups)
            {
                if (!(taskGroup.Objective is RetreatObjective))
                {
                    TacticalObjective retreatObjective1 = this.GetRetreatObjective(taskGroup);
                    if (retreatObjective1 is RetreatObjective)
                    {
                        RetreatObjective retreatObjective2 = retreatObjective1 as RetreatObjective;
                        retreatObjective2.ResetRetreatPosition(taskGroup);
                        taskGroup.Objective = (TacticalObjective)retreatObjective2;
                    }
                }
            }
        }
 public RetreatShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     bool useRetreatPos)
     : base(game, to, commanderAI)
 {
     this.m_Type          = ShipControlType.Retreat;
     this.m_UseRetreatPos = useRetreatPos;
 }
 public ScoutTrailShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     ScoutShipControl scoutShip)
     : base(game, to, commanderAI)
 {
     this.m_Type      = ShipControlType.ScoutTrail;
     this.m_ScoutShip = scoutShip;
 }
Beispiel #6
0
 public SurroundShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     Vector3 attackVector,
     float minDist,
     float desiredDist)
     : base(game, to, commanderAI, minDist, desiredDist)
 {
     this.m_Type      = ShipControlType.Surround;
     this.m_AttackVec = attackVector;
 }
Beispiel #7
0
 public FlyByShipControl(App game, TacticalObjective to, CombatAI commanderAI, float distPast)
     : base(game, to, commanderAI)
 {
     this.m_Type             = ShipControlType.Flyby;
     this.m_DistancePast     = distPast;
     this.m_CurrentDistPast  = 0.0f;
     this.m_HoldDuration     = FlyByShipControl.kHoldDuration;
     this.m_AttackMatrix     = Matrix.Identity;
     this.m_InitialPass      = true;
     this.m_CurrentHoldDelay = this.m_CommanderAI.AIRandom.NextInclusive(FlyByShipControl.kHoldDuration - 20, FlyByShipControl.kHoldDuration + 20);
     this.m_StuckDelay       = FlyByShipControl.kStuckDuration;
     this.m_PrevPos          = Vector3.Zero;
 }
 public TaskGroupShipControl(App game, TacticalObjective to, CombatAI commanderAI)
 {
     this.m_Game                         = game;
     this.m_CommanderAI                  = commanderAI;
     this.m_Type                         = ShipControlType.None;
     this.m_Ships                        = new List <Ship>();
     this.m_TaskGroupObjective           = to;
     this.m_Formation                    = new ShipFormation(game);
     this.m_Formation.BackLineOffsetDist = 500f;
     this.m_SensorRange                  = game.AssetDatabase.DefaultTacSensorRange;
     this.m_CanMerge                     = true;
     this.m_GroupPriorityTarget          = (Ship)null;
 }
Beispiel #9
0
 public FlankShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     Vector3 attackVector,
     float minDist,
     float desiredDist)
     : base(game, to, commanderAI, attackVector, minDist, desiredDist)
 {
     this.m_Type = ShipControlType.Flank;
     this.m_CurrentFlankPosition = Vector3.Zero;
     this.m_FlankDriveDir        = Vector3.UnitZ;
     this.m_InFlankPosition      = false;
 }
Beispiel #10
0
 public PursueShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     float pursueRange)
     : base(game, to, commanderAI)
 {
     this.m_Type              = ShipControlType.Pursue;
     this.m_PursueRange       = pursueRange;
     this.m_DoFlyBy           = false;
     this.m_PrevEnemyPosition = Vector3.Zero;
     this.m_FlyByPosition     = Vector3.Zero;
     this.m_MinFlyByDelay     = PursueShipControl.kMinFlyByDelay;
     this.m_PrevFlyByDistSq   = 0.0f;
 }
Beispiel #11
0
 public StandOffShipControl(
     App game,
     TacticalObjective to,
     CombatAI commanderAI,
     float minDist,
     float desiredDist)
     : base(game, to, commanderAI)
 {
     this.m_Type                = ShipControlType.StandOff;
     this.m_StandOffState       = StandOffShipControl.StandoffState.MoveToTargetPosition;
     this.m_MinStandOffDist     = minDist;
     this.m_DesiredStandOffDist = desiredDist;
     this.m_MoveFromInsideDir   = -Vector3.UnitZ;
     this.m_UseStoredDir        = false;
 }
Beispiel #12
0
 public void NotifyAllRidersDocked(Ship carrier)
 {
     if (this.m_CommanderAI.GetAIType() != OverallAIType.SLAVER)
     {
         return;
     }
     if (carrier.WeaponBanks.Any <WeaponBank>((Func <WeaponBank, bool>)(x => x.TurretClass == WeaponEnums.TurretClasses.AssaultShuttle)))
     {
         carrier.SetCombatStance(CombatStance.RETREAT);
         foreach (SpecWeaponControl specWeaponControl in carrier.WeaponControls.OfType <AssaultShuttleLaunchControl>().ToList <AssaultShuttleLaunchControl>())
         {
             specWeaponControl.DisableWeaponFire = true;
         }
         carrier.TaskGroup = (TaskGroup)null;
     }
     if (this.m_Ships.Any <Ship>((Func <Ship, bool>)(x => x.WeaponBanks.Any <WeaponBank>((Func <WeaponBank, bool>)(y => y.TurretClass == WeaponEnums.TurretClasses.AssaultShuttle)))))
     {
         return;
     }
     this.m_Objective = (TacticalObjective)null;
     this.m_RequestedObjectiveType = ObjectiveType.RETREAT;
 }
Beispiel #13
0
 public AttackPlanetShipControl(App game, TacticalObjective to, CombatAI commanderAI)
     : base(game, to, commanderAI)
 {
 }