Exemple #1
0
        public void PackTurn()
        {
            //bridge rule
            List <Pack> bridge_keepers = new List <Pack>();

            foreach (Bridge b in dungeon.bridges)
            {
                uint cap = (b.Capacity(dungeon)) / 2;
                if (cap < b.CountCreatures())
                {
                    //find dichtsbijzijnde pack
                    Pack a = dungeon.find_closest_pack(b);
                    if (a != null && !a.alert)
                    {
                        bridge_keepers.Add(a);
                        a.moveTowards(b, player.location);
                    }
                }
            }

            //turns off all packs.
            foreach (Pack p in dungeon.alivePacks.ToList())
            {
                int l = RandomGenerator.rnd.Next(100);
                if (p.alert && !p.location.contested)
                {
                    Console.WriteLine("Pack " + p.id + " is alert and moves from " + p.location.id + " towards " + player.location.id);
                    p.moveTowards(player.location, player.location);
                }

                //50pct kans dat wil pack chillen
                else if (l > 50 && !bridge_keepers.Contains(p))
                {
                    p.move(p.getRandomValidNeighbour(dungeon), player.location);
                }

                //tijd om te knokken?
                Node current_location = p.location;
                if (p.members.Count > 0 && current_location == player.location)
                {
                    //vechtennnn!!!
                    Console.WriteLine("A wild pack appeared!");
                    current_location.contested = true;
                    player.alert_packs(current_location);
                }
            }
        }