feat(mosstank): add VTank-style automation PoC

This commit is contained in:
Erik 2026-08-27 18:57:21 +02:00
parent f6fe0f2a4f
commit 4e6e9bc9d9
212 changed files with 49462 additions and 416 deletions

View file

@ -103,6 +103,40 @@ public sealed class RuntimeSpellCastStateTests
Assert.Null(state.LastRequestedSpellId);
}
[Fact]
public void CompleteUse_PublishesOneExactServerReceipt()
{
Spellbook book = MakeBook(flags: 0, untargeted: false, targetMask: 0x10);
var operations = new FakeOperations { LocalPlayerId = 42u };
RuntimeSpellCastState state = Create(book, operations, selected: 99u);
Assert.Equal(CastRequestResult.Sent, state.Cast(1));
Assert.Equal(1u, state.PendingSpellId);
Assert.Equal(99u, state.PendingTargetId);
Assert.True(state.CompleteUse(0x0402u));
Assert.Equal(
new RuntimeSpellCastCompletion(1, 1u, 99u, 0x0402u),
state.LastCompletion);
Assert.Null(state.PendingSpellId);
Assert.False(state.CompleteUse(0u));
Assert.Equal(1, state.LastCompletion.Revision);
}
[Fact]
public void Cast_DoesNotOverwritePendingReceiptIdentity()
{
Spellbook book = MakeBook(flags: 0, untargeted: false, targetMask: 0x10);
var operations = new FakeOperations { LocalPlayerId = 42u };
RuntimeSpellCastState state = Create(book, operations, selected: 99u);
Assert.Equal(CastRequestResult.Sent, state.Cast(1));
Assert.Equal(CastRequestResult.Unavailable, state.Cast(1));
Assert.Equal(1, operations.TargetedSends);
Assert.Equal(1u, state.PendingSpellId);
Assert.Equal(99u, state.PendingTargetId);
}
private static RuntimeSpellCastState Create(
Spellbook book,
FakeOperations operations,