using PathFinding; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace Gameboard.ShogiUI.BoardState.Pieces { public class Bishop : Piece { private static readonly List MoveSet = new List(4) { new Path(Direction.UpLeft, Distance.MultiStep), new Path(Direction.UpRight, Distance.MultiStep), new Path(Direction.DownLeft, Distance.MultiStep), new Path(Direction.DownRight, Distance.MultiStep) }; private static readonly List PromotedMoveSet = new List(8) { new Path(Direction.Up), new Path(Direction.Left), new Path(Direction.Right), new Path(Direction.Down), new Path(Direction.UpLeft, Distance.MultiStep), new Path(Direction.UpRight, Distance.MultiStep), new Path(Direction.DownLeft, Distance.MultiStep), new Path(Direction.DownRight, Distance.MultiStep) }; public Bishop(WhichPlayer owner) : base(WhichPiece.Bishop, owner) { // TODO: If this strat works out, we can do away with the Direction class entirely. PromotedMoveSet.AddRange(MoveSet); } public override Piece DeepClone() { var clone = new Bishop(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(); } } }