using System; using System.Collections.Generic; namespace Models; /// /// 任务类型枚举 /// public enum TaskType { Paper, // 论文:重学术(Intelligence) + 表达(Expression) Project, // 项目:重工程(Strength) + 学术(Intelligence) Admin // 杂务:消耗体力,低收益,但必须做 } /// /// 任务 (Task) /// 核心游戏对象之一,相当于地图上的“怪物”。 /// 学生需要“攻击”任务(消耗工作量)来完成它。 /// public class Task { public Guid Id { get; private set; } = Guid.NewGuid(); /// /// 任务名称 /// public string Name { get; set; } /// /// 任务类型 /// public TaskType Type { get; set; } /// /// 总工作量 (HP) /// public float TotalWorkload { get; set; } /// /// 当前进度 /// public float CurrentProgress { get; set; } /// /// 难度系数 (Defense) /// 影响学生攻克该任务的效率。若学生能力低于难度,效率会大幅下降。 /// public float Difficulty { get; set; } /// /// 截止日期 (剩余回合数) /// 归零时如果未完成,触发失败惩罚。 /// public int Deadline { get; set; } /// /// 奖励:经费 /// public int RewardMoney { get; set; } /// /// 奖励:声望 /// public int RewardReputation { get; set; } /// /// 任务是否已完成 /// public bool IsCompleted => CurrentProgress >= TotalWorkload; /// /// 任务是否已失败(超时未完成) /// public bool IsFailed => Deadline <= 0 && !IsCompleted; public Task(string name, TaskType type, float workload, int deadline) { Name = name; Type = type; TotalWorkload = workload; Deadline = deadline; CurrentProgress = 0; Difficulty = 1.0f; } /// /// 增加进度 /// /// 工作量数值 public void AddProgress(float amount) { CurrentProgress += amount; if (CurrentProgress > TotalWorkload) CurrentProgress = TotalWorkload; } }