コード例 #1
0
ファイル: WorldBuilder.cs プロジェクト: CMS18/Grupp7
        public WorldBuilder()
        {
            // Create Rooms
            var room1 = new StartRoom(
                "The Room",
                "I'm inside a small room with bad lighting, I can see a door, maybe I can open it?",
                "There's a key and a note on the ground!");

            var room2 = new Hallway(
                "Hallway",
                "A small hallway with cement covered walls, the air is damp. I think I'm in a cellar?\n" +
                "There is a path leading to the left, it looks dark. There's also a path leading to the right.",
                "");

            var room3Right = new JanitorsRoom(
                "Janitor's Room",
                "It's a small room, quite messy, it smells like gasoline. I see a painting of an old man with a handle bar mustasch.\n" +
                "I can't see any exits here besides the way I came from.",
                "");

            var room4Left = new FinalRoom(
                "Final Room",
                "It's a small room with walls covered in moist, I can see a door with a codelock next to it.",
                "There's nothing here except the door...");

            // Create Items
            var roomKey = new Item(
                "Room Key",
                "It looks like it could fit to this door.",
                1,
                "The key is old and rusty, it looks fragile.");

            var note = new Note(
                "Note",
                "A piece of paper with something written on it.",
                0,
                "A piece of paper with something written on it.");

            var bottle = new Bottle(
                "Bottle of Kerosene",
                "It's commonly used to power jet engines.",
                2,
                "A bottle of kerosene, it's very flammable.");

            var rags = new Rags(
                "Rags",
                "Some old clothes ripped apart.",
                2,
                "I think this used to be a shirt...");

            var broom = new Broom(
                "Broom",
                "A regular broom used to cleaning.",
                5, "It's a broom, what more do you need to know?");

            var painting = new Item(
                "Painting",
                "A painting of Mr.X?",
                0,
                "The painting is signed by Mr X." +
                " There seems to be missing a piece of the painting.",
                false);

            var rocks = new Rock(
                "Pile of Rocks",
                "It's a pile of rocks.",
                7,
                "A large pile of small rocks, almost as someone placed them there? Maybe I can move them.",
                false);


            // Create Exit Points
            var roomExit = new Door(
                room2,
                1,
                true,
                false,
                "Rooms Door",
                "You hear a crack... the door is unlocked! Oh... the key broke in half.",
                "The door is locked, maybe there's a key somewhere?",
                "A brown wooden door with a sturdy lock.");

            var room2RightExit = new RightOfHallway(
                room3Right,
                2,
                false,
                false,
                "Right",
                "",
                "",
                ""
                );

            var room2LeftExit = new LeftOfHallway(
                room4Left,
                10,
                true,
                false,
                "Left",
                "Finally some light! I can now see where I'm going.",
                "I can't go that way, it's too dark. I need some light...",
                "It's just a dark passage..."
                );

            var finalRoomExit = new FinalDoor(
                11,
                true,
                false,
                "Codelock Door",
                "Success! The door is unlocked, let's get out of here!",
                "The door is locked. There's a codelock to it. I need to find that code!",
                "A big iron door with a codelock next to it."
                );

            // Add exits to room sists
            room1.Exit.Add(roomExit);
            room2.Exit.Add(new Door(
                               room1,
                               1,
                               false,
                               false,
                               "Rooms Door",
                               "",
                               "",
                               "That's the door I came from. The key is still stuck inside the lock, whoops!"));
            room2.Exit.Add(room2RightExit);
            room2.Exit.Add(room2LeftExit);

            room3Right.Exit.Add(new Exit(
                                    room2,
                                    2,
                                    false,
                                    false,
                                    "Left",
                                    "",
                                    "",
                                    ""));

            room4Left.Exit.Add(new Exit
                                   (room2,
                                   2,
                                   false,
                                   false,
                                   "Right",
                                   "",
                                   "",
                                   ""));
            room4Left.Exit.Add(finalRoomExit);

            // Add items to room inventory
            room1.RoomInventory.Add(roomKey);
            room1.RoomInventory.Add(note);

            room2.RoomInventory.Add(rocks);

            room3Right.RoomInventory.Add(bottle);
            room3Right.RoomInventory.Add(rags);
            room3Right.RoomInventory.Add(broom);
            room3Right.RoomInventory.Add(painting);

            // Add all instances of rooms to property Rooms
            Rooms.Add(room1);
            Rooms.Add(room2);
            Rooms.Add(room3Right);
        }
コード例 #2
0
ファイル: Generate.cs プロジェクト: krisfiction/TrialByCombat
        public static void Armor()
        {
            int _slot = random.Next(0, 8);

            string[] gearSlot = new string[8];
            gearSlot[0] = "Head"; //helmet
            gearSlot[1] = "Shoulders";
            gearSlot[2] = "Chest";
            gearSlot[3] = "Waist"; // belt
            gearSlot[4] = "Arms";  // bracer
            gearSlot[5] = "Hands"; // gloves
            gearSlot[6] = "Legs";  // pants
            gearSlot[7] = "Feet";  // boots

            string prefixName;
            int    prefixValue;
            string prefixStat;

            (prefixName, prefixStat, prefixValue) = Prefix.Generate("Armor");

            string suffixName;
            string suffixStat;
            int    suffixValue;

            (suffixName, suffixStat, suffixValue) = Suffix.Generate("Armor");


            int _armorType = random.Next(1, 11);

            switch (_armorType)
            {
            case 1:
                Rags rags = new Rags(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                rags.ArmorAddToInventory();
                break;

            case 2:
                Quilted cloak = new Quilted(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                cloak.ArmorAddToInventory();
                break;

            case 3:
                Leather leather = new Leather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                leather.ArmorAddToInventory();
                break;

            case 4:
                HardLeather hardLeather = new HardLeather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                hardLeather.ArmorAddToInventory();
                break;

            case 5:
                StuddedLeather studdedLeather = new StuddedLeather(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                studdedLeather.ArmorAddToInventory();
                break;

            case 6:
                RingMail ringMail = new RingMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                ringMail.ArmorAddToInventory();
                break;

            case 7:
                ChainMail chainMail = new ChainMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                chainMail.ArmorAddToInventory();
                break;

            case 8:
                ScaleMail scaleMail = new ScaleMail(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                scaleMail.ArmorAddToInventory();
                break;

            case 9:
                FieldPlate fieldPlate = new FieldPlate(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                fieldPlate.ArmorAddToInventory();
                break;

            case 10:
                GothicPlate gothicPlate = new GothicPlate(gearSlot[_slot], prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue);
                gothicPlate.ArmorAddToInventory();
                break;
            }
        }