ACR_Traps.TrapDisable.IsDisableSuccessful C# (CSharp) Метод

IsDisableSuccessful() публичный статический Метод

public static IsDisableSuccessful ( CLRScriptBase s, ALFA trap, int DC, uint disabler ) : DisableResult
s CLRScriptFramework.CLRScriptBase
trap ALFA
DC int
disabler uint
Результат DisableResult
        public static DisableResult IsDisableSuccessful(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, int DC, uint disabler)
        {
            if (s.GetSkillRank(SKILL_DISABLE_TRAP, disabler, TRUE) == 0)
            {
                s.SendMessageToPC(disabler, "<c=#98FFFF>Disable Device: * Success will never be possible *</c>");
                return DisableResult.Failure;
            }
            
            int roll = s.d20(1);
            int skill = s.GetSkillRank(SKILL_DISABLE_TRAP, disabler, FALSE) + trap.TotalHelp;
            int final = roll + skill;
            string resultString = "Failure!";
            DisableResult value = DisableResult.Failure;
            if (final >= DC)
            {
                value = DisableResult.Success;
                resultString = "Success!";
            }
            if (DC > final + 4)
            {
                value = DisableResult.CriticalFailure;
                resultString = "CRITICAL FAILURE!";
            }
            string message = String.Format("<c=#98FFFF>Disable Device : {0} + {1} = {2} vs. DC {3}. * {4} *</c>", roll, skill, final, DC, resultString);
            s.SendMessageToPC(disabler, message);
            
            return value;
        }