32 lines
809 B
C#
32 lines
809 B
C#
namespace RpgRoller.Services;
|
|
|
|
public static class RolemasterRetryPolicy
|
|
{
|
|
public static int? ResolveAutoRetryBonus(int firstResult)
|
|
{
|
|
if (firstResult is >= 76 and <= 90)
|
|
return 5;
|
|
|
|
if (firstResult is >= 91 and <= 110)
|
|
return 10;
|
|
|
|
return null;
|
|
}
|
|
|
|
public static int? TryExtractRetryBonus(string? breakdown)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(breakdown))
|
|
return null;
|
|
|
|
if (breakdown.Contains(RetryPlusFiveMarker, StringComparison.Ordinal))
|
|
return 5;
|
|
|
|
if (breakdown.Contains(RetryPlusTenMarker, StringComparison.Ordinal))
|
|
return 10;
|
|
|
|
return null;
|
|
}
|
|
|
|
public const string RetryPlusFiveMarker = "; retry(+5):";
|
|
public const string RetryPlusTenMarker = "; retry(+10):";
|
|
} |