示例#1
0
 private static Aircraft NewAircraftForTraining()
 {
     if (!suspendedTargetDowned)
     {
         return(Aircrafts.Cloud());
     }
     else if (rand.Next(Constants.TRAINING_LAUNCH_PROBABILITTY) != 1)
     {
         return(Aircrafts.Cloud());
     }
     else if (allAircraftsInGame < Constants.TRAINING_IL28_AT_THE_START)
     {
         return(Aircrafts.targetTugs[Constants.TRAINING_IL28_INDEX]);
     }
     else if (allAircraftsInGame < Constants.TRAINING_M16K_AT_THE_START)
     {
         return(Aircrafts.targetPlane[Constants.TRAINING_M16K_INDEX]);
     }
     else
     {
         return(Aircrafts.targetDrones[rand.Next(Aircrafts.targetDrones.Count)]);
     }
 }
示例#2
0
        public static void Start(object obj, ElapsedEventArgs e)
        {
            int aircraftCategory = rand.Next(1, 17);

            if (Shilka.school)
            {
                aircraftCategory = AircraftCategoryForSchool(aircraftCategory, allAircraftsInGame);
            }

            int dice;

            Aircraft newAircraft;

            if (Shilka.training)
            {
                newAircraft = NewAircraftForTraining();
            }
            else
            {
                switch (aircraftCategory)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                default:

                    if (Shilka.currentScript == Scripts.ScriptsNames.Vietnam)
                    {
                        goto case 5;
                    }

                    newAircraft = Aircrafts.Cloud();
                    break;

                case 5:
                case 6:
                case 7:
                case 8:
                case 9:

                    if ((Scripts.scriptAircraft != null) && (Scripts.scriptAircraft.Length == 0))
                    {
                        goto case 1;
                    }

                    do
                    {
                        dice = rand.Next(Aircrafts.aircraft.Count);
                    }while (!InList(Scripts.scriptAircraft, dice));

                    string aircraftType = Aircrafts.aircraft[dice].aircraftType;

                    if ((Shilka.currentScript == Scripts.ScriptsNames.F117Hunt) && (aircraftType != "f117"))
                    {
                        goto case 1;
                    }

                    if (Weather.currentWeather != Weather.WeatherTypes.good && Aircrafts.aircraft[dice].doesNotFlyInBadWeather)
                    {
                        goto case 9;
                    }

                    if (Shilka.currentScript == Scripts.ScriptsNames.Khmeimim)
                    {
                        goto case 10;
                    }

                    if ((Shilka.currentScript != Scripts.ScriptsNames.Rust) && (aircraftType == "cessna"))
                    {
                        goto case 5;
                    }

                    if ((Shilka.currentScript == Scripts.ScriptsNames.Rust) && (aircraftType != "cessna"))
                    {
                        goto case 15;
                    }

                    newAircraft = Aircrafts.aircraft[dice];

                    break;

                case 10:
                case 11:
                case 12:

                    if ((Scripts.scriptHelicopters != null) && (Scripts.scriptHelicopters.Length == 0))
                    {
                        goto case 5;
                    }

                    if (Shilka.currentScript != Scripts.ScriptsNames.Khmeimim)
                    {
                        do
                        {
                            dice = rand.Next(Aircrafts.helicopters.Count);
                        }while (!InList(Scripts.scriptHelicopters, dice));

                        newAircraft = Aircrafts.helicopters[dice];

                        break;
                    }
                    else
                    {
                        SwarmLaunch();

                        return;
                    }

                case 13:

                    if ((Scripts.scriptAircraftFriend != null) && (Scripts.scriptAircraftFriend.Length == 0))
                    {
                        goto case 1;
                    }

                    do
                    {
                        dice = rand.Next(Aircrafts.aircraftFriend.Count);
                    }while (!InList(Scripts.scriptAircraftFriend, dice));

                    newAircraft = Aircrafts.aircraftFriend[dice];

                    break;

                case 14:

                    if ((Scripts.scriptHelicoptersFriend != null) && (Scripts.scriptHelicoptersFriend.Length == 0))
                    {
                        goto case 13;
                    }

                    do
                    {
                        dice = rand.Next(Aircrafts.helicoptersFriend.Count);
                    }while (!InList(Scripts.scriptHelicoptersFriend, dice));

                    newAircraft = Aircrafts.helicoptersFriend[dice];

                    break;

                case 15:

                    if (Shilka.currentScript == Scripts.ScriptsNames.Vietnam)
                    {
                        goto case 5;
                    }

                    if ((Scripts.scriptAirliners != null) && (Scripts.scriptAirliners.Length == 0))
                    {
                        goto case 1;
                    }

                    do
                    {
                        dice = rand.Next(Aircrafts.airliners.Count);
                    }while (!InList(Scripts.scriptAirliners, dice));

                    newAircraft = Aircrafts.airliners[dice];

                    break;

                case 16:

                    if (
                        Shilka.currentScript != Scripts.ScriptsNames.noScript
                        &&
                        Shilka.currentScript != Scripts.ScriptsNames.KoreanBoeing
                        )
                    {
                        goto case 10;
                    }

                    dice = rand.Next(Aircrafts.aerostat.Count);

                    newAircraft = Aircrafts.aerostat[dice];

                    break;
                }
            }

            newAircraft.Launch();
        }