Implement phase 6 critical effect normalization
This commit is contained in:
@@ -49,6 +49,43 @@
|
||||
<div class="callout">
|
||||
<h4>Affix Text</h4>
|
||||
<p class="stacked-copy">@Result.AffixText</p>
|
||||
|
||||
@if (Result.Effects.Count > 0)
|
||||
{
|
||||
<div class="effect-stack">
|
||||
<h5>Parsed Affixes</h5>
|
||||
<ul class="effect-list">
|
||||
@foreach (var effect in Result.Effects)
|
||||
{
|
||||
<li class="effect-item">
|
||||
@if (!string.IsNullOrWhiteSpace(effect.SourceText))
|
||||
{
|
||||
<code class="effect-token">@effect.SourceText</code>
|
||||
}
|
||||
<span>@FormatEffect(effect)</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else if (Result.Effects.Count > 0)
|
||||
{
|
||||
<div class="callout">
|
||||
<h4>Parsed Affixes</h4>
|
||||
<ul class="effect-list">
|
||||
@foreach (var effect in Result.Effects)
|
||||
{
|
||||
<li class="effect-item">
|
||||
@if (!string.IsNullOrWhiteSpace(effect.SourceText))
|
||||
{
|
||||
<code class="effect-token">@effect.SourceText</code>
|
||||
}
|
||||
<span>@FormatEffect(effect)</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -71,6 +108,22 @@
|
||||
{
|
||||
<p class="stacked-copy branch-affix">@branch.AffixText</p>
|
||||
}
|
||||
|
||||
@if (branch.Effects.Count > 0)
|
||||
{
|
||||
<ul class="effect-list branch-effects">
|
||||
@foreach (var effect in branch.Effects)
|
||||
{
|
||||
<li class="effect-item">
|
||||
@if (!string.IsNullOrWhiteSpace(effect.SourceText))
|
||||
{
|
||||
<code class="effect-token">@effect.SourceText</code>
|
||||
}
|
||||
<span>@FormatEffect(effect)</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
@@ -116,4 +169,21 @@
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private static string FormatEffect(CriticalEffectLookupResponse effect) =>
|
||||
effect.EffectCode switch
|
||||
{
|
||||
"direct_hits" when effect.ValueInteger is not null => $"{effect.ValueInteger} direct hits",
|
||||
"must_parry_rounds" when effect.DurationRounds is not null => $"Must parry for {FormatRounds(effect.DurationRounds.Value)}",
|
||||
"no_parry_rounds" when effect.DurationRounds is not null => $"No parry for {FormatRounds(effect.DurationRounds.Value)}",
|
||||
"stunned_rounds" when effect.DurationRounds is not null => $"Stunned for {FormatRounds(effect.DurationRounds.Value)}",
|
||||
"bleed_per_round" when effect.PerRound is not null => $"Bleeds {effect.PerRound} hits per round",
|
||||
"foe_penalty" when effect.Modifier is not null => $"Foe penalty {effect.Modifier:+#;-#;0}",
|
||||
"attacker_bonus_next_round" when effect.Modifier is not null => $"Attacker bonus next round {effect.Modifier:+#;-#;0}",
|
||||
"power_point_modifier" when !string.IsNullOrWhiteSpace(effect.ValueExpression) => $"Foe power-point modifier {effect.ValueExpression}",
|
||||
_ => effect.EffectCode.Replace('_', ' ')
|
||||
};
|
||||
|
||||
private static string FormatRounds(int value) =>
|
||||
value == 1 ? "1 round" : $"{value} rounds";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user