Chessistics/chessistics-engine/Model/PieceState.cs
Samuel Bouchet a7280b1a5a Overhaul turn mechanics, collision destruction, and visual animations
- New turn order: produce -> transfer -> move -> collision resolution
- Collisions now destroy weaker pieces (status > level > mutual destruction)
  instead of halting the simulation. SimPhase.Collision removed.
- Add piece Level property (all level 1 in proto, prepared for future)
- Production fires every turn (interval concept removed), buffer = Amount
  (default 1, future 2-4), leftovers overwritten each turn
- Transfer tiebreaker: status > level > clockwise direction (alternating
  even/odd turns in y-up coords), replaces distance-to-production
- Demands always accept matching cargo even when already satisfied
- TurnNumber added to all turn events for animation grouping
- Simultaneous animations: produce flash, cargo slide, parallel piece moves
- Camera centering fix + middle-click pan
- GDD updated with new rules + lore section added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:44:12 +02:00

33 lines
1,012 B
C#

namespace Chessistics.Engine.Model;
public class PieceState
{
public int Id { get; }
public PieceKind Kind { get; }
public int Level { get; }
public Coords StartCell { get; }
public Coords EndCell { get; }
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;
}