示例#1
0
        private void PlaceMonsters()
        {
            foreach (var room in _map.Rooms)
            {
                // Each room has a 60% chance of having monsters
                if (Dice.Roll("1D10") < 7)
                {
                    // Generate between 1 and 4 monsters
                    var numberOfMonsters = Dice.Roll("1D4");
                    for (int i = 0; i < numberOfMonsters; i++)
                    {
                        // Find a random walkable location in the room to place the monster
                        Point randomRoomLocation = _map.GetRandomWalkableLocationInRoom(room);
                        // It's possible that the room doesn't have space to place a monster
                        // In that case skip creating the monster
                        if (randomRoomLocation != null)
                        {
                            // Temporarily hard code this monster to be created at level 1
                            var kobold = Kobold.Create(1);
                            kobold.X = randomRoomLocation.X;
                            kobold.Y = randomRoomLocation.Y;
                            _map.AddMonster(kobold);

                            var goblin = Goblin.Create(2);
                            goblin.X = randomRoomLocation.X;
                            goblin.Y = randomRoomLocation.Y;
                            _map.AddMonster(goblin);
                        }
                    }
                }
            }
        }
示例#2
0
        public void OrderGiftDirectlyAtGoblin_ReturnFunctionEatHomeworkForDoll()
        {
            var goblin = new Goblin();
            var child  = ChildList[0];
            var order  = new GiftOrder(child, typeof(Doll), GiftColor.Black);

            Assert.Equal("Christmas.GiftStrategy.EatHomework", goblin.Create(order).Function.ToString());
        }
示例#3
0
        public static Monster CreateMonster(int level, Point location)
        {
            Pool <Monster> monsterPool = new Pool <Monster>();

            monsterPool.Add(Kobold.Create(level), 25);
            monsterPool.Add(Ooze.Create(level), 25);
            monsterPool.Add(Goblin.Create(level), 50);

            Monster monster = monsterPool.Get();

            monster.X = location.X;
            monster.Y = location.Y;

            return(monster);
        }
示例#4
0
 private void PlaceMonsters()
 {
     foreach (var room in room.Rooms)
     {
         if (Dice.Roll("1D10") < 7)
         {
             var numberOfMonsters = Dice.Roll("1D4");
             for (int i = 0; i < numberOfMonsters; i++)
             {
                 Point randomRoomLocation = this.room.GetRandomWalkableCell(room);
                 if (randomRoomLocation != null)
                 {
                     var monster = Goblin.Create(Game.mapLevel);
                     monster.X = randomRoomLocation.X;
                     monster.Y = randomRoomLocation.Y;
                     this.room.AddMonster(monster);
                 }
             }
         }
     }
 }
示例#5
0
        // Places monsters all over the dungeon level
        // Change later so monsters don't spawn in spawn room? or at least not on first level?
        private void PlaceMonsters()
        {
            foreach (var room in _map.Rooms)
            {
                // Each room has a 60% chance of having monsters
                if (Dice.Roll("1D10") < 7)
                {
                    // Generate between 1 and 4 monsters
                    var numberOfMonsters = Dice.Roll("1D4");
                    for (int i = 0; i < numberOfMonsters; i++)
                    {
                        // Find a random walkable location in the room to place the monster
                        Point randomRoomLocation = _map.GetRandomWalkableLocationInRoom(room);
                        // It's possible that the room doesn't have space to place a monster
                        // In that case skip creating the monster
                        if (randomRoomLocation != null)
                        {
                            var typeOfMonster = Dice.Roll("2D10");
                            var monster       = new Monster();
                            if (typeOfMonster <= 10)
                            {
                                monster = Kobold.Create(_mapLevel);
                            }
                            else if (typeOfMonster > 12)
                            {
                                monster = Goblin.Create(_mapLevel);
                            }
                            else if (typeOfMonster > 10 && typeOfMonster <= 12)
                            {
                                monster = Mimic.Create(_mapLevel);
                            }// Add more monsters later

                            monster.X = randomRoomLocation.X;
                            monster.Y = randomRoomLocation.Y;
                            _map.AddMonster(monster);
                        }
                    }
                }
            }
        }
        public static Monster CreateMonster(int level, Point location)
        {
            Pool <Monster> monsterPool = new Pool <Monster>();

            if (level <= 2)
            {
                monsterPool.Add(Rat.Create(level), 20);
                monsterPool.Add(Lichen.Create(level), 30);
                monsterPool.Add(Jackal.Create(level), 25);
                monsterPool.Add(Kobold.Create(level), 25);
            }
            else if (level <= 4)
            {
                monsterPool.Add(Lichen.Create(level), 15);
                monsterPool.Add(Rat.Create(level), 16);
                monsterPool.Add(Jackal.Create(level), 25);
                monsterPool.Add(Kobold.Create(level), 25);
                monsterPool.Add(Goblin.Create(level), 15);
                monsterPool.Add(Sludge.Create(level), 3);
                monsterPool.Add(Wolf.Create(level), 1);
            }
            else if (level <= 6)
            {
                monsterPool.Add(Jackal.Create(level), 5);
                monsterPool.Add(Wolf.Create(level), 10);
                monsterPool.Add(Kobold.Create(level), 15);
                monsterPool.Add(Goblin.Create(level), 30);
                monsterPool.Add(Sludge.Create(level), 25);
                monsterPool.Add(Gnoll.Create(level), 5);
                monsterPool.Add(Viper.Create(level), 10);
            }
            else if (level <= 8)
            {
                monsterPool.Add(Goblin.Create(level), 8);
                monsterPool.Add(Slime.Create(level), 15);
                monsterPool.Add(Viper.Create(level), 8);
                monsterPool.Add(Wolf.Create(level), 20);
                monsterPool.Add(Gnoll.Create(level), 25);
                monsterPool.Add(LizardMan.Create(level), 10);
                monsterPool.Add(Werewolf.Create(level), 4);
            }
            else if (level <= 10)
            {
                monsterPool.Add(Ogre.Create(level), 10);
                monsterPool.Add(Gnoll.Create(level), 10);
                monsterPool.Add(Werewolf.Create(level), 20);
                monsterPool.Add(LizardMan.Create(level), 30);
                monsterPool.Add(Orc.Create(level), 20);
                monsterPool.Add(Dragon.Create(level), 10);
            }
            else
            {
                monsterPool.Add(Werewolf.Create(level), 20);
                monsterPool.Add(Ogre.Create(level), 20);
                monsterPool.Add(LizardMan.Create(level), 20);
                monsterPool.Add(Orc.Create(level), 20);
                monsterPool.Add(Dragon.Create(level), 30);
            }

            Monster monster = monsterPool.Get();

            monster.X = location.X;
            monster.Y = location.Y;

            return(monster);
        }