コード例 #1
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));
        }
コード例 #2
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);
        }