private static SurvivalStat CreateStat( SurvivalStatType type, PersonSurvivalStatType schemeStatType, IPersonSurvivalStatSubScheme[] survivalStats) { var statScheme = survivalStats.SingleOrDefault(x => x.Type == schemeStatType); if (statScheme is null) { return(null); } var keySegmentList = new List <SurvivalStatKeySegment>(); if (statScheme.KeyPoints != null) { AddKeyPointFromScheme(SurvivalStatHazardLevel.Max, PersonSurvivalStatKeypointLevel.Max, statScheme.KeyPoints, keySegmentList); AddKeyPointFromScheme(SurvivalStatHazardLevel.Strong, PersonSurvivalStatKeypointLevel.Strong, statScheme.KeyPoints, keySegmentList); AddKeyPointFromScheme(SurvivalStatHazardLevel.Lesser, PersonSurvivalStatKeypointLevel.Lesser, statScheme.KeyPoints, keySegmentList); } var stat = new SurvivalStat(statScheme.StartValue, statScheme.MinValue, statScheme.MaxValue) { Type = type, Rate = 1, KeySegments = keySegmentList.ToArray(), DownPassRoll = statScheme.DownPassRoll.GetValueOrDefault(SurvivalStat.DEFAULT_DOWN_PASS_VALUE) }; return(stat); }
private static SurvivalStat CreateStatFromScheme(IPersonSurvivalStatSubScheme[] survivalStats, SurvivalStatType statType, PersonSurvivalStatType schemeStatType) { var stat = CreateStat(statType, schemeStatType, survivalStats); return(stat ?? null); }