// // SkillSelector.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using NosSmooth.Data.Abstractions.Enums; using NosSmooth.Extensions.Combat.Errors; using NosSmooth.Extensions.Combat.Selectors; using NosSmooth.Game.Data.Characters; using Remora.Results; namespace SimplePiiBot; /// /// Selects skill for the pii bot. /// public class SkillSelector : ISkillSelector { private bool _isPii; /// /// Initializes a new instance of the class. /// /// Whether the target entity is a pii (false for pii pod). public SkillSelector(bool isPii) { _isPii = isPii; } /// public Result GetSelectedSkill(IEnumerable usableSkills) { var skills = usableSkills.ToList(); var skill = skills.MaxBy(x => x.Info!.Range); if (_isPii) { // try to find skill that does area damage skill = skills.MinBy(x => x.Info!.HitType == HitType.EnemiesInZone ? 0 : 1); } if (skill is null) { return new SkillNotFoundError(); } return skill; } }