/// <summary> /// Tries to update the mastery level status. /// </summary> public bool TryUpdateMasteryStatus() { if (m_updated) { return(false); } bool noPrereq = true; bool trained = true; // Scan prerequisite skills foreach (SkillLevel prereqSkill in GetPrerequisiteSkills()) { // Trained only if the skill's level is greater or equal to the minimum level trained = trained && prereqSkill.Skill.Level >= prereqSkill.Level; noPrereq = noPrereq && prereqSkill.AllDependencies.All(x => !x.IsTrained); } // Updates status if (trained) { Status = MasteryStatus.Trained; } else if (noPrereq) { Status = MasteryStatus.Untrained; } else { Status = MasteryStatus.PartiallyTrained; } m_updated = true; return(true); }
/// <summary> /// Sets this mastery as "untrained", a useful optimization for low-SP characters /// (which are more numerous than maxed chars) /// </summary> public bool SetAsUntrained() { if (m_updated) { return(false); } m_updated = true; Status = MasteryStatus.Untrained; return(true); }