Example #1
0
        public bool GameRound()
        {
            var gameLevelAtBeginningOfRound = Level;

            _gameRound++;
            Notify($"Starting round {_gameRound}");

            // Player Phase: Run through all of the living Survivors to execute their turns ...
            foreach (var survivor in Survivors.Where(s => s.IsAlive))
            {
                survivor.ProcessTurn();
                RecordAnyGameLevelChange(gameLevelAtBeginningOfRound);
            }

            // Zombie Phase: zombies attack and/or move

            if (IsEndOfGame)
            {
                Notify($"The game has ended, all Survivors died. The game lasted {_gameRound} rounds");
                return(false);
            }

            if (IsMissionAccomplished)
            {
                Notify($"The Survivors have achieved their objective! They won the game in {_gameRound} rounds");
                return(false);
            }

            // End Phase: cancel all Noise

            return(true);
        }
Example #2
0
 public Frontend()
 {
     Generator.UpdateStatus += PrintStatusReport;
     afterlife = AfterLife.GetInstance();
     survivors = Survivors.GetInstance();
     read      = new ReadFromFile();
 }
Example #3
0
        public Game(int startingChoice, Killer killer)
        {
            Survivors     = Enumerable.Range(0, 4).Select(s => new Survivor(killer.Rank)).Where(s => s.Status != Status.Nonexistent).ToArray();
            GensRemaining = 5 - (4 - Survivors.Length);
            GameOver      = !Survivors.Any() || Survivors.All(s => s.Status == Status.DCed);
            Killer        = killer;

            int saltModifier = Utils.RANDOM.Next(5, 10) * (4 - Survivors.Count(s => s.Status != Status.DCed));

            switch (killer.Name)
            {
            case KillerName.Doctor:
                saltModifier += Utils.RANDOM.Next(10, 20);
                break;

            case KillerName.Nightmare:
                saltModifier += Utils.RANDOM.Next(5, 30);
                break;

            case KillerName.Nurse:
                saltModifier += Utils.RANDOM.Next(0, 15);
                break;
            }

            for (int i = 0; i < Survivors.Length; ++i)
            {
                Survivors[i].Saltiness += saltModifier;
            }
        }
Example #4
0
    public void update()
    {
        if (roundStarted)
        {
            roundStart = roundStart + 1;
            if (roundStart > 300 && objects.Count > 0)
            {
                var rand = objects[r.Next(objects.Count)];
                API.setEntityTransparency(rand, 100);
                API.sleep(2000);
                API.deleteEntity(rand);
                objects.Remove(rand);
                roundStart = 0;
            }

            for (int i = Survivors.Count - 1; i >= 0; i--)
            {
                if (API.getEntityPosition(Survivors[i].handle).Z < 327f)
                {
                    API.setPlayerHealth(Survivors[i], -1);
                    Survivors.Remove(Survivors[i]);
                }
            }
        }
    }
Example #5
0
        private Survivors TryCreateEvent(Survivors survivors)
        {
            Survivors currentEvent = null;

            if (_survivors.FindIndex((Survivors s) => s.GetType() == survivors.GetType()) <= -1)
            {
                currentEvent = survivors;
            }
            return(currentEvent);
        }
        public void AddSurvivor(Survivor survivor)
        {
            if (Survivors.Any(s => s.Name == survivor.Name))
            {
                return;
            }

            Survivors.Add(survivor);
            History.LogEvent(new HistoryEvent(survivor.Name, nameof(Survivor), "ADDED_TO_GAME"));
        }
Example #7
0
 void Start()
 {
     instance = this;
     SpawnSurvivors();
     ActivateSurvivor(survivors[activeSurvivorIndex]);
     if (!spawnSpot)
     {
         Debug.LogError("Assign a spawn spot for suvivors.");
     }
 }
        private Survivors TryCreateEvent(Survivors survivors)
        {
            Survivors survivors1 = (Survivors)null;

            if (this._survivors.FindIndex((Predicate <Survivors>)(s => Type.op_Equality(s.GetType(), survivors.GetType()))) <= -1)
            {
                survivors1 = survivors;
            }
            return(survivors1);
        }
Example #9
0
 public Generator()
 {
     fileName   = "KrankenhausReport.txt";
     queue      = new Queue();
     afterlife  = AfterLife.GetInstance();
     ticker     = new Ticker();
     sanatorium = new Sanatorium();
     iva        = new IVA();
     survivors  = Survivors.GetInstance();
     frontend   = new Frontend();
     logger     = new Logger();
 }
Example #10
0
        void Update()
        {
            while (true)
            {
                if (Player.ActionObject != null && Player.ActionObject.Type == Interest.GENERATOR)
                {
                    repairUI.Visible = true;
                    eventUI.Height   = Console.WindowHeight - 5;
                }
                else
                {
                    repairUI.Visible = false;
                    repairUI.Clear();
                    eventUI.Height = Console.WindowHeight - 2;
                }

                if (!ExitGatesPowered && !AllSurvivorsEscaped && !AllSurvivorsDead)
                {
                    if (Survivors.Concat(new[] { Player }).All(x => x.HealthState == HealthState.HOOKED || x.HealthState == HealthState.DEAD))
                    {
                        AllSurvivorsDead = true;
                        Game.Current.AddHistory("The ^red:KILLER$ wins the trial for the ^blue:ENTITY$");
                    }

                    if (Trial.GetRooms().Count(x => x.Objects.Any(x => x.Type == Interest.GENERATOR) && ((Generator)x.Objects.Find(x => x.Type == Interest.GENERATOR)).Progress == 100) == 5)
                    {
                        ExitGatesPowered = true;
                        Game.Current.AddHistory("^blue:The_EXIT_GATES_are_POWERED.$ ^red:ECAPE!$");
                    }
                }

                //var foundConnectorsInRoom = Player.Room.Connectors.Values.ToList().FindAll(x => x.Found);
                //var foundObjectsInRoom = Player.Room.Objects.FindAll(x => x.Found);

                //if(foundConnectorsInRoom.Count > 0 || foundObjectsInRoom.Count > 0)
                //{
                minimapUI.Visible = true;
                //} else
                //{
                //    minimapUI.Visible = false;
                //    minimapUI.Clear();
                //}

                Brain.All.ForEach(brain => brain.Update());
                UIManager.Update();

                Thread.Sleep(100);
            }
        }
Example #11
0
        public bool AddSurvivorToGame(Survivor newSurvivor)
        {
            var retVal          = false;
            var newSurvivorName = newSurvivor.Name;

            if (!Survivors.Any(s => s.Name.Equals(newSurvivorName)))
            {
                newSurvivor.Notifier = _notifier;
                Survivors.Add(newSurvivor);
                Notify($"Survivor {newSurvivor.Name} was added to the game");

                retVal = true;
            }

            return(retVal);
        }
Example #12
0
        private void OnCreatedSurvivors()
        {
            bool rand = Database.Random.NextDouble() <= (double)_survivorSpawnChance;

            EventTypes[] values       = (EventTypes[])Enum.GetValues(typeof(EventTypes));
            EventTypes   type         = values[Database.Random.Next(values.Length)];
            Survivors    currentEvent = null;

            switch (type)
            {
            case EventTypes.Friendly:
            {
                FriendlySurvivors friendly = new FriendlySurvivors();
                currentEvent = TryCreateEvent(friendly);
                break;
            }

            case EventTypes.Hostile:
                if (Database.Random.NextDouble() <= 0.20000000298023224)
                {
                    HostileSurvivors hostile = new HostileSurvivors();
                    currentEvent = TryCreateEvent(hostile);
                }
                break;

            case EventTypes.Merryweather:
            {
                MerryweatherSurvivors merry = new MerryweatherSurvivors(_merryweatherTimeout);
                currentEvent = TryCreateEvent(merry);
                break;
            }
            }
            if (currentEvent != null)
            {
                _survivors.Add(currentEvent);
                currentEvent.SpawnEntities();
                currentEvent.Completed += delegate(Survivors survivors)
                {
                    SetDelayTime();
                    survivors.CleanUp();
                    _survivors.Remove(survivors);
                };
            }
        }
Example #13
0
        private void DoRepair()
        {
            while (Progress < 100 && Survivors.Count > 0)
            {
                Progress++;

                Thread.Sleep(500);
            }

            if (Progress == 100)
            {
                foreach (var survivor in Survivors)
                {
                    survivor.ActionObject = null;
                }
                Survivors.Clear();

                Game.Current.AddHistory("A ^green:GENERATOR$ has been repaired");
            }

            RepairThread = null;
        }
        private void OnCreatedSurvivors()
        {
            bool flag = Database.Random.NextDouble() <= (double)this._survivorSpawnChance;

            EventTypes[] values     = (EventTypes[])Enum.GetValues(typeof(EventTypes));
            EventTypes   eventTypes = values[Database.Random.Next(values.Length)];
            Survivors    survivors1 = (Survivors)null;

            switch (eventTypes)
            {
            case EventTypes.Friendly:
                survivors1 = this.TryCreateEvent((Survivors) new FriendlySurvivors());
                break;

            case EventTypes.Hostile:
                if (Database.Random.NextDouble() <= 0.200000002980232)
                {
                    survivors1 = this.TryCreateEvent((Survivors) new HostileSurvivors());
                    break;
                }
                break;

            case EventTypes.Merryweather:
                survivors1 = this.TryCreateEvent((Survivors) new MerryweatherSurvivors(this._merryweatherTimeout));
                break;
            }
            if (survivors1 == null)
            {
                return;
            }
            this._survivors.Add(survivors1);
            survivors1.SpawnEntities();
            survivors1.Completed += (Survivors.SurvivorCompletedEvent)(survivors =>
            {
                this.SetDelayTime();
                survivors.CleanUp();
                this._survivors.Remove(survivors);
            });
        }
Example #15
0
    public void respawn(Client player)
    {
        if (!roundStarted)
        {
            return;
        }
        Survivors.Remove(player);

        if (Survivors.Count == 1)
        {
            var winner = Survivors[0];
            API.sendNotificationToAll("~b~~h~" + winner.name + "~h~ ~w~has won! Restarting round in 15 seconds...");
            foreach (var c in API.getAllPlayers())
            {
                API.unspectatePlayer(c);
            }
            roundStarted = false;

            API.sleep(15000);
            createFallingPanels();
        }
        else if (Survivors.Count == 0)
        {
            API.sendNotificationToAll("No winners! Restarting round in 15 seconds...");
            foreach (var c in API.getAllPlayers())
            {
                API.unspectatePlayer(c);
            }

            roundStarted = false;
            API.sleep(15000);
            createFallingPanels();
        }
        else
        {
            API.setPlayerToSpectator(player);
        }
    }
Example #16
0
        public bool Repair(Survivor survivor)
        {
            if (Survivors.Contains(survivor))
            {
                return(false);
            }
            if (Progress == 100)
            {
                return(false);
            }

            Survivors.Add(survivor);
            if (RepairThread == null)
            {
                var thread = new Thread(new ThreadStart(DoRepair));
                thread.IsBackground = true;
                thread.Start();
            }

            LastUsed       = DateTime.Now;
            HasBeenTouched = true;

            return(true);
        }
Example #17
0
 public void killed(Client player, NetHandle killer, int reason)
 {
     Survivors.Remove(player);
 }
Example #18
0
 public void StopRepair(Survivor survivor)
 {
     Survivors.Remove(survivor);
 }
 public void SetGameLevel()
 {
     this.CurrentLevel = Survivors.OrderByDescending(s => s.Experience)
                         .Where(s => s.Status != "DEAD")
                         .FirstOrDefault().CurrentLevel;
 }