public void Add(int dungeonLevel, Monster monster)
        {
            /* Find a monster index. */
            int index = eidx[dungeonLevel];

            /* Paranoia. */
            if (index == -1)
                Error.Die("Could not create the initial monster population");

            eidx[dungeonLevel] = (byte)monsterSlots[dungeonLevel, index].Midx;

            monsterSlots[dungeonLevel, index] = monster;
        }
Exemple #2
0
        /// <summary>
        /// Create an initial monster population for a given level.
        /// </summary>
        internal void CreatePopulation()
        {
            byte m;

            /* Initialize the basic monster data. */
            InitializeMonsters();

            for (m = 0; m < Config.InitialMonsterNumber; m++)
            {
                /* Create a new monster. */
                var type = RandomMonsterType();
                var monster = new Monster(type, GetMonsterCoordinates());
                All.Add(_dungeon.TheComplex.DungeonLevel, monster);
            }
        }
        public MonsterCollection()
        {
            for (int i = 0; i < Config.MaxDungeonLevel; i++)
            {
                /* The first empty monster slot. */
                eidx[i] = 0;

                /* Initially all slots are empty. */
                for (int j = 0; j < Config.MonstersPerLevel - 1; j++)
                    monsterSlots[i, j] = new Monster { Used = false, Midx = j + 1 };

                /* The last one points to 'no more slots'. */
                monsterSlots[i, Config.MonstersPerLevel - 1] = new Monster { Midx = -1, Used = false };
            }
        }