Inheritance: InventoryItem
コード例 #1
0
        public CombatManualComponent(int x, int y,CombatManual manual)
        {
            this.cm = manual;

            this.newAttack = cm.SpecialAttack;

            this.locationX = x;
            this.locationY = y;

            this.PerformDrag(0, 0);

            this.clickedNumber = 0;
        }
コード例 #2
0
 public CombatManualInterface(CombatManual manual)
     : base()
 {
     Manual = manual;
 }
コード例 #3
0
        /// <summary>
        /// Creates and puts a particular room in a particular rectangle
        /// </summary>
        /// <param name="roomType"></param>
        /// <param name="rect"></param>
        /// <param name="circle">When the room is a Summoning Room, there's the circle</param>
        private static void PutRoom(MapBlock[,] map, int tileID, int level, DungeonRoomType roomType, Rectangle rect, out SummoningCircle circle)
        {
            circle = null;

            string tagName = roomType.ToString().ToLower().Replace("_", " ") + " room";

            LocalMapXMLParser parser = new LocalMapXMLParser();
            var maplet = parser.ParseMapletFromTag(tagName);

            //Change the width and height to match the rectangle we're fitting it in
            //Leave a rim of 1
            maplet.SizeX = rect.Width - 2;
            maplet.SizeY = rect.Height - 2;

            LocalMapGenerator lmg = new LocalMapGenerator();

            Actor[] actors = null;
            MapletActorWanderArea[] areas = null;
            MapletPatrolPoint[] patrolRoutes = null;
            MapletFootpathNode[] footpathNodes = null;

            var gennedMap = lmg.GenerateMap(tileID, null, maplet, false, "", OwningFactions.UNDEAD, out actors, out areas, out patrolRoutes, out footpathNodes);

            //Is this a summoning room?
            if (roomType == DungeonRoomType.SUMMONING)
            {
                //Go through each map block and see if we find a summoning circle
                for (int x = 0; x < gennedMap.GetLength(0); x++)
                {
                    for (int y = 0; y < gennedMap.GetLength(1); y++)
                    {
                        var block = gennedMap[x, y];
                        if (block.GetTopMapItem() != null && block.GetTopMapItem().GetType().Equals(typeof(SummoningCircle)))
                        {
                            circle = block.GetTopMapItem() as SummoningCircle;
                        }
                    }
                }
            }

            if (roomType == DungeonRoomType.COMBAT_PIT)
            {
                int docLevel = (int) level/4;
                docLevel = docLevel < 1 ? 1 : docLevel;
                docLevel = docLevel > 5 ? 5 : docLevel;
                //Generate a combat manual - Level [1..5] will be determined by floor of Dungeon Level /4
                CombatManual cm = new CombatManual(SpecialAttacksGenerator.GenerateSpecialAttack(docLevel));

                //Now place it, somewhere (or at least try 50 times)
                for(int i=0; i < 50; i++)
                {
                    MapBlock randomBlock = gennedMap[GameState.Random.Next(gennedMap.GetLength(0)), GameState.Random.Next(gennedMap.GetLength(1))];

                    if (randomBlock.MayContainItems)
                    {
                        randomBlock.ForcePutItemOnBlock(cm);
                        break;
                    }
                }
            }

            //Do we have any treasure chests?
            for (int x = 0; x < gennedMap.GetLength(0); x++)
            {
                for (int y = 0; y < gennedMap.GetLength(1); y++)
                {
                    var block = gennedMap[x, y];
                    if (block.GetTopMapItem() != null && block.GetTopMapItem().GetType().Equals(typeof(TreasureChest)))
                    {
                        TreasureChest chest = block.GetTopMapItem() as TreasureChest;

                        InventoryItemManager iim = new InventoryItemManager();

                        //Fill em up
                        chest.Contents = iim.FillTreasureChest((InventoryCategory[])Enum.GetValues(typeof(InventoryCategory)), 300 + (50 * level));
                    }
                }
            }

            //Now fit one into the other
            lmg.JoinMaps(map, gennedMap, rect.X + 1, rect.Y + 1);
        }