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.
22 lines
865 B
C#
22 lines
865 B
C#
namespace Chessistics.Engine.Model;
|
|
|
|
public class CampaignState
|
|
{
|
|
public CampaignDef CampaignDef { get; }
|
|
public int CurrentMissionIndex { get; set; }
|
|
public List<int> CompletedMissions { get; } = new();
|
|
public HashSet<PieceKind> AvailablePieceKinds { get; } = new();
|
|
public HashSet<PieceUpgrade> AvailableLevels { get; } = new();
|
|
|
|
public CampaignState(CampaignDef campaignDef)
|
|
{
|
|
CampaignDef = campaignDef;
|
|
CurrentMissionIndex = 0;
|
|
}
|
|
|
|
public MissionDef CurrentMission => CampaignDef.Missions[CurrentMissionIndex];
|
|
public bool IsLastMission => CurrentMissionIndex >= CampaignDef.Missions.Count - 1;
|
|
|
|
public bool IsPieceAvailable(PieceKind kind) => AvailablePieceKinds.Contains(kind);
|
|
public bool IsLevelAvailable(PieceKind kind, int level) => AvailableLevels.Contains(new PieceUpgrade(kind, level));
|
|
}
|