public void upgradeFacilities(ref DataPool worldData, float elo, BoxerClass.Type preference) { int pointsToGive = EvaluationProtocol.getFacilityPointsFromElo(elo); List <ManagerProtocol.FacilityShortcut> upgrades = new List <ManagerProtocol.FacilityShortcut> (new ManagerProtocol.FacilityShortcut[] { ManagerProtocol.FacilityShortcut.DoubleEndBag, ManagerProtocol.FacilityShortcut.PunchGlove, ManagerProtocol.FacilityShortcut.Laps, ManagerProtocol.FacilityShortcut.Sprints, ManagerProtocol.FacilityShortcut.PunchingBag }); List <EvaluationProtocol.Stats> bestStats = BoxerClass.getBuild(preference); foreach (EvaluationProtocol.Stats stat in bestStats) { if (stat.Equals(EvaluationProtocol.Stats.AccuracyGrowth)) { upgrades.Add(ManagerProtocol.FacilityShortcut.DoubleEndBag); } else if (stat.Equals(EvaluationProtocol.Stats.EnduranceGrowth)) { upgrades.Add(ManagerProtocol.FacilityShortcut.PunchGlove); } else if (stat.Equals(EvaluationProtocol.Stats.HealthGrowth)) { upgrades.Add(ManagerProtocol.FacilityShortcut.Laps); } else if (stat.Equals(EvaluationProtocol.Stats.SpeedGrowth)) { upgrades.Add(ManagerProtocol.FacilityShortcut.Sprints); } else if (stat.Equals(EvaluationProtocol.Stats.StrengthGrowth)) { upgrades.Add(ManagerProtocol.FacilityShortcut.PunchingBag); } } for (int i = 0; i < pointsToGive; i++) { if (upgrades.Count > 0) { ManagerProtocol.FacilityShortcut upgrade = upgrades [generateRandomInt(0, upgrades.Count - 1)]; homeBaseFacilities [upgrade].upgradeFacility(ref worldData); if (homeBaseFacilities [upgrade].Level == 5) { upgrades.Remove(upgrade); if (upgrades.IndexOf(upgrade) >= 0) { upgrades.Remove(upgrade); } } } } }
private void setupTrainingRegime() { trainingRegime.Add(ManagerProtocol.FacilityShortcut.DoubleEndBag); trainingRegime.Add(ManagerProtocol.FacilityShortcut.Laps); trainingRegime.Add(ManagerProtocol.FacilityShortcut.PunchGlove); trainingRegime.Add(ManagerProtocol.FacilityShortcut.PunchingBag); trainingRegime.Add(ManagerProtocol.FacilityShortcut.Sprints); List <EvaluationProtocol.Stats> bestStats = BoxerClass.getBuild(preference); foreach (EvaluationProtocol.Stats stat in bestStats) { ManagerProtocol.FacilityShortcut shortcut = ManagerProtocol.FacilityShortcut.DoubleEndBag; if (stat.Equals(EvaluationProtocol.Stats.AccuracyGrowth)) { shortcut = ManagerProtocol.FacilityShortcut.DoubleEndBag; } else if (stat.Equals(EvaluationProtocol.Stats.EnduranceGrowth)) { shortcut = ManagerProtocol.FacilityShortcut.PunchGlove; } else if (stat.Equals(EvaluationProtocol.Stats.HealthGrowth)) { shortcut = ManagerProtocol.FacilityShortcut.Laps; } else if (stat.Equals(EvaluationProtocol.Stats.SpeedGrowth)) { shortcut = ManagerProtocol.FacilityShortcut.Sprints; } else if (stat.Equals(EvaluationProtocol.Stats.StrengthGrowth)) { shortcut = ManagerProtocol.FacilityShortcut.PunchingBag; } for (int i = 0; i < 2; i++) { trainingRegime.Add(shortcut); } } }
private static void ageAndDevelop(ref DataPool worldData, int index, TournamentProtocol.Level level) { float agePercentage = getAgeFromLevel(level); List <EvaluationProtocol.Stats> bestTraits = new List <EvaluationProtocol.Stats>(); List <EvaluationProtocol.Stats> secondaryTraits = new List <EvaluationProtocol.Stats>(); List <EvaluationProtocol.Stats> build = BoxerClass.getBuild(worldData.Boxers[index].BoxerClass); if (build.Contains(EvaluationProtocol.Stats.AccuracyGrowth)) { bestTraits.Add(EvaluationProtocol.Stats.Accuracy); } else { secondaryTraits.Add(EvaluationProtocol.Stats.Accuracy); } if (build.Contains(EvaluationProtocol.Stats.EnduranceGrowth)) { bestTraits.Add(EvaluationProtocol.Stats.Endurance); } else { secondaryTraits.Add(EvaluationProtocol.Stats.Endurance); } if (build.Contains(EvaluationProtocol.Stats.HealthGrowth)) { bestTraits.Add(EvaluationProtocol.Stats.Health); } else { secondaryTraits.Add(EvaluationProtocol.Stats.Health); } if (build.Contains(EvaluationProtocol.Stats.SpeedGrowth)) { bestTraits.Add(EvaluationProtocol.Stats.Speed); } else { secondaryTraits.Add(EvaluationProtocol.Stats.Speed); } if (build.Contains(EvaluationProtocol.Stats.StrengthGrowth)) { bestTraits.Add(EvaluationProtocol.Stats.Strength); } else { secondaryTraits.Add(EvaluationProtocol.Stats.Strength); } foreach (EvaluationProtocol.Stats stat in bestTraits) { float value = getPrimaryStatFromLevel(level) * (agePercentage / 100.0f); value = value < 55.0f ? 55.0f : value; worldData.Boxers[index].modifyStat(stat, Mathf.RoundToInt(value)); } foreach (EvaluationProtocol.Stats stat in secondaryTraits) { float value = getSecondaryStatFromLevel(level) * (agePercentage / 100.0f); value = value < 40.0f ? 40.0f : value; worldData.Boxers[index].modifyStat(stat, Mathf.RoundToInt(value)); } worldData.Boxers[index].cutLife(Mathf.RoundToInt(worldData.Boxers[index].WeeksRemaining * (agePercentage / 100.0f))); }
public static Boxer createBoxerBasedOnFame(string firstName, string lastName, int townIndex, float elo, WeightClass.WClass wClass) { int pointsToGive = EvaluationProtocol.getBoxerPointsFromFame(elo); int badStatRates = Mathf.RoundToInt((pointsToGive / 3) / 2); badStatRates = badStatRates < 1 ? 1 : badStatRates; List <BoxerClass.Type> possibleClasses = BoxerClass.getClassesBasedOnWeight(wClass); List <EvaluationProtocol.Stats> stats = new List <EvaluationProtocol.Stats>(new EvaluationProtocol.Stats[] { EvaluationProtocol.Stats.AccuracyGrowth, EvaluationProtocol.Stats.EnduranceGrowth, EvaluationProtocol.Stats.HealthGrowth, EvaluationProtocol.Stats.SpeedGrowth, EvaluationProtocol.Stats.StrengthGrowth }); Dictionary <EvaluationProtocol.Stats, int> growthRates = new Dictionary <EvaluationProtocol.Stats, int>(); Dictionary <EvaluationProtocol.Stats, int> statValues = new Dictionary <EvaluationProtocol.Stats, int>(); foreach (EvaluationProtocol.Stats stat in stats) { growthRates.Add(stat, badStatRates); } BoxerClass.Type bClass = possibleClasses[generateRandomInt(0, possibleClasses.Count - 1)]; List <EvaluationProtocol.Stats> bestStats = BoxerClass.getBuild(bClass); for (int i = 0; i < 3; i++) { int baseStat = Mathf.RoundToInt(pointsToGive / (3 - i)); if (pointsToGive > 1) { baseStat = generateRandomInt(baseStat - 1, baseStat + 1); baseStat = baseStat < 1 ? 1 : baseStat; baseStat = baseStat > 10 ? 10 : baseStat; baseStat = (pointsToGive - baseStat) < 2 ? baseStat - 1 : baseStat; baseStat = baseStat < 1 ? 1 : baseStat; } else { baseStat = pointsToGive; } EvaluationProtocol.Stats stat = bestStats[generateRandomInt(0, bestStats.Count - 1)]; growthRates[stat] = baseStat; bestStats.RemoveAt(bestStats.IndexOf(stat)); pointsToGive -= baseStat; } int acc = EvaluationProtocol.getStatValueFromGrowthRate(growthRates[EvaluationProtocol.Stats.AccuracyGrowth]); int end = EvaluationProtocol.getStatValueFromGrowthRate(growthRates[EvaluationProtocol.Stats.EnduranceGrowth]); int hlt = EvaluationProtocol.getStatValueFromGrowthRate(growthRates[EvaluationProtocol.Stats.HealthGrowth]); int spd = EvaluationProtocol.getStatValueFromGrowthRate(growthRates[EvaluationProtocol.Stats.SpeedGrowth]); int str = EvaluationProtocol.getStatValueFromGrowthRate(growthRates[EvaluationProtocol.Stats.StrengthGrowth]); statValues.Add(EvaluationProtocol.Stats.Accuracy, generateRandomInt(acc - 4, acc + 4)); statValues.Add(EvaluationProtocol.Stats.Endurance, generateRandomInt(end - 4, end + 4)); statValues.Add(EvaluationProtocol.Stats.Health, generateRandomInt(hlt - 4, hlt + 4)); statValues.Add(EvaluationProtocol.Stats.Speed, generateRandomInt(spd - 4, spd + 4)); statValues.Add(EvaluationProtocol.Stats.Strength, generateRandomInt(str - 4, str + 4)); return(new Boxer( new Vector2Int(0, 1), firstName, lastName, townIndex, generateWeightFromClass(wClass), bClass, statValues[EvaluationProtocol.Stats.Accuracy], growthRates[EvaluationProtocol.Stats.AccuracyGrowth], statValues[EvaluationProtocol.Stats.Endurance], growthRates[EvaluationProtocol.Stats.EnduranceGrowth], statValues[EvaluationProtocol.Stats.Health], growthRates[EvaluationProtocol.Stats.HealthGrowth], statValues[EvaluationProtocol.Stats.Speed], growthRates[EvaluationProtocol.Stats.SpeedGrowth], statValues[EvaluationProtocol.Stats.Strength], growthRates[EvaluationProtocol.Stats.StrengthGrowth])); }