31 lines
896 B
C#
31 lines
896 B
C#
|
|
namespace Chessistics.Engine.Model;
|
||
|
|
|
||
|
|
public class PieceState
|
||
|
|
{
|
||
|
|
public int Id { get; }
|
||
|
|
public PieceKind Kind { get; }
|
||
|
|
public Coords StartCell { get; }
|
||
|
|
public Coords EndCell { get; }
|
||
|
|
public Coords CurrentCell { get; set; }
|
||
|
|
public CargoType? Cargo { get; set; }
|
||
|
|
public int SocialStatus { get; }
|
||
|
|
public int PlacementOrder { get; }
|
||
|
|
|
||
|
|
public PieceState(int id, PieceKind kind, Coords startCell, Coords endCell, int placementOrder)
|
||
|
|
{
|
||
|
|
Id = id;
|
||
|
|
Kind = kind;
|
||
|
|
StartCell = startCell;
|
||
|
|
EndCell = endCell;
|
||
|
|
CurrentCell = startCell;
|
||
|
|
Cargo = null;
|
||
|
|
SocialStatus = PieceRules.GetSocialStatus(kind);
|
||
|
|
PlacementOrder = placementOrder;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Returns the cell this piece will move to next.
|
||
|
|
/// </summary>
|
||
|
|
public Coords TargetCell => CurrentCell == StartCell ? EndCell : StartCell;
|
||
|
|
}
|