Beispiel #1
0
        public bool is_doodad_within(Floor fl, int radius, Doodad.Doodad_Type target_doodad)
        {
            int doodad_index = 0;

            while (fl.Doodad_by_index(doodad_index) != null)
            {
                Doodad d = fl.Doodad_by_index(doodad_index);
                if (d.get_my_doodad_type() == target_doodad)
                {
                    gridCoordinate doodad_gcoord = d.get_g_coord();
                    for (int i = 0; i < my_grid_coords.Count; i++)
                    {
                        if (doodad_gcoord.x >= (my_grid_coords[i].x - radius) &&
                            doodad_gcoord.x <= (my_grid_coords[i].x + radius) &&
                            doodad_gcoord.y >= (my_grid_coords[i].y - radius) &&
                            doodad_gcoord.y <= (my_grid_coords[i].y + radius))
                        {
                            return(true);
                        }
                    }
                }
                doodad_index++;
            }

            return(false);
        }
Beispiel #2
0
        public Room(RoomDC base_room, SpawnTable sTable)
        {
            roomHeight = base_room.RoomHeight;
            roomWidth  = base_room.RoomWidth;
            startXPos  = 0;
            startYPos  = 0;
            has_doors  = false;
            rGen       = new Random();

            //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;

            room_tiles   = base_room.Room_Matrix;
            doodad_list  = new List <KeyValuePair <Doodad.Doodad_Type, gridCoordinate> >();
            monster_list = new List <KeyValuePair <string, gridCoordinate> >();
            gold_list    = new List <KeyValuePair <Goldpile, gridCoordinate> >();

            switch (base_room.RoomType)
            {
            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;
            }

            //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;
                }
                gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Doodad_Coordinates[i]);
                c_grid_coord.x += startXPos;
                c_grid_coord.y += startYPos;
                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.
            for (int i = 0; i < base_room.Room_Monsters.Count; i++)
            {
                if (sTable.monster_in_table(base_room.Room_Monsters[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));
                    }
                }
            }
        }