예제 #1
0
        void StartRound(List <Player> players)
        {
            TimeSpan duration = Map.Config.RoundTime;

            Map.Message("This round will last for &a" + duration.Shorten(true, true));
            RoundEnd = DateTime.UtcNow.Add(duration);

            Player[] online = PlayerInfo.Online.Items;
            foreach (Player p in online)
            {
                if (p.level != Map || p.Game.Referee)
                {
                    continue;
                }
                Alive.Add(p);
            }
            Infected.Clear();

            Random rnd   = new Random();
            Player first = null;

            do
            {
                first = QueuedZombie != null?PlayerInfo.FindExact(QueuedZombie) : players[rnd.Next(players.Count)];

                QueuedZombie = null;
            } while (first == null || first.level != Map);

            Map.Message("&c" + first.DisplayName + " &Sstarted the infection!");
            InfectPlayer(first, null);
        }
예제 #2
0
        //Adds stats of the new Entity to the Lists
        public void AddEntity(int[] stats, string[] traits)
        {
            ID.Add(next_ID);
            Alive.Add(next_ID);


            Str.Add(stats[0]);
            Agi.Add(stats[1]);
            Int.Add(stats[2]);

            //Behaviour.Add(traits);
            Behaviour.Add(traits);

            ////selects the corresponding Behaviour
            switch (traits[1])
            {
            case "Friendly": Friendlies.Add(next_ID); break;

            case "Hostile": Hostiles.Add(next_ID); break;

            case "Neutral": Neutrals.Add(next_ID); break;

            default: Console.WriteLine("Error, assuming Neutral"); Neutrals.Add(next_ID); break;
            }

            switch (traits[2])
            {
            case "Melee": AttackDamage.Add(stats[0] + stats[1]); break;

            case "Ranged": AttackDamage.Add(stats[1] + stats[2]); break;
            }

            next_ID++;
        }
예제 #3
0
        void DoRound()
        {
            if (!Running)
            {
                return;
            }
            List <Player> players = DoRoundCountdown();

            if (players == null)
            {
                return;
            }
            RoundInProgress = true;
            Random random = new Random();
            Player first  = PickFirstZombie(random, players);

            CurLevel.ChatLevel(first.color + first.name + " %Sstarted the infection!");
            first.Game.Infected = true;
            PlayerMoneyChanged(first);
            UpdatePlayerColor(first, InfectCol);

            RoundInProgress = true;
            int    roundMins = random.Next(CurLevel.MinRoundTime, CurLevel.MaxRoundTime);
            string suffix    = roundMins == 1 ? " %Sminute!" : " %Sminutes!";

            CurLevel.ChatLevel("The round will last for &a" + roundMins + suffix);
            RoundEnd       = DateTime.UtcNow.AddMinutes(roundMins);
            timer          = new System.Timers.Timer(roundMins * 60 * 1000);
            timer.Elapsed += new ElapsedEventHandler(EndRound);
            timer.Enabled  = true;

            Player[] online = PlayerInfo.Online.Items;
            foreach (Player p in online)
            {
                if (p.level == null || p.level != CurLevel || p.Game.Referee)
                {
                    continue;
                }
                if (p != first)
                {
                    Alive.Add(p);
                }
            }

            Infected.Clear();
            Infected.Add(first);
            UpdateAllPlayerStatus();
            DoCoreGame(random);

            if (!Running)
            {
                Status = ZombieGameStatus.LastRound; return;
            }
            else
            {
                HandOutRewards();
            }
        }
예제 #4
0
 public void DisinfectPlayer(Player p)
 {
     if (!RoundInProgress || p == null)
     {
         return;
     }
     Infected.Remove(p);
     Alive.Add(p);
     ResetPlayerState(p, false);
 }
예제 #5
0
        void DoRound()
        {
            if (!Running)
            {
                return;
            }
            List <Player> players = DoRoundCountdown();

            if (players == null)
            {
                return;
            }
            Random random = new Random();

            RoundInProgress = true;
            int    roundMins = random.Next(CurLevel.MinRoundTime, CurLevel.MaxRoundTime);
            string suffix    = roundMins == 1 ? " %Sminute!" : " %Sminutes!";

            CurLevel.ChatLevel("This round will last for &a" + roundMins + suffix);
            RoundEnd = DateTime.UtcNow.AddMinutes(roundMins);

            Player[] online = PlayerInfo.Online.Items;
            foreach (Player p in online)
            {
                if (p.level == null || p.level != CurLevel || p.Game.Referee)
                {
                    continue;
                }
                Alive.Add(p);
            }
            Infected.Clear();

            Player first = PickFirstZombie(random, players);

            CurLevel.ChatLevel("&c" + first.DisplayName + " %Sstarted the infection!");
            InfectPlayer(first, null);

            DoCoreGame(random);
            if (!Running)
            {
                Status = ZombieGameStatus.LastRound; return;
            }

            EndRound();
            if (RecentMaps.Count > 20)
            {
                RecentMaps.RemoveAt(0);
            }
            RecentMaps.Add(CurLevelName);
        }
예제 #6
0
        public void DisinfectPlayer(Player p)
        {
            if (!RoundInProgress || p == null)
            {
                return;
            }
            Infected.Remove(p);
            Alive.Add(p);

            p.Game.Infected = false;
            UpdatePlayerColor(p, p.color);
            UpdateAllPlayerStatus();
            PlayerMoneyChanged(p);
        }