public static bool CanPerformSkill(Character user, Character target, Skill skill) { var container = new SkillValidationContainer(skill, user, target); var result = true; // Every skill needs to have these validators applied result &= EvaluateRequirementsForAllSkillTypes(container); // If your skill has a target, apply the below validators if (skill.SkillTemplate.SkillActivationType == SkillActivationType.Target) result &= EvaluateRequirementsForTargetSkillTypes(container); return result; }
private static bool EvaluateRequirementsForTargetSkillTypes(SkillValidationContainer container) { return _skillTargetInRangeValidator.And(_targetValidator).IsSatisfiedBy(container); }
private static bool EvaluateRequirementsForAllSkillTypes(SkillValidationContainer container) { return _skillCooldownValidator.And(_skillResourceCostValidator).IsSatisfiedBy(container); }