public static bool ShouldSkipCombatTraining(Pawn pawn)
        {
            ClearYesterdaysSkillValues(pawn);
            SkillRecord currentSkill = GetCurrentSkill(pawn);

            if (currentSkill.xpSinceMidnight > 4000f)
            {
                return(true);
            }
            if (currentSkill.Level >= 20)
            {
                return(true);
            }
            SkillXpValues lastSkillXpValues = GetLastSkillXpValues(pawn);

            if (lastSkillXpValues == null)
            {
                return(false);
            }
            if (lastSkillXpValues.XpSinceMidnight >= 4000f)
            {
                return((double)currentSkill.xpSinceMidnight > 3000.0);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public static bool ShouldSkipCombatTraining(Pawn pawn)
        {
            // Reset the pawn's skill values if it is a new day.
            ClearYesterdaysSkillValues(pawn);

            SkillRecord skill = GetCurrentSkill(pawn);

            // Skip training if the max full rate xp has been reached today.
            if (skill.xpSinceMidnight > SkillRecord.MaxFullRateXpPerDay)
            {
                return(true);
            }

            // If the pawn has already trained today then it will have a SkillXpValues object.
            // If it does not then it has not trained today, so do not skip training.
            SkillXpValues lastSkillXpValues = GetLastSkillXpValues(pawn);

            if (lastSkillXpValues == null)
            {
                return(false);
            }

            // If the pawn is 20 and hit the maximum possible XP during the last training session today, then skip training.
            if (skill.Level == 20 && lastSkillXpValues.XpSinceLastLevel >= skill.XpRequiredForLevelUp - 1f)
            {
                return(true);
            }

            // If the pawn's last training session caused it to go over the max daily XP, but the skill has now degraded below
            // 75% of the max daily xp, then do not skip training.
            if (lastSkillXpValues.XpSinceMidnight >= SkillRecord.MaxFullRateXpPerDay)
            {
                return(skill.xpSinceMidnight > SkillRecord.MaxFullRateXpPerDay * 0.75);
            }

            // Otherwise, do not skip training.
            return(false);
        }