Esempio n. 1
0
        private void Spawn(ManagerHelper mH)
        {
            allies = mH.GetNPCManager().GetAllies(affiliation);
            int aT  = mH.GetRandom().Next(3, 6);
            var ass = (Assault)mH.GetGametype();

            if (spawnCounter > spawnTime && allies.Count < mH.GetGametype().GetPopCap())
            {
                if (aT != 3 && aT != 6)
                {
                    if (affiliation == ass.GetAttacker())
                    {
                        aT = 5;
                    }
                    else
                    {
                        aT = 4;
                    }
                }

                mH.GetGametype().Spawn(mH, affiliation, mH.GetSpawnHelper().Spawn(affiliation), aT);

                spawnCounter = 0;
            }
            else
            {
                spawnCounter += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
            }
        }
Esempio n. 2
0
        private void Spawn(ManagerHelper mH)
        {
            allies = mH.GetNPCManager().GetAllies(affiliation);

            if (spawnCounter > spawnTime && allies.Count < mH.GetGametype().GetPopCap())
            {
                mH.GetGametype()
                .Spawn(mH, affiliation, mH.GetSpawnHelper().Spawn(affiliation), mH.GetRandom().Next(6, 9));

                spawnCounter = 0;
            }

            else
            {
                spawnCounter += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
            }
        }
Esempio n. 3
0
        public override bool Update(ManagerHelper mH)
        {
            if (GetIfAllPlayersAreDead(mH) && redCommanderHasSpawned)
            {
                gameEndTimer = -1;
            }

            if ((int)gameEndTimer % 30 == 0)
            {
                if (!hasAppliedModifier)
                {
                    survivalPointModifier++;
                    suicideSpawnModifier++;
                    UpdateScoreSurvival(mH);

                    hasAppliedModifier = true;
                }
            }
            else
            {
                hasAppliedModifier = false;
            }

            #region Spawns

            if (mH.GetNPCManager().GetAllies(NPC.AffliationTypes.black).Count <= NUM_SUICIDES && counter > spawnSecs)
            {
                mH.GetNPCManager().Add(new Suicide(mH.GetSpawnHelper().SpawnSucideDots(), mH));

                counter    = 0;
                spawnSecs -= mH.GetGameTime().ElapsedGameTime.TotalSeconds;
            }

            //Update spent time
            counter += mH.GetGameTime().ElapsedGameTime.TotalSeconds;

            #endregion

            foreach (Claimable c in claimables)
            {
                c.Update(mH);
            }

            return(base.Update(mH));
        }
Esempio n. 4
0
        public virtual bool Update(ManagerHelper mH)
        {
            #region Spawning Commanders

            int counter = 0;
            foreach (var commander in commanders)
            {
                if (mH.GetNPCManager().GetCommander(commander.Key) == null)
                {
                    if (spawnsCounters[counter] > spawnTime)
                    {
                        SpawnCommander(mH, commander.Key, commander.Value, mH.GetSpawnHelper().Spawn(commander.Value));

                        spawnsCounters[counter] = 0;
                    }
                    else
                    {
                        spawnsCounters[counter] += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
                    }
                }

                counter++;
            }

            #endregion

            if (winScore != -1)
            {
                if (GetWinner() != NPC.AffliationTypes.same)
                {
                    return(true);
                }
            }

            if (gameEndTimer < 0)
            {
                return(true);
            }

            gameEndTimer -= mH.GetGameTime().ElapsedGameTime.TotalSeconds;

            return(false);
        }
Esempio n. 5
0
        public override bool Update(ManagerHelper mH)
        {
            foreach (ConquestBase b in bases)
            {
                b.Update(mH);
            }

            if (teams.Contains(NPC.AffliationTypes.red))
            {
                ChangeScoreAbsolute(NPC.AffliationTypes.red, GetNumAlliedBases(NPC.AffliationTypes.red));
            }
            if (teams.Contains(NPC.AffliationTypes.blue))
            {
                ChangeScoreAbsolute(NPC.AffliationTypes.blue, GetNumAlliedBases(NPC.AffliationTypes.blue));
            }
            if (teams.Contains(NPC.AffliationTypes.green))
            {
                ChangeScoreAbsolute(NPC.AffliationTypes.green, GetNumAlliedBases(NPC.AffliationTypes.green));
            }
            if (teams.Contains(NPC.AffliationTypes.yellow))
            {
                ChangeScoreAbsolute(NPC.AffliationTypes.yellow, GetNumAlliedBases(NPC.AffliationTypes.yellow));
            }

            //Spawn Section
            if (counter > spawnSecs)
            {
                counter = 0;

                foreach (ConquestBase b in bases)
                {
                    if (b.affiliation != NPC.AffliationTypes.grey)
                    {
                        Spawn(mH, b.affiliation,
                              mH.GetSpawnHelper().Spawn(b.affiliation, (GetNumAlliedBases(b.affiliation) == 0)),
                              mH.GetRandom().Next(3));
                    }
                }
            }
            else
            {
                counter += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
            }

            #region base code slightly modified

            #region Spawning Commanders

            for (int i = 0; i < commanders.Count; i++)
            {
                if (mH.GetNPCManager().GetCommander(commanders.Keys.ElementAt(i)) == null)
                {
                    if (spawnsCounters[i] > spawnTime && (!HasSomeoneWon() || GetWinner() == commanders.Values.ElementAt(i)))
                    {
                        if (commanders.Keys.ElementAt(i) == typeof(RedCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new RedCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i)));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(BlueCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new BlueCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i)));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(GreenCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new GreenCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i)));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(YellowCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new YellowCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i)));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(RedPlayerCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new RedPlayerCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i), mH));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(BluePlayerCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new BluePlayerCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i), mH));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(GreenPlayerCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new GreenPlayerCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i), mH));
                            spawnsCounters[i] = 0;
                        }
                        else if (commanders.Keys.ElementAt(i) == typeof(YellowPlayerCommander))
                        {
                            mH.GetNPCManager()
                            .Add(
                                new YellowPlayerCommander(
                                    mH.GetSpawnHelper()
                                    .Spawn(commanders.Values.ElementAt(i),
                                           (GetNumAlliedBases(commanders.Values.ElementAt(i)) == 0)),
                                    commanders.Values.ElementAt(i), mH));
                            spawnsCounters[i] = 0;
                        }
                    }
                    else
                    {
                        spawnsCounters[i] += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
                    }
                }
            }

            #endregion

            if (gameEndTimer < 0)
            {
                return(true);
            }

            var tryGetWinner = GetWinner();

            if (tryGetWinner != NPC.AffliationTypes.same)
            {
                foreach (KeyValuePair <Type, NPC.AffliationTypes> commander in commanders)
                {
                    if (commander.Value != tryGetWinner)
                    {
                        if (mH.GetNPCManager().GetCommander(commander.Key) != null)
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }

            gameEndTimer -= mH.GetGameTime().ElapsedGameTime.TotalSeconds;

            return(false);

            #endregion
        }