Files
Shogi/Shogi.Domain/ValueObjects/GoldGeneral.cs
2023-02-20 18:54:53 -06:00

32 lines
991 B
C#

using Shogi.Domain.YetToBeAssimilatedIntoDDD.Pathing;
using System.Collections.ObjectModel;
namespace Shogi.Domain.ValueObjects
{
internal record class GoldGeneral : Piece
{
public static readonly ReadOnlyCollection<Path> Player1Paths = new(new List<Path>(6)
{
new Path(Direction.Up),
new Path(Direction.UpLeft),
new Path(Direction.UpRight),
new Path(Direction.Left),
new Path(Direction.Right),
new Path(Direction.Down)
});
public static readonly ReadOnlyCollection<Path> Player2Paths =
Player1Paths
.Select(p => p.Invert())
.ToList()
.AsReadOnly();
public GoldGeneral(WhichPlayer owner, bool isPromoted = false)
: base(WhichPiece.GoldGeneral, owner, isPromoted)
{
}
public override IEnumerable<Path> MoveSet => Owner == WhichPlayer.Player1 ? Player1Paths : Player2Paths;
}
}