before deleting Rules
This commit is contained in:
39
Gameboard.ShogiUI.Rules/Pieces/Bishop.cs
Normal file
39
Gameboard.ShogiUI.Rules/Pieces/Bishop.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using PathFinding;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Gameboard.ShogiUI.Rules.Pieces
|
||||
{
|
||||
public class Bishop : Piece
|
||||
{
|
||||
private static readonly List<PathFinding.Move> Moves = new(4)
|
||||
{
|
||||
new PathFinding.Move(Direction.UpLeft, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.UpRight, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.DownLeft, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.DownRight, Distance.MultiStep)
|
||||
};
|
||||
private static readonly List<PathFinding.Move> PromotedMoves = 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, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.UpRight, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.DownLeft, Distance.MultiStep),
|
||||
new PathFinding.Move(Direction.DownRight, Distance.MultiStep)
|
||||
};
|
||||
public Bishop(WhichPlayer owner) : base(WhichPiece.Bishop, owner)
|
||||
{
|
||||
moveSet = new MoveSet(this, Moves);
|
||||
promotedMoveSet = new MoveSet(this, PromotedMoves);
|
||||
}
|
||||
|
||||
public override Piece DeepClone()
|
||||
{
|
||||
var clone = new Bishop(Owner);
|
||||
if (IsPromoted) clone.Promote();
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user