using PathFinding; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace Gameboard.ShogiUI.BoardState.Pieces { public class Rook : Piece { private static readonly List MoveSet = new List(4) { new Path(Direction.Up, Distance.MultiStep), new Path(Direction.Left, Distance.MultiStep), new Path(Direction.Right, Distance.MultiStep), new Path(Direction.Down, Distance.MultiStep) }; private static readonly List PromotedMoveSet = new List(8) { new Path(Direction.Up, Distance.MultiStep), new Path(Direction.Left, Distance.MultiStep), new Path(Direction.Right, Distance.MultiStep), new Path(Direction.Down, Distance.MultiStep), new Path(Direction.UpLeft), new Path(Direction.UpRight), new Path(Direction.DownLeft), new Path(Direction.DownRight) }; public Rook(WhichPlayer owner) : base(WhichPiece.Rook, owner) { } public override Piece DeepClone() { var clone = new Rook(Owner); if (IsPromoted) clone.Promote(); return clone; } public override ICollection GetPaths() { var moveSet = IsPromoted ? PromotedMoveSet : MoveSet; return Owner == WhichPlayer.Player1 ? moveSet : moveSet.Select(_ => new Path(Vector2.Negate(_.Direction), _.Distance)).ToList(); } } }