示例#1
0
        /**
         * Causes detials in the perceived tile to be copied across from the actual tile, will also log messages
         * decribing the new features discovered.  Returns true if any update occured
         *
         * @returns if any changes where made.
         */
        private bool detectSquare(FieldRecord perceivedTile, FieldRecord actualTile, string message, MDRCharacter character)
        {
            string detailName = "";

            if (perceivedTile.FaceNorth != actualTile.FaceNorth)
            {
                detailName += "a face north, ";
            }
            if (perceivedTile.FaceEast != actualTile.FaceEast)
            {
                detailName += "a face east, ";
            }
            if (perceivedTile.FaceWest != actualTile.FaceWest)
            {
                detailName += "a face west, ";
            }
            if (perceivedTile.FaceSouth != actualTile.FaceSouth)
            {
                detailName += "a face south, ";
            }

            if (perceivedTile.Antimagic != actualTile.Antimagic)
            {
                detailName += "an anti-magic, ";
            }
            if (perceivedTile.Rotator != actualTile.Rotator)
            {
                detailName += "a rotator, ";
            }
            if (perceivedTile.Extinguisher != actualTile.Extinguisher)
            {
                detailName += "an extinguisher, ";
            }
            if (perceivedTile.Stud != actualTile.Stud)
            {
                detailName += "a stud, ";
            }

            if (detailName != "")
            {
                CoM.PostMessage(message, CoM.Format(character), detailName.TrimEnd(new char[] { ' ', ',' }));
            }

            perceivedTile.FaceNorth    = actualTile.FaceNorth;
            perceivedTile.FaceEast     = actualTile.FaceEast;
            perceivedTile.FaceWest     = actualTile.FaceWest;
            perceivedTile.FaceSouth    = actualTile.FaceSouth;
            perceivedTile.Antimagic    = actualTile.Antimagic;
            perceivedTile.Rotator      = actualTile.Rotator;
            perceivedTile.Extinguisher = actualTile.Extinguisher;
            perceivedTile.Stud         = actualTile.Stud;

            return(detailName != "");
        }
示例#2
0
文件: MDRMap.cs 项目: bsimser/CoM
        /** Initializes the map to a given size. */
        public void Initialize(int width, int height)
        {
            this.width  = width;
            this.height = height;
            _field      = new FieldRecord[width, height];
            Area        = new List <MDRArea>();

            Chute    = new List <ChuteTrapInfo>();
            Teleport = new List <TeleportTrapInfo>();

            for (int ylp = 0; ylp < height; ylp++)
            {
                for (int xlp = 0; xlp < width; xlp++)
                {
                    _field[xlp, ylp]          = new FieldRecord(xlp, ylp, this);
                    _field[xlp, ylp].Explored = false;
                }
            }
        }
示例#3
0
        /**
         * Sets this field to the same field values as the source with different copy modes (see tileCopy enum)
         */
        public void CopyFrom(FieldRecord source, TileCopyMode mode = TileCopyMode.STANDARD)
        {
            switch (mode)
            {
            case TileCopyMode.STANDARD:
                BitMask = new BitArray(source.BitMask);
                break;

            case TileCopyMode.FULL:
                BitMask = new BitArray(source.BitMask);
                if (South != null)
                {
                    SouthWall = source.SouthWall;
                }
                if (West != null)
                {
                    WestWall = source.WestWall;
                }
                break;
            }
            Explored = source.Explored;
        }