namespace Milimoe.FunGame.Core.Model { public class NovelNode { public string Key { get; set; } = ""; public int Priority { get; set; } = 0; public NovelNode? Previous { get; set; } = null; public List NextNodes { get; set; } = []; public NovelNode? Next => NextNodes.OrderByDescending(n => n.Priority).Where(n => n.ShowNode).FirstOrDefault(); public List Options { get; set; } = []; public List AvailableOptions => [.. Options.Where(o => o.ShowOption)]; public string Name { get; set; } = ""; public string Name2 { get; set; } = ""; public string Content { get; set; } = ""; public string PortraitImagePath { get; set; } = ""; public Dictionary> AndPredicates { get; set; } = []; public Dictionary> OrPredicates { get; set; } = []; public bool ShowNode { get { bool andResult = AndPredicates.Values.All(predicate => predicate()); bool orResult = OrPredicates.Values.Any(predicate => predicate()); return andResult && (OrPredicates.Count == 0 || orResult); } } internal Dictionary Values { get; set; } = []; } public class NovelOption { public string Key { get; set; } = ""; public string Name { get; set; } = ""; public List Targets { get; set; } = []; public Dictionary> AndPredicates { get; set; } = []; public Dictionary> OrPredicates { get; set; } = []; public bool ShowOption { get { bool andResult = AndPredicates.Values.All(predicate => predicate()); bool orResult = OrPredicates.Values.Any(predicate => predicate()); return andResult && (OrPredicates.Count == 0 || orResult); } } internal Dictionary Values { get; set; } = []; } }