/// <summary> /// Generate a trainings array from the skills already know by a character. /// </summary> /// <param name="character">The character.</param> /// <param name="plan">The plan.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">character or plan</exception> public static RemappingResult OptimizeFromCharacter(Character character, BasePlan plan) { character.ThrowIfNull(nameof(character)); plan.ThrowIfNull(nameof(plan)); // Create a character without any skill CharacterScratchpad scratchpad = new CharacterScratchpad(character.After(plan.ChosenImplantSet)); scratchpad.ClearSkills(); // Create a new plan Plan newPlan = new Plan(scratchpad); // Add all trained skill levels that the character has trained so far foreach (Skill skill in character.Skills) { newPlan.PlanTo(skill, skill.Level); } // Create a new remapping RemappingResult remapping = new RemappingResult(scratchpad); // Add those skills to the remapping foreach (PlanEntry entry in newPlan) { remapping.Skills.Add(entry); } // Optimize remapping.Optimize(TimeSpan.MaxValue); return(remapping); }
/// <summary> /// Compute the best remapping for the first year of this plan. /// </summary> /// <param name="plan"></param> /// <returns></returns> public static RemappingResult OptimizeFromFirstYearOfPlan(BasePlan plan) { var remapping = new RemappingResult(new CharacterScratchpad(plan.Character.After(plan.ChosenImplantSet))); // Scroll through the entries and split it into remappings foreach (var entry in plan) { remapping.Skills.Add(entry); } // Compute remapping.Optimize(TimeSpan.FromDays(365.0)); return(remapping); }
/// <summary> /// Starts optimization. /// </summary> /// <param name="update">if set to <c>true</c> [update].</param> /// <exception cref="System.NotImplementedException"></exception> private void Run(bool update = false) { // Compute best scratchpad RemappingResult remapping = null; ICollection <RemappingResult> remappingList = null; switch (m_strategy) { case AttributeOptimizationStrategy.ManualRemappingPointEdition: m_areRemappingPointsActive = true; if (update) { remapping = m_remapping; m_manuallyEditedRemappingPoint = remapping.Point.Clone(); } else { remapping = AttributesOptimizer.GetResultsFromRemappingPoints(m_plan).Single( x => x.Point == m_manuallyEditedRemappingPoint); m_manuallyEditedRemappingPoint = m_manuallyEditedRemappingPoint.Clone(); m_remapping = remapping; } remapping.Optimize(TimeSpan.MaxValue); break; case AttributeOptimizationStrategy.Character: m_areRemappingPointsActive = false; remapping = AttributesOptimizer.OptimizeFromCharacter(m_character, m_plan); break; case AttributeOptimizationStrategy.OneYearPlan: m_areRemappingPointsActive = false; remapping = AttributesOptimizer.OptimizeFromFirstYearOfPlan(m_plan); break; case AttributeOptimizationStrategy.RemappingPoints: m_areRemappingPointsActive = true; remappingList = AttributesOptimizer.OptimizeFromPlanAndRemappingPoints(m_plan); break; default: throw new NotImplementedException(); } // Update the controls for every attribute Dispatcher.Invoke(() => UpdateForm(remapping, remappingList)); }
/// <summary> /// Generate a trainings array from the skills already know by a character /// </summary> /// <param name="character"></param> /// <returns></returns> public static RemappingResult OptimizeFromCharacter(Character character) { // Create a character without any skill var scratchpad = new CharacterScratchpad(character); scratchpad.ClearSkills(); // Create a sorted plan for the learning skills var plan = new Plan(scratchpad); foreach (var learning in character.SkillGroups["Learning"]) { plan.PlanTo(learning, learning.Level); } plan.SortLearningSkills(false); // Add the non-training skills after that foreach (var skill in character.Skills) { if (skill.Group.Name != "Learning") { plan.PlanTo(skill, skill.Level); } } // Add those learning skills to a list var remapping = new RemappingResult(scratchpad); foreach (var entry in plan) { remapping.Skills.Add(entry); } // Optimize remapping.Optimize(TimeSpan.FromDays(365.0)); return(remapping); }