/** Moves party forward one square in the direction they are facing, if not blocked by a wall */ public void Move(Direction direction) { if (Selected.Paralized) { return; } // open a door if we move through it. var door = getDoor(LocationX, LocationY, direction); if (door != null) { openDoor(door); } var perceivedWallWeWillMoveThrough = PerceivedTile.getWallRecord(direction); var actualWallWeWillMoveThrough = CurrentTile.getWallRecord(direction); if (perceivedWallWeWillMoveThrough != actualWallWeWillMoveThrough) { PerceivedTile.setWallRecord(direction.Sector, actualWallWeWillMoveThrough); CoM.Instance.RefreshMapTile(LocationX, LocationY); } if (CanMove(direction)) { SetLocation(LocationX + direction.DX, LocationY + direction.DY); } }
/** 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); } }