Пример #1
0
        public FloorBuilder(ref Spawn_Table_Manager s_manager,
                            ref List<List<Tile>> map, ref List<Monster> mons, 
                            ref List<Doodad> doods, ref List<Goldpile> dollars,
                            ref List<Fl_Special_Event> floor_events,
                            ContentManager cm, Texture2D blank_tex, Random rGen)
        {
            //Items from the floor itself
            floorTiles = map;
            badguys = mons;
            props = doods;
            money = dollars;
            spawn_manager = s_manager;
            events = floor_events;

            //Other stuff
            cManager = cm;
            blank_texture = blank_tex;
            randGen = rGen;
            current_floorsize = standard_floorsize;
            entranceplaced = false;
            exitPlaced = false;

            //Lists
            roomlayout = new List<Room>();
            halllayout = new List<Hall>();
            mosslayout = new List<MossyPatch>();
            featurelayout = new List<NaturalFeature>();

            general_texture_map = new List<KeyValuePair<Tile.Tile_Type, gridCoordinate>>();
            dungeon_texture_map = new List<KeyValuePair<Tile.Tile_Type, gridCoordinate>>();
            moss_texture_map = new List<KeyValuePair<Tile.Tile_Type, gridCoordinate>>();
        }
Пример #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]));
        }
Пример #3
0
        public void render_monsters_to_board(ref List<Monster> fl_monsters, 
                                             ref List<Doodad> fl_doodads,
                                             Spawn_Table_Manager spawn_manager,
                                             ContentManager cmgr,
                                             Texture2D blank_texture, FloorBuilder flb)
        {
            List<KeyValuePair<string, gridCoordinate>> final_monster_list = new List<KeyValuePair<string,gridCoordinate>>();
            //Put all monsters onto the final spawning list, with the exception of Schrodingers_hk, which is spawned immediately.
            for (int i = 0; i < monster_list.Count; i++)
            {
                string monster_name = monster_list[i].Key;
                gridCoordinate monster_coord = monster_list[i].Value;
                gridCoordinate new_monster_coord = new gridCoordinate(monster_coord.x + startXPos,
                                                                      monster_coord.y + startYPos);
                if (flb.is_tile_obstructed(new_monster_coord))
                    new_monster_coord = null;

                if (String.Compare(monster_name, "Schrodingers_HK") != 0)
                    final_monster_list.Add(new KeyValuePair<string, gridCoordinate>(monster_name, new_monster_coord));
                else
                {
                    //If the spawn table comes up hollow knight, add it with a normal chance to spawn a red knight
                    //Otherwise add a suit of armor.
                    if (spawn_manager.roll_to_spawn_family(Monster.Monster_Family.SpiritKnight))
                        spawn_manager.place_monster_from_family(Monster.Monster_Family.SpiritKnight, ref fl_monsters, blank_texture,
                                                                new_monster_coord, flb);
                    else
                        if(new_monster_coord != null && !flb.is_tile_obstructed(new_monster_coord))
                            fl_doodads.Add(new Doodad(Doodad.Doodad_Type.ArmorSuit, cmgr, new_monster_coord, fl_doodads.Count));
                }
            }

            //Spawn all monsters placed by family.
            for (int i = 0; i < monster_family_list.Count; i++)
            {
                //Place at perscribed spot
                gridCoordinate new_monster_coord = new gridCoordinate(monster_family_list[i].Value.x + startXPos,
                                                                      monster_family_list[i].Value.y + startYPos);
                //Unless said spot is blocked - then find a new, random position for the monster. This will occur automatically
                //upon a null coordinate being passed.
                if (flb.is_tile_obstructed(new_monster_coord))
                    new_monster_coord = null;

                if (spawn_manager.family_in_table(monster_family_list[i].Key))
                    spawn_manager.place_monster_from_family(monster_family_list[i].Key, ref fl_monsters, blank_texture,
                                                            new_monster_coord, flb);
            }

            //Spawn all monsters
            for (int i = 0; i < final_monster_list.Count; i++)
            {
                spawn_manager.place_specific_monster_byString(final_monster_list[i].Key, ref fl_monsters, blank_texture,
                                                              final_monster_list[i].Value, flb);
            }
        }