Exemple #1
0
        public override void ExposeData()
        {
            base.ExposeData();

            Scribe_Values.Look(ref GracePeriodHours, GraceSkillHelpers.SerialisationLabel(nameof(GracePeriodHours)));
            Scribe_Values.Look(ref PassionGraceMultiplierPercent, GraceSkillHelpers.SerialisationLabel(nameof(PassionGraceMultiplierPercent)));
            Scribe_Values.Look(ref BurningPassionGraceMultiplierPercent, GraceSkillHelpers.SerialisationLabel(nameof(BurningPassionGraceMultiplierPercent)));
            Scribe_Values.Look(ref GreatMemoryGraceMultiplierPercent, GraceSkillHelpers.SerialisationLabel(nameof(GreatMemoryGraceMultiplierPercent)));

            Log.Message($"SkillAndGrace initialised. GracePeriod: {GracePeriodHours}, PassionMultiplier: {PassionGraceMultiplierPercent}, BurningPassionMultiplier: {BurningPassionGraceMultiplierPercent}, GreatMemoryMultiplier: {GreatMemoryGraceMultiplierPercent}");
        }
Exemple #2
0
        internal static bool Prefix(SkillRecord __instance)
        {
            if (GraceSkillHelpers.IgnoreSkill(__instance))
            {
                return(true);
            }

            var pawn = __instance.GetPawn();

            var grace = pawn.GetGrace();

            if (!GraceSkillHelpers.TryGetTimeSinceLastUse(grace, __instance, out var ticksSinceLastUse))
            {
                return(true);
            }

            return(!SkillIsWithinGracePeriod(__instance, pawn, ticksSinceLastUse));
        }
Exemple #3
0
        internal static void Postfix(SkillRecord __instance, float xp, bool direct)
        {
            if (xp <= 0)
            {
                // Don't do anything with degrading skills
                return;
            }

            if (GraceSkillHelpers.IgnoreSkill(__instance))
            {
                // Ignore skills too low to degrade
                return;
            }

            var pawn  = __instance.GetPawn();
            var grace = pawn.GetGrace();

            GraceSkillHelpers.SetSkillUsed(grace, __instance);
        }
        public override void PostExposeData()
        {
            base.PostExposeData();

            Scribe_Collections.Look(ref Properties.SkillPeriods, GraceSkillHelpers.SerialisationLabel(nameof(GraceProperties.SkillPeriods)), LookMode.Deep);
        }