using System;
using System.Collections.Generic;
namespace Models;
///
/// 学生数据模型 (StudentModel)
/// 设计说明:
/// 1) 不再继承 UnitModel,而是通过 Core 组合通用组件(属性/状态/标签/装备等)。
/// 2) 学生特有内容(年级/体力/忠诚/署名贡献)放在独立组件中,保持高内聚。
/// 3) Model 层仅负责数据,不做 Godot 行为调用,方便后续存档与 Mod 注入。
/// 注意事项:
/// - Traits 实际上是标签(Tag),统一走 Core.Tags.TraitIds,避免双份真相。
/// - Grade 仅表示“学年进度”,不是学术能力值。
/// 未来扩展:
/// - 可新增“毕业/退学事件队列”,由系统层驱动。
/// - 可新增“论文署名历史”用于复盘与羁绊叠层回溯。
///
public sealed class StudentModel
{
///
/// 学生类型
///
public enum StudentType
{
MasterCandidate, // 硕士生
DoctorCandidate // 博士生
}
///
/// 核心单位数据
///
public UnitModel Core { get; }
///
/// 学生类型
///
public StudentType Type { get; private set; }
///
/// 进度数据
///
public StudentProgress Progress { get; }
///
/// 贡献记录
///
public StudentContributions Contributions { get; }
///
/// 名字(便捷访问)
///
public string Name
{
get => Core.Name;
set => Core.Name = value;
}
///
/// 特质列表(便捷访问)
///
public List Traits => Core.Tags.TraitIds;
///
/// 构造函数
///
/// 名字
/// 随机数生成器
public StudentModel(string name, Random random = null)
{
var rng = random ?? Random.Shared;
Core = new UnitModel(name, rng);
Type = rng.Next(2) == 0 ? StudentType.MasterCandidate : StudentType.DoctorCandidate;
Progress = new StudentProgress(Type);
Contributions = new StudentContributions();
}
}
///
/// 学生进度组件(只关心学生生命周期)
///
public sealed class StudentProgress
{
///
/// 体力
///
public StatusValue Stamina { get; set; }
///
/// 忠诚度
///
public StatusValue Loyalty { get; set; }
///
/// 年级
///
public PropertyValue Grade { get; set; }
public StudentProgress(StudentModel.StudentType type)
{
Stamina = new StatusValue(100, 100, 0);
Loyalty = new StatusValue(80, 100, 0);
var maxGrade = type == StudentModel.StudentType.DoctorCandidate ? 6 : 3;
Grade = new PropertyValue(0, 0, maxGrade);
}
}
///
/// 署名贡献记录(任务 -> 贡献值)
///
public sealed class StudentContributions
{
///
/// 按任务ID索引的贡献值
///
public Dictionary ByTask { get; } = new();
}