Ejemplo n.º 1
0
        public Room(int srH, int srW, int srX, int srY, 
                    Room_Type rType, Tile.Tile_Type fType, 
                    bool doors, bool columns)
        {
            roomHeight = srH;
            roomWidth = srW;
            startXPos = srX;
            startYPos = srY;
            has_doors = doors;
            doors_always_locked = false;
            c_room_type = rType;
            if (c_room_type == Room_Type.GenericCircular)
                calculate_circular_matrix(roomWidth);
            c_floor_type = fType;
            rGen = new Random();
            c_column_type = Column_Pattern.None;
            allow_random_spawns = true;
            if (columns)
            {
                //These are always present
                List<Column_Pattern> col_patterns = new List<Column_Pattern> { Column_Pattern.Four_Corners,
                                                                               Column_Pattern.Center_Pillar };
                //If the room is big enough, we add a couple more.
                if (roomHeight >= 7)
                    col_patterns.Add(Column_Pattern.Vertical_Rows);
                if (roomWidth >= 7)
                    col_patterns.Add(Column_Pattern.Horizontal_Rows);
                //Then we pick a random one.
                c_column_type = col_patterns[rGen.Next(col_patterns.Count)];
            }

            room_tiles = new List<string>();
            hallway_anchors = new List<gridCoordinate>();
            doodad_list = new List<KeyValuePair<Doodad.Doodad_Type, gridCoordinate>>();
            monster_list = new List<KeyValuePair<string, gridCoordinate>>();
            monster_family_list = new List<KeyValuePair<string, gridCoordinate>>();
            bonus_gold = 0;

            hallway_anchors.Add(new gridCoordinate(roomWidth / 2, roomHeight / 2));
            boss_spawn_coordinates = new List<gridCoordinate>();
        }
Ejemplo n.º 2
0
        public Room(RoomDC base_room, Spawn_Table_Manager sManager)
        {
            roomHeight = base_room.RoomHeight;
            roomWidth = base_room.RoomWidth;
            gridCoordinate room_coord = grid_c_from_matrix_c(base_room.Coordinate);
            startXPos = room_coord.x;
            startYPos = room_coord.y;
            has_doors = base_room.RoomDoors;
            doors_always_locked = base_room.DoorsLocked;
            rGen = new Random();
            allow_random_spawns = base_room.AllowRandomSpawn;

            //Necropolis only.
            corpses_in_corner = false;
            corners_that_have_corpses = 0;

            //More general purpose stuff
            c_room_type = Room_Type.Generic;
            c_floor_type = Tile.Tile_Type.StoneFloor;
            c_column_type = Column_Pattern.None;

            room_tiles = base_room.Room_Matrix;
            hallway_anchors = new List<gridCoordinate>();
            boss_spawn_coordinates = new List<gridCoordinate>();
            doodad_list = new List<KeyValuePair<Doodad.Doodad_Type, gridCoordinate>>();
            monster_list = new List<KeyValuePair<string, gridCoordinate>>();
            monster_family_list = new List<KeyValuePair<string, gridCoordinate>>();
            bonus_gold = base_room.RoomGold;
            allow_overlap = base_room.AllowOverlap;

            switch (base_room.RoomType)
            {
                case "Specific":
                    c_room_type = Room_Type.Specific;
                    break;
                case "Gorehound Kennels":
                    c_room_type = Room.Room_Type.GHound_Kennel;
                    break;
                case "Library":
                    c_room_type = Room.Room_Type.Library;
                    break;
                case "Darkroom":
                    c_room_type = Room.Room_Type.DarkRoom;
                    break;
                case "Corpse Storage":
                    c_room_type = Room.Room_Type.CorpseStorage;
                    break;
                case "Sewer":
                    c_room_type = Room.Room_Type.SewerRoom;
                    break;
                case "Rubble Room":
                    c_room_type = Room.Room_Type.Destroyed;
                    break;
                case "Knight Armory":
                    c_room_type = Room.Room_Type.KnightArmory;
                    break;
                case "Sewer Shaft":
                    c_room_type = Room.Room_Type.SewerShaft;
                    break;
                case "Jail":
                    c_room_type = Room.Room_Type.Jail;
                    break;
                case "Mine Shaft":
                    c_room_type = Room.Room_Type.MineShaft;
                    break;
            }
            //Add hallway anchors
            List<string> raw_anchors = base_room.Room_Hallway_Anchors;
            if (raw_anchors.Count == 0)
                hallway_anchors.Add(new gridCoordinate(roomWidth / 2, roomHeight / 2));
            else
                for (int i = 0; i < raw_anchors.Count; i++)
                    if(raw_anchors[i].Length > 0) //prevent from passing ""
                        hallway_anchors.Add(grid_c_from_matrix_c(raw_anchors[i]));

            //Now to add the appropriate list of monsters & doodads
            //Doodads first.
            for (int i = 0; i < base_room.Room_Doodads.Count; i++)
            {
                Doodad.Doodad_Type c_doodad_type = 0; //Altar by default - not a problem.
                switch (base_room.Room_Doodads[i])
                {
                    case "Altar":
                        c_doodad_type = Doodad.Doodad_Type.Altar;
                        break;
                    case "ArmorSuit":
                        c_doodad_type = Doodad.Doodad_Type.ArmorSuit;
                        break;
                    case "BloodSplatter":
                        c_doodad_type = Doodad.Doodad_Type.Blood_Splatter;
                        break;
                    case "Cage":
                        c_doodad_type = Doodad.Doodad_Type.Cage;
                        break;
                    case "CorpsePile":
                        c_doodad_type = Doodad.Doodad_Type.CorpsePile;
                        break;
                    case "DestroyedArmorSuit":
                        c_doodad_type = Doodad.Doodad_Type.Destroyed_ArmorSuit;
                        break;
                    case "Bookshelf":
                        c_doodad_type = Doodad.Doodad_Type.Bookshelf;
                        break;
                    case "DestroyedBookshelf":
                        c_doodad_type = Doodad.Doodad_Type.Destroyed_Bookshelf;
                        break;
                    case "Ironbar_Door":
                        c_doodad_type = Doodad.Doodad_Type.Iron_Door;
                        break;
                    case "Ironbar_Wall":
                        c_doodad_type = Doodad.Doodad_Type.Ironbar_Wall;
                        break;
                    case "NadirBed":
                        c_doodad_type = Doodad.Doodad_Type.NadirBed;
                        break;
                    case "NadirColumn":
                        c_doodad_type = Doodad.Doodad_Type.NadirColumn;
                        break;
                    case "ArcheryTarget":
                        c_doodad_type = Doodad.Doodad_Type.ArcheryTarget;
                        break;
                    case "Desk":
                        c_doodad_type = Doodad.Doodad_Type.Desk;
                        break;
                    case "Hedgehog":
                        c_doodad_type = Doodad.Doodad_Type.Hedgehog;
                        break;
                    case "NadirDoor":
                        c_doodad_type = Doodad.Doodad_Type.NadirDoor;
                        break;

                }
                gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Doodad_Coordinates[i]);
                int doodad_chance = 0;
                Int32.TryParse(base_room.Room_Doodad_Chances[i], out doodad_chance);
                if(rGen.Next(100) < doodad_chance)
                    doodad_list.Add(new KeyValuePair<Doodad.Doodad_Type,gridCoordinate>(c_doodad_type, c_grid_coord));
            }
            //Then monsters by family.
            for (int i = 0; i < base_room.Monster_Families.Count; i++)
            {
                int monster_family_chance = 0;
                Int32.TryParse(base_room.Monster_Family_Chances[i], out monster_family_chance);
                gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Monster_Family_Coordinates[i]);
                if (rGen.Next(100) < monster_family_chance)
                    monster_family_list.Add(new KeyValuePair<string, gridCoordinate>(base_room.Monster_Families[i], c_grid_coord));
            }

            //Then monsters by themselves.
            for (int i = 0; i < base_room.Room_Monsters.Count; i++)
            {
                int monster_chance = 0;
                Int32.TryParse(base_room.Room_Monster_Chances[i], out monster_chance);
                gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Monster_Coordinates[i]);
                if (rGen.Next(100) < monster_chance)
                    monster_list.Add(new KeyValuePair<string, gridCoordinate>(base_room.Room_Monsters[i], c_grid_coord));
            }

            boss_spawn_coordinates = new List<gridCoordinate>();
            for (int i = 0; i < base_room.Boss_Spawn_Coordinates.Count; i++)
                boss_spawn_coordinates.Add(grid_c_from_matrix_c(base_room.Boss_Spawn_Coordinates[i]));
        }