Пример #1
0
    public void battleWon()
    {
        experience += 1.0f;

        if (experience >= experienceTarget && level < levelCap)
        {
            level++;
            experience       = 0.0f;
            experienceTarget = experienceTarget * experienceFactor;

            EvaluationProtocol.Stats statToUpgrade = distribution[Rng.generateRandomInt(0, distribution.Count - 1)];
            baseFactors[statToUpgrade] += growthFactor;

            if (Rng.generateRandomInt(0, 1000) > 970)
            {
                statToUpgrade = distribution[Rng.generateRandomInt(0, distribution.Count - 1)];
                baseFactors[statToUpgrade] += growthFactor;
            }
        }
    }
Пример #2
0
 public void modifyStat(EvaluationProtocol.Stats stat, int value)
 {
     if (stat.Equals(EvaluationProtocol.Stats.Accuracy))
     {
         accuracy = value;
     }
     else if (stat.Equals(EvaluationProtocol.Stats.Endurance))
     {
         endurance = value;
     }
     else if (stat.Equals(EvaluationProtocol.Stats.Health))
     {
         health = value;
     }
     else if (stat.Equals(EvaluationProtocol.Stats.Speed))
     {
         speed = value;
     }
     else if (stat.Equals(EvaluationProtocol.Stats.Strength))
     {
         strength = value;
     }
 }
Пример #3
0
    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]));
    }
Пример #4
0
 public float getStat(EvaluationProtocol.Stats stat)
 {
     return(baseFactors[stat]);
 }