Add OB and DB to attack lookup
This commit is contained in:
12
src/RolemasterDb.App/Features/AttackResolutionCalculator.cs
Normal file
12
src/RolemasterDb.App/Features/AttackResolutionCalculator.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace RolemasterDb.App.Features;
|
||||
|
||||
public static class AttackResolutionCalculator
|
||||
{
|
||||
public static AttackResolutionSummary Resolve(int rawRoll, int offensiveBonus, int defensiveBonus) =>
|
||||
new(rawRoll, offensiveBonus, defensiveBonus, rawRoll + offensiveBonus - defensiveBonus);
|
||||
|
||||
public static bool IsFumble(AttackResolutionSummary resolution, AttackTableReference? table) =>
|
||||
table is { FumbleMinRoll: int fumbleMinRoll, FumbleMaxRoll: int fumbleMaxRoll } &&
|
||||
resolution.RawRoll >= fumbleMinRoll &&
|
||||
resolution.RawRoll <= fumbleMaxRoll;
|
||||
}
|
||||
Reference in New Issue
Block a user