Пример #1
0
        /** Sets wall by index.  0 = north, 1 = east, 2 = south, 3 = west */
        public void setWallRecord(int index, WallRecord record)
        {
            switch (index)
            {
            case 0:
                NorthWall = record;
                return;

            case 1:
                EastWall = record;
                return;

            case 2:
                SouthWall = record;
                return;

            case 3:
                WestWall = record;
                return;
            }
            throw new Exception("Invalid wall index: " + index);
        }
Пример #2
0
        /** Updates the explored map to reveal the tile the party is standing on. */
        private void updateExploredMap()
        {
            var origionalValue = PerceivedTile.Value;

            bool secretDiscovered = false;

            if (PerceivedTile != null)
            {
                var character = PerceptionCharacter;

                PerceivedTile.Explored   = true;
                PerceivedTile.Water      = CurrentTile.Water;
                PerceivedTile.Pit        = CurrentTile.Pit;
                PerceivedTile.StairsUp   = CurrentTile.StairsUp;
                PerceivedTile.StairsDown = CurrentTile.StairsDown;
                PerceivedTile.Teleporter = CurrentTile.Teleporter;
                PerceivedTile.Dirt       = CurrentTile.Dirt;
                PerceivedTile.Rock       = CurrentTile.Rock;
                PerceivedTile.Chute      = CurrentTile.Chute;
                PerceivedTile.Grass      = CurrentTile.Grass;

                bool blind = false;
                if (!blind)
                {
                    // copy walls, but leave secrets alone
                    for (int lp = 0; lp < 4; lp++)
                    {
                        WallRecord wall                = new WallRecord();
                        var        actualWallRecord    = CurrentTile.getWallRecord(lp);
                        var        perceivedWallRecord = PerceivedTile.getWallRecord(lp);

                        if (actualWallRecord.Secret)
                        {
                            wall.Type = perceivedWallRecord.Secret ? WallType.Secret : WallType.Wall;
                        }
                        else
                        {
                            wall.Type = actualWallRecord.Type;
                        }

                        if (actualWallRecord.Secret && !perceivedWallRecord.Secret)
                        {
                            if (GameRules.PerceptionRoll(character, 15 + (Depth * 5)))
                            {
                                CoM.PostMessage("{0} discovered a secret door.", CoM.Format(character));
                                SoundManager.Play("OLDFX_FOUND");
                                wall.Type        = WallType.Secret;
                                secretDiscovered = true;
                            }
                        }

                        PerceivedTile.setWallRecord(lp, wall);
                    }
                }

                if (PerceivedTile.GroundValue != CurrentTile.GroundValue)
                {
                    // roll to see if we detect the difference or not
                    if (GameRules.PerceptionRoll(character, 10 + (Depth * 2)))
                    {
                        detectSquare(PerceivedTile, CurrentTile, "{0} detected that the party is standing on {1} square.", character);
                    }
                    else
                    {
                        if (GameRules.PerceptionRoll(character, (Depth)))
                        {
                            CoM.PostMessage("{0} detects something strange about this place.", CoM.Format(character));
                        }
                    }
                }
            }

            bool tileChanged = origionalValue != PerceivedTile.Value || secretDiscovered;

            if (CoM.GraphicsLoaded && tileChanged)
            {
                CoM.Instance.RefreshMapTile(LocationX, LocationY);
            }
        }