Files
Shogi/Gameboard.ShogiUI.Rules/Pieces/King.cs
2021-05-08 10:26:04 -05:00

33 lines
896 B
C#

using PathFinding;
using System.Collections.Generic;
namespace Gameboard.ShogiUI.Rules.Pieces
{
public class King : Piece
{
private static readonly List<PathFinding.Move> Moves = new(8)
{
new PathFinding.Move(Direction.Up),
new PathFinding.Move(Direction.Left),
new PathFinding.Move(Direction.Right),
new PathFinding.Move(Direction.Down),
new PathFinding.Move(Direction.UpLeft),
new PathFinding.Move(Direction.UpRight),
new PathFinding.Move(Direction.DownLeft),
new PathFinding.Move(Direction.DownRight)
};
public King(WhichPlayer owner) : base(WhichPiece.King, owner)
{
moveSet = new MoveSet(this, Moves);
promotedMoveSet = new MoveSet(this, Moves);
}
public override Piece DeepClone()
{
var clone = new King(Owner);
if (IsPromoted) clone.Promote();
return clone;
}
}
}