UTests pass with Pathfinder2D
This commit is contained in:
32
Gameboard.ShogiUI.BoardState/Pieces/Lance.cs
Normal file
32
Gameboard.ShogiUI.BoardState/Pieces/Lance.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using PathFinding;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Gameboard.ShogiUI.BoardState.Pieces
|
||||
{
|
||||
public class Lance : Piece
|
||||
{
|
||||
private static readonly List<Path> MoveSet = new List<Path>(1)
|
||||
{
|
||||
new Path(Direction.Up, Distance.MultiStep),
|
||||
};
|
||||
|
||||
public Lance(WhichPlayer owner) : base(WhichPiece.Lance, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override Piece DeepClone()
|
||||
{
|
||||
var clone = new Lance(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user