Code smells

This commit is contained in:
2021-03-04 20:35:23 -06:00
parent e64f75e3cc
commit 7ed771d467
31 changed files with 310 additions and 339 deletions

View File

@@ -1,19 +1,19 @@
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)
private static readonly List<PathFinding.Move> Moves = new(1)
{
new Path(Direction.Up, Distance.MultiStep),
new PathFinding.Move(Direction.Up, Distance.MultiStep),
};
public Lance(WhichPlayer owner) : base(WhichPiece.Lance, owner)
{
moveSet = new MoveSet(this, Moves);
promotedMoveSet = new MoveSet(this, GoldenGeneral.Moves);
}
public override Piece DeepClone()
@@ -22,11 +22,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();
}
}
}