Add rolemaster automatic retry rolls
This commit is contained in:
32
RpgRoller/Services/RolemasterRetryPolicy.cs
Normal file
32
RpgRoller/Services/RolemasterRetryPolicy.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace RpgRoller.Services;
|
||||
|
||||
public static class RolemasterRetryPolicy
|
||||
{
|
||||
public static int? ResolveAutoRetryBonus(int firstResult)
|
||||
{
|
||||
if (firstResult is >= 77 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):";
|
||||
}
|
||||
Reference in New Issue
Block a user