2023-10-04 22:07:36 +00:00
|
|
|
|
using System.Collections.Generic;
|
2023-10-01 20:50:21 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Workshoppa.GameData;
|
|
|
|
|
|
|
|
|
|
public sealed class CraftState
|
|
|
|
|
{
|
|
|
|
|
public required uint ResultItem { get; init; }
|
|
|
|
|
public required uint StepsComplete { get; init; }
|
|
|
|
|
public required uint StepsTotal { get; init; }
|
2024-03-20 18:52:54 +00:00
|
|
|
|
public required IReadOnlyList<CraftItem> Items { get; init; }
|
2023-10-01 20:50:21 +00:00
|
|
|
|
|
|
|
|
|
public bool IsPhaseComplete() => Items.All(x => x.Finished || x.StepsComplete == x.StepsTotal);
|
|
|
|
|
|
|
|
|
|
public bool IsCraftComplete() => StepsComplete == StepsTotal - 1 && IsPhaseComplete();
|
|
|
|
|
}
|