Compact quick parse legend badges

This commit is contained in:
2026-03-15 13:12:13 +01:00
parent ea328e65bd
commit 1c03ca4586
2 changed files with 46 additions and 18 deletions

View File

@@ -88,7 +88,8 @@
{
<div class="critical-editor-quick-legend-item">
<code>@entry.Token</code>
<span class="muted">@entry.Meaning</span>
<span class="critical-editor-quick-legend-equals">=</span>
<AffixBadgeList Effects="@entry.Effects" />
</div>
}
</div>
@@ -385,17 +386,17 @@
{
WriteIndented = true
};
private static readonly IReadOnlyList<(string Token, string Meaning)> QuickParseLegendEntries =
private static readonly IReadOnlyList<(string Token, IReadOnlyList<CriticalEffectLookupResponse> Effects)> QuickParseLegendEntries =
[
("+15", "Direct hits"),
("3s", "Stunned 3 rounds"),
("1mp", "Must parry 1 round"),
("3np", "No parry 3 rounds"),
("1hpr", "Bleed 1 hit per round"),
("-20", "Foe penalty"),
("+20b", "Attacker bonus next round"),
("+2d10-3pp", "Power-point modifier"),
("w/o shield: +15, 3s", "Conditional line")
("+15", [CreateQuickLegendEffect(CriticalEffectCodes.DirectHits, valueInteger: 15)]),
("3s", [CreateQuickLegendEffect(CriticalEffectCodes.StunnedRounds, durationRounds: 3)]),
("1mp", [CreateQuickLegendEffect(CriticalEffectCodes.MustParryRounds, durationRounds: 1)]),
("3np", [CreateQuickLegendEffect(CriticalEffectCodes.NoParryRounds, durationRounds: 3)]),
("1hpr", [CreateQuickLegendEffect(CriticalEffectCodes.BleedPerRound, perRound: 1)]),
("-20", [CreateQuickLegendEffect(CriticalEffectCodes.FoePenalty, modifier: -20)]),
("+20b", [CreateQuickLegendEffect(CriticalEffectCodes.AttackerBonusNextRound, modifier: 20)]),
("+2d10-3pp", [CreateQuickLegendEffect(CriticalEffectCodes.PowerPointModifier, valueExpression: "2d10-3")]),
("w/o shield: +15, 3s", [CreateQuickLegendEffect(CriticalEffectCodes.DirectHits, valueInteger: 15), CreateQuickLegendEffect(CriticalEffectCodes.StunnedRounds, durationRounds: 3)])
];
private IJSObjectReference? jsModule;
private bool isBackdropPointerDown;
@@ -639,6 +640,26 @@
? "1 parser note is available under Advanced Review & Diagnostics."
: $"{noteCount} parser notes are available under Advanced Review & Diagnostics.";
private static CriticalEffectLookupResponse CreateQuickLegendEffect(
string effectCode,
int? valueInteger = null,
string? valueExpression = null,
int? durationRounds = null,
int? perRound = null,
int? modifier = null) =>
new(
effectCode,
"foe",
valueInteger,
valueExpression,
durationRounds,
perRound,
modifier,
null,
false,
"legend",
null);
private static string FormatJson(string json)
{
if (string.IsNullOrWhiteSpace(json))