示例#1
0
        public override UserMessage Show(CastleItem item)
        {
            UserMessage returnMessage = new UserMessage();

            if (showItem == null)
            {
                returnMessage.AddLine(String.Format("The {0}", Name));
                returnMessage.AddLine("looks at you");
                returnMessage.AddLine("Funny!");
            }
            else
            {
                if (String.Compare(item.InventoryName, showItem, StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    this.IsVisible = false;
                    returnMessage.AddLine(showDescription);

                }
                else
                {
                    returnMessage.AddLine(String.Format("The {0}", Name));
                    returnMessage.AddLine("looks at you");
                    returnMessage.AddLine("Funny!");
                }
            }
            return returnMessage;
        }
示例#2
0
        public override UserMessage Hit(CastleItem sword)
        {
            UserMessage returnMessage = new UserMessage();

            returnMessage.AddLine(String.Format("The {0}", Name));
            returnMessage.AddLine("is blocking");
            returnMessage.AddLine("your way. He");
            returnMessage.AddLine("can't be hurt.");

            return returnMessage;
        }
示例#3
0
        public override UserMessage Play(CastleItem item)
        {
            UserMessage returnMessage = null;

            if (playItem != null)
            {
                if (String.Compare(item.InventoryName, playItem, StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    returnMessage = new UserMessage();
                    this.IsVisible = false;
                    returnMessage.AddLine(showDescription);

                }
            }
            return returnMessage;
        }
示例#4
0
 private CastleItem FindItemInRoom(CastleItem castleObject)
 {
     return FindItemInList(CurrentRoomItems, castleObject);
 }
示例#5
0
 private CastleItem FindItemInInventory(CastleItem castleObject)
 {
     return FindItemInList(currentInventory, castleObject);
 }
示例#6
0
        private static CastleItem FindItemInList(Collection<CastleItem> list, CastleItem castleObject)
        {
            foreach(var item in list)
            {
                if (item == castleObject)
                {
                    return item;
                }

            }
            return null;
        }
示例#7
0
 public CastleFurnatureFountain(String lookFailMessage, String fullDescription, String emptyDescription, CastleItem item, CastleFurnature otherFurnature, Collection<Point> getPoints, String getDescription, int roomIndex, params String[] parsingName)
     : base(lookFailMessage, fullDescription, emptyDescription, item, getPoints, getDescription, roomIndex, parsingName)
 {
     this.otherFurnature = otherFurnature;
     this.SpecialCommandList.Add(CommandVerb.Take, GetWater);
 }
示例#8
0
 public virtual CastleItem TakeItem()
 {
     CastleItem returnItem = Item;
     this.Description = EmptyDescription;
     Item = null;
     return returnItem;
 }
示例#9
0
 public CastleFurnatureContainer(String lookFailMessage, String fullDescription, String emptyDescription, CastleItem item, Collection<Point> getPoints, String getDescription, int roomIndex, params String[] parsingName)
     : base(lookFailMessage, fullDescription, getDescription, roomIndex, parsingName)
 {
     this.EmptyDescription = emptyDescription;
     this.Item = item;
     this.getPoints = getPoints;
     
 }
示例#10
0
        private void CreateCastleItems()
        {

            // Items that can be picked up

            CastleItems.Add(new CastleItem("SWORD", 197, new Point(10, 4), 0, " It looks      Sharp!", "SWORD", 12, "Sword"));
            CastleItems.Add(new CastleItem("FANCY GOBLET", 230, new Point(5, 13), 50, goldDescription, "GOBLET", 8, "Goblet"));
            CastleItems.Add(new CastleItem("LAMP",6, new Point(18, 13), 0, " It's lit      Magically",  "LAMP", 17, "Lamp"));
            CastleItems.Add(new CastleItem("CROWN", 127, new Point(8, 4), 50, goldDescription, "CROWN", 14, "Crown"));
            CastleItems.Add(new CastleItem("HOURGLASS", 232, new Point(8, 4), 50, goldDescription, "HOURGLASS", 20, "Hourglass"));
            CastleItems.Add(new CastleItem("SILVER BARS", 240, new Point(6, 7), 50, expensiveDescrition, "BARS", 26, "Bars"));
            CastleItems.Add(new CastleItem("JADE FIGURINE", 157, new Point(12, 9), 50, expensiveDescrition, "FIGURINE", 29, "Figurine"));
            CastleItems.Add(new CastleItem("HOLY CROSS", 116, new Point(14, 12), 50, goldDescription, "CROSS", 37, "Cross"));
            CastleItems.Add(new CastleItem("DIAMOND", 4, new Point(12, 9), 50, expensiveDescrition, "DIAMOND", 57, "Diamond"));
            CastleItems.Add(new CastleItem("RUBYS", 58, new Point(3, 15), 50, expensiveDescrition, "RUBYS", 60, "RUBYS"));
            CastleItems.Add(new PlayableCastleItem("HARP", 14, new Point(15, 7), goldDescription, "The Harp makesBeautiful     Music!", 50, "HARP", 65, "HARP"));
            CastleItems.Add(new WearableCastleItem("HELMET", 155, new Point(11, 5), " It looks      Tough!", "OK.           I'm wearing it", 0, "HELMET", 22, "Helmet"));
            CastleItems.Add(new CastleItem("CRYSTAL BALL", 248, new Point(9, 11), 0, "In the crystal Ball....     You see a man in a winding  passage,wavinga Wand.", "BALL", 66, "BALL"));
            CastleItems.Add(new CastleItem("GOLDBAR", 254, new Point(22, 13), 50, expensiveDescrition, "GOLDBAR", 74, "GOLDBAR"));

            WaveItem scepterItem = new WaveItem(updateMapCb, "SCEPTER", 225, new Point(11, 9), expensiveDescrition, 50, "SCEPTER", 83, "SCEPTER");
            scepterItem.AddSpecialRoomAction(new GateRoom());
            CastleItems.Add(scepterItem);

            WaveItem wandItem = new WaveItem(updateMapCb, "MAGIC WAND", 196, new Point(3, 8), " It looks      Magical!", 0, "WAND", 24, "Wand");
            wandItem.AddSpecialRoomAction(new SorcerersRoom());
            wandItem.AddSpecialRoomAction(new WindingPasage2());
            CastleItems.Add(wandItem);

            // Items that cannot be picked up
            castleFurnatureItems.Add(new CastleFurnature(null, "It looks      very Strong", null, 1, "Gate"));
            castleFurnatureItems.Add(new CastleFurnature(null, "Writing on thewall says...                The First Day    2006", null, 1, "Wall"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 4, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 5, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null ,7, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("a Table.", "It's made of  Stone.", "TABLES", 9, "Table"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 11, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("", " They're made  of wood.", "SHELVES", 11, "Shelves"));
            castleFurnatureItems.Add(new CastleFurnature("a throne!", "The throne is made of stone.", "THRONES, ", 14, "Throne"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 15, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 16, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 20, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 21, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 23, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 25, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 26, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 30, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 31, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 32, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("a Balcony!", "The balcony ismade of Stone.", null, 33, "Balcony"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 34, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("a Bed.", " It's Red.", "BEDS", 37, "Bed"));
            castleFurnatureItems.Add(new CastleFurnature("a Bed.", " It's Blue.", "BEDS", 38, "Bed"));
            castleFurnatureItems.Add(new CastleFurnature("a Bed.", " It's Purple.", "BEDS", 39, "Bed"));
            castleFurnatureItems.Add(new CastleFurnature("a Bed.", " It's Yellow.", "BEDS", 40, "Bed"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 41, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 42, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 43, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 45, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 48, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 49, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 50, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 53, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("", " They're made  of wood.", "SHELVES", 59, "Shelves"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 61, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 62, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 63, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, downStairsDescription, null, 64, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, upDownStairsDescription, null, 65, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("a Bed.", " It's Old.", "BEDS", 67, "Bed"));
            castleFurnatureItems.Add(new CastleFurnature("A Mirror.", " It looks      Magical", "MIRRORS", 67, "Mirror"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 68, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature("a Barrel.", " They look     old!", "BARRELS", 68, "Barrels"));
            castleFurnatureItems.Add(new CastleFurnature("a Door.", " It looks      very Strong!", "DOORS", 68, "Door"));
            castleFurnatureItems.Add(new CastleFurnature("a Table.", " It's covered  with Blood!", "TABLES", 79, "Table"));
            castleFurnatureItems.Add(new CastleFurnature(null, " They look     Magical!", "CHAINS", 79, "Chains"));
            castleFurnatureItems.Add(new CastleFurnature("a Door.", " It looks      very Strong!", "DOORS", 82, "Door"));
            castleFurnatureItems.Add(new CastleFurnature(null, upStairsDescription, null, 82, "Stairs"));
            castleFurnatureItems.Add(new CastleFurnature(null, "Writing on thewall says...                Kevin Bales    1550", null, 83, "Wall"));
            castleFurnatureItems.Add(new CastleFurnature(null, "The walls are many Colors!", null, 83, "Wall"));

            // Universal Items
            castleFurnatureItems.Add(new CastleFurnature(null, "The WALLS     are made of   Gray Stone.", null, 0, "Wall"));
            castleFurnatureItems.Add(new CastleFurnature(null, "The FLOORS    are made of   Gray Stone.", null, 0, "Floor"));
            castleFurnatureItems.Add(new CastleFurnature(null, "The CEILINGS  are made of   Gray Stone.", null, 0, "Ceiling"));
            castleFurnatureItems.Add(new CastleFurnature(null, " I don't see   any stairs!", null, 0, "Stairs"));


            // Desk / Flask 
            CastleItem flaskItem = new DrinkableItem("FLASK", 33, new Point(0, 0), " It's empty.", " It's filled   with water.", 0, "FLASK", -1, "Flask");
            CastleItems.Add(flaskItem);
            Collection<Point> deskFlaskPoints = new Collection<Point>();
            deskFlaskPoints.Add(new Point(6, 9));
            deskFlaskPoints.Add(new Point(7, 9));
            deskFlaskPoints.Add(new Point(8, 9));
            deskFlaskPoints.Add(new Point(9, 9));
            deskFlaskPoints.Add(new Point(6, 12));
            deskFlaskPoints.Add(new Point(7, 12));
            deskFlaskPoints.Add(new Point(8, 12));
            deskFlaskPoints.Add(new Point(9, 12));
            CastleFurnatureContainer deskWithFlask = new CastleFurnatureContainer("a desk!", " There is a    Wine Flask    on top.", " It's made     of Wood.", flaskItem, deskFlaskPoints, "DESKS", 10, "Desk");
            castleFurnatureItems.Add(deskWithFlask);

            // Gem / Fountain / Garden
            CastleItem gem = new CastleItem("GEM", 233, new Point(0, 0), 50, expensiveDescrition, "GEM", -1, "Gem");
            CastleItems.Add(gem);
            Collection<Point> gemFountainPoints = new Collection<Point>();
            gemFountainPoints.Add(new Point(10, 7));
            gemFountainPoints.Add(new Point(11, 7));
            gemFountainPoints.Add(new Point(12, 7));
            gemFountainPoints.Add(new Point(9, 8));
            gemFountainPoints.Add(new Point(9, 9));
            gemFountainPoints.Add(new Point(9, 10));
            gemFountainPoints.Add(new Point(10, 11));
            gemFountainPoints.Add(new Point(11, 11));
            gemFountainPoints.Add(new Point(12, 11));
            gemFountainPoints.Add(new Point(13, 8));
            gemFountainPoints.Add(new Point(13, 9));
            gemFountainPoints.Add(new Point(13, 10));
            CastleFurnature garden = new CastleFurnature("A Garden!", " There is a    BIG gem in    the Garden    Fountain!", "GARDENS, ", 33, "Garden");
            CastleFurnatureFountain fountainWithGem = new CastleFurnatureFountain("A fountain!", "The fountain  is filled     with water.Butyou can't see In it.", "The Garden    Has A Fountainin the middle.", gem, garden, gemFountainPoints, "FOUNTAINS", 18, "Fountain");
            castleFurnatureItems.Add(garden);
            castleFurnatureItems.Add(fountainWithGem);

            // Statue / Necklace
            CastleItem necklace = new WearableCastleItem("NECKLACE", 21, new Point(0, 0), " On the back   it says:                   Protection    from Traps.", "OK.           I'm wearing it", 50, "NECKLACE", -1, "Necklace");
            CastleItems.Add(necklace);
            Collection<Point> necklacePoints = new Collection<Point>();
            necklacePoints.Add(new Point(10, 6));
            necklacePoints.Add(new Point(11, 6));
            necklacePoints.Add(new Point(12, 6));
            necklacePoints.Add(new Point(9, 7));
            necklacePoints.Add(new Point(9, 8));
            necklacePoints.Add(new Point(9, 9));
            necklacePoints.Add(new Point(10, 10));
            necklacePoints.Add(new Point(11, 10));
            necklacePoints.Add(new Point(12, 10));
            necklacePoints.Add(new Point(13, 7));
            necklacePoints.Add(new Point(13, 8));
            necklacePoints.Add(new Point(13, 9));
            CastleFurnatureContainer statueWithNecklace = new CastleFurnatureContainer("a statue!", " The statue is wearing a     Necklace", " The Statue    looks like    The King!", necklace, necklacePoints, "STATUE", 19, "Statue");
            castleFurnatureItems.Add(statueWithNecklace);

            // Desk / Glasses
            CastleItem glasses = new WearableCastleItem("EYE GLASSES", 236, new Point(0, 0), " They're       Bifocals", " OK.           I'm wearing   them.", 0, "GLASSES", -1, "Glasses");
            CastleItems.Add(glasses);
            Collection<Point> glassesPoint = new Collection<Point>();
            glassesPoint.Add(new Point(16, 10));
            glassesPoint.Add(new Point(17, 10));
            glassesPoint.Add(new Point(18, 10));
            glassesPoint.Add(new Point(16, 13));
            glassesPoint.Add(new Point(17, 13));
            glassesPoint.Add(new Point(18, 13));
            CastleFurnatureContainer deskWithGlasses = new CastleFurnatureContainer("a desk!", " There is a    Pair of Eye   Glasses on    Top.", " It's made     of Wood.", glasses, glassesPoint, "DESKS", 40, "Desk");
            castleFurnatureItems.Add(deskWithGlasses);

            // Desk /Key
            CastleItem key = new CastleItem("KEY", 231, new Point(0, 0), 0, " It looks Old!", "KEY", -1, "Key");
            CastleItems.Add(key);
            Collection<Point> keyPoint = new Collection<Point>();
            keyPoint.Add(new Point(9, 4));
            keyPoint.Add(new Point(10, 4));
            keyPoint.Add(new Point(11, 4));
            keyPoint.Add(new Point(12, 4));
            keyPoint.Add(new Point(13, 4));
            keyPoint.Add(new Point(14, 4));
            keyPoint.Add(new Point(8, 5));
            keyPoint.Add(new Point(8, 6));
            keyPoint.Add(new Point(8, 7));
            keyPoint.Add(new Point(9, 8));
            keyPoint.Add(new Point(10, 8));
            keyPoint.Add(new Point(11, 8));
            keyPoint.Add(new Point(12, 8));
            keyPoint.Add(new Point(13, 8));
            keyPoint.Add(new Point(14, 8));
            keyPoint.Add(new Point(15, 5));
            keyPoint.Add(new Point(15, 6));
            keyPoint.Add(new Point(15, 7));
            CastleFurnatureContainer deskWithKey = new CastleFurnatureContainer("a desk!", " There is a    Key on top", " It's made     of Wood.", key, keyPoint, "DESKS", 56, "Desk");
            castleFurnatureItems.Add(deskWithKey);

            // Shelf / Book
            CastleItem book = new BookItem("BOOK", 220, new Point(0, 0), " It is titled   'The Gate'", 0, "BOOK", -1, "Book");
            CastleItems.Add(book);
            Collection<Point> bookPoints = new Collection<Point>();
            for (int x = 6; x < 15; x++)
            {
                for (int y = 6; y < 15; y++)
                {
                    bookPoints.Add(new Point(x, y));
                }
            }
            for (int x = 16; x < 24; x++)
            {
                for (int y = 6; y < 15; y++)
                {
                    bookPoints.Add(new Point(x, y));
                }
            }
            CastleFurnatureContainer shelvesWithBook = new CastleFurnatureContainer("", "There's a bookon one.", " It's made     of Wood.", book, bookPoints, "Shelves", 58, "Shelves");
            castleFurnatureItems.Add(shelvesWithBook);


        }
示例#11
0
        public virtual UserMessage Show(CastleItem item)
        {
            UserMessage returnMessage = new UserMessage();

            returnMessage.AddLine(String.Format("The {0}", Name));
            returnMessage.AddLine("looks at you");
            returnMessage.AddLine("Funny!");

            return returnMessage;
        }
示例#12
0
 public virtual UserMessage Play(CastleItem item)
 {
     return null;
 }
示例#13
0
        public virtual UserMessage Hit(CastleItem sword)
        {
            UserMessage returnMessage = new UserMessage();

            if(sword == null)
            {
                returnMessage.AddLine("You have no");
                returnMessage.AddLine("Weapon!");
            }
            else if(this.Health > 0)
            {
                Health--;
                if(this.Health == 0)
                {
                    IsAlive = false;
                    returnMessage.AddLine("You Killed");
                    returnMessage.AddLine(String.Format("the {0}", Name));

                }
                else
                {
                    returnMessage.AddLine("You Struck");
                    returnMessage.AddLine(String.Format("the {0}", Name));
                }
            }
            return returnMessage;
        }