feat: port retail magic lifecycle and retained spell UI

Complete the retail cast-intent, target, component, enchantment, and busy-state paths; mount the DAT-authored spell bar, spellbook, component book, effects panels, and shared panel lifecycle; and add scoped input plus conformance coverage.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-15 10:55:22 +02:00
parent 7b7ffcd278
commit 07be994d97
84 changed files with 17822 additions and 1051 deletions

View file

@ -0,0 +1,59 @@
using AcDream.Core.Spells;
namespace AcDream.Core.Tests.Spells;
public sealed class RetailSpellFormulaTests
{
[Theory]
[InlineData(1u, 1)]
[InlineData(6u, 6)]
[InlineData(0x6Eu, 6)]
[InlineData(0x70u, 7)]
[InlineData(0xC0u, 7)]
[InlineData(0xC1u, 8)]
[InlineData(7u, 0)]
public void RoughHeuristic_UsesFormulaPowerComponent(uint component, int expected)
=> Assert.Equal(expected,
RetailSpellFormula.InqSpellLevelByRoughHeuristic([component]));
[Fact]
public void CustomizeForAccount_IsDeterministic_AndOnlyChangesTapers()
{
uint[] formula = [6u, 63u, 10u, 64u, 20u, 30u, 65u, 40u];
IReadOnlyList<uint> first = RetailSpellFormula.CustomizeForAccount(
formula, 3u, "testaccount");
IReadOnlyList<uint> second = RetailSpellFormula.CustomizeForAccount(
formula, 3u, "testaccount");
Assert.Equal(first, second);
Assert.Equal(formula[0], first[0]);
Assert.Equal(formula[1], first[1]);
Assert.Equal(formula[2], first[2]);
Assert.InRange(first[3], 63u, 74u);
Assert.Equal(formula[4], first[4]);
Assert.Equal(formula[5], first[5]);
Assert.InRange(first[6], 63u, 74u);
Assert.Equal(formula[7], first[7]);
}
[Theory]
[InlineData(1u, 1)]
[InlineData(2u, 2)]
[InlineData(3u, 3)]
[InlineData(0x6Eu, 3)]
[InlineData(0x70u, 4)]
[InlineData(0xC1u, 4)]
public void ScarabOnlyFormula_KeepsPowerAndAppendsRetailTaperCount(
uint powerComponent,
int expectedTapers)
{
IReadOnlyList<uint> result = RetailSpellFormula.InqScarabOnlyFormula(
[powerComponent, 63u, 10u, 64u]);
Assert.Equal(powerComponent, result[0]);
Assert.Equal(expectedTapers, result.Count(component => component == 0xBCu));
Assert.DoesNotContain(63u, result);
Assert.DoesNotContain(10u, result);
}
}