Code smells
This commit is contained in:
@@ -7,14 +7,16 @@ namespace Gameboard.ShogiUI.BoardState.Pieces
|
||||
{
|
||||
public class Knight : Piece
|
||||
{
|
||||
private static readonly List<Path> MoveSet = new List<Path>(2)
|
||||
private static readonly List<PathFinding.Move> Moves = new(2)
|
||||
{
|
||||
new Path(Direction.KnightLeft),
|
||||
new Path(Direction.KnightRight)
|
||||
new PathFinding.Move(Direction.KnightLeft),
|
||||
new PathFinding.Move(Direction.KnightRight)
|
||||
};
|
||||
|
||||
public Knight(WhichPlayer owner) : base(WhichPiece.Knight, owner)
|
||||
{
|
||||
moveSet = new MoveSet(this, Moves);
|
||||
promotedMoveSet = new MoveSet(this, GoldenGeneral.Moves);
|
||||
}
|
||||
|
||||
public override Piece DeepClone()
|
||||
@@ -23,11 +25,5 @@ namespace Gameboard.ShogiUI.BoardState.Pieces
|
||||
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