Add OB and DB to attack lookup

This commit is contained in:
2026-03-15 02:54:30 +01:00
parent cada74c7ac
commit dea0f97e91
4 changed files with 138 additions and 23 deletions

View 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;
}

View File

@@ -0,0 +1,7 @@
namespace RolemasterDb.App.Features;
public sealed record AttackResolutionSummary(
int RawRoll,
int OffensiveBonus,
int DefensiveBonus,
int EffectiveTotal);