Bundles in-flight work on the campaign/missions system (CampaignDef, MissionDef, TerrainPatch, TransformerDef, MissionChecker, CampaignLoader, FlavorBanner, transformer rules), plan files, and matching tests. Baseline commit so the upcoming automation testing harness lands on a clean tree.
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
namespace Chessistics.Engine.Model;
|
|
|
|
public class PieceState
|
|
{
|
|
public int Id { get; }
|
|
public PieceKind Kind { get; }
|
|
public int Level { get; }
|
|
public Coords StartCell { get; private set; }
|
|
public Coords EndCell { get; private set; }
|
|
public Coords CurrentCell { get; set; }
|
|
public CargoType? Cargo { get; set; }
|
|
public CargoType? CargoFilter { get; set; }
|
|
public int SocialStatus { get; }
|
|
public int PlacementOrder { get; }
|
|
|
|
public PieceState(int id, PieceKind kind, Coords startCell, Coords endCell, int placementOrder, int level = 1)
|
|
{
|
|
Id = id;
|
|
Kind = kind;
|
|
Level = level;
|
|
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;
|
|
|
|
/// <summary>
|
|
/// Relocate this piece (drag & drop).
|
|
/// </summary>
|
|
public void SetPosition(Coords newStart, Coords newEnd)
|
|
{
|
|
StartCell = newStart;
|
|
EndCell = newEnd;
|
|
CurrentCell = newStart;
|
|
}
|
|
}
|