33 lines
781 B
C#
33 lines
781 B
C#
using PathFinding;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
|
|
namespace Gameboard.ShogiUI.BoardState.Pieces
|
|
{
|
|
public class Pawn : Piece
|
|
{
|
|
private static readonly List<Path> MoveSet = new List<Path>(1)
|
|
{
|
|
new Path(Direction.Up)
|
|
};
|
|
|
|
public Pawn(WhichPlayer owner) : base(WhichPiece.Pawn, owner)
|
|
{
|
|
}
|
|
|
|
public override Piece DeepClone()
|
|
{
|
|
var clone = new Pawn(Owner);
|
|
if (IsPromoted) clone.Promote();
|
|
return clone;
|
|
}
|
|
|
|
public override ICollection<Path> GetPaths()
|
|
{
|
|
var moveSet = IsPromoted ? GoldenGeneral.MoveSet : MoveSet;
|
|
return Owner == WhichPlayer.Player1 ? moveSet : moveSet.Select(_ => new Path(Vector2.Negate(_.Direction), _.Distance)).ToList();
|
|
}
|
|
}
|
|
}
|