Esempio n. 1
0
 public void LootEquipment(Survivor survivor, List <Equipment> equipmentSeed)
 {
     if (survivor.Equipped.Count() < 2)
     {
         survivor.Equipped.Add(equipmentSeed.First());
         History.Add("Picked up equipment");
     }
     else if (survivor.InReserve.Count() < 3)
     {
         survivor.InReserve.Add(equipmentSeed.First());
         History.Add("Picked up equipment");
     }
 }
Esempio n. 2
0
        public void Fight(Survivor survivor)
        {
            //Kill Zombies
            survivor.Experience += RandomGen.Next(0, 5);

            //Take Wounds
            int woundCount = RandomGen.Next(0, 1);

            if (woundCount != 0)
            {
                survivor.Wounds += woundCount;
                History.Add("Survivor is wounded");
            }
        }
Esempio n. 3
0
        public void DeathCheck(Survivor survivor, List <Survivor> survivorList)
        {
            if (survivor.Wounds >= 2)
            {
                survivor.Alive = false;
                survivorList.Remove(survivor);
                History.Add("Survivor died");
            }

            //
            if (!survivorList.Any(x => x.Alive == false))
            {
                History.Add("All survivors dead");
            }
        }
Esempio n. 4
0
 public void CalculateLevel(Survivor survivor)
 {
     if (survivor.Experience > 6)
     {
         survivor.Level = 2;
         History.Add("Leveled Up");
     }
     if (survivor.Experience > 18)
     {
         survivor.Level = 2;
         History.Add("Leveled Up");
     }
     if (survivor.Experience > 42)
     {
         survivor.Level = 3;
         History.Add("Leveled Up");
     }
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //Seed initial Survivor
            var survivor1 = new Survivor {
                Name = "Jeff Probst"
            };
            var survivorList = new List <Survivor>();

            survivorList.Add(survivor1);

            var game = new Game();


            //Seed equipment
            var equipmentSeed = new List <Equipment>();
            var equipment1    = new Equipment {
                Name = "Machete"
            };
            var equipment2 = new Equipment {
                Name = "Pistol"
            };
            var equipment3 = new Equipment {
                Name = "Hatchet"
            };

            equipmentSeed.Add(equipment1);
            equipmentSeed.Add(equipment2);
            equipmentSeed.Add(equipment3);

            //Seed Survivor
            var survivorSeed = new List <Survivor>();
            var survivor2    = new Survivor {
                Name = "Dwayne"
            };
            var survivor3 = new Survivor {
                Name = "Bill"
            };
            var survivor4 = new Survivor {
                Name = "John"
            };

            survivorSeed.Add(survivor2);
            survivorSeed.Add(survivor3);
            survivorSeed.Add(survivor4);



            //Gameplay Loop
            while (survivorList.Exists(x => x.Alive == true))
            {
                foreach (Survivor survivor in survivorList.ToList())
                {
                    while (survivor.Actions > 0 && survivor.Alive == true)
                    {
                        game.Fight(survivor);
                        game.DeathCheck(survivor, survivorList);

                        if (survivor.Alive == true)
                        {
                            game.CalculateLevel(survivor);
                            game.LootEquipment(survivor, equipmentSeed);
                            survivor.Actions -= 1;
                            game.CalculateGameLevel(survivorList, game);
                        }

                        survivorList.Add(survivorSeed.FirstOrDefault());
                    }
                }
            }
        }