public void LearningMultiplier() { var special = new FastLearner(); data.AddSpecial(special); int increment = 10; data.IncrementFreeScore(increment); Assert.AreEqual(data.FreeScore, increment * (1f + special.GetLearningMultiplier())); }
/// <summary> /// Generates a Special Employee, by generating Skills Special, etc. for the Employee. /// </summary> /// <param name="empDef">The EmployeeDefinition this Employee is built upon.</param> /// <returns>Employee Data for the EmployeeDefinition</returns> public virtual EmployeeData GenerateSpecialEmployee(EmployeeDefinition empDef) { EmployeeData employee = new EmployeeData { EmployeeDefinition = empDef, Skills = GenerateSkills(), hireableDays = empDef.SpawnLikelihood == 1 ? -1 : rnd.Next(3, 7) }; foreach (var special in empDef.EmployeeSpecials) { var matches = EmployeeSpecials.Where(s => s.Name == special).ToList(); if (matches.Any()) { var instance = (EmployeeSpecial)Activator.CreateInstance(matches.First()); employee.AddSpecial(instance); } } addSpecials(employee); LevelUpSkills(employee.Skills); employee.Salary = calcSalary(employee); employee.Prize = calcPrize(employee); return(employee); }
private static void addSpecials(EmployeeData employee) { if (RandomUtils.RollDice(20) == 13) { EmployeeSpecial special; do { special = (EmployeeSpecial)Activator.CreateInstance(EmployeeSpecials.RandomElement()); } while (!special.IsLearnable() || employee.GetSpecials().Any(e => e.GetType() == special.GetType())); employee.AddSpecial(special); } }