refactor(runtime): own combat and magic intent
Move attack build/repeat state, combat-mode policy, authoritative auto-target transitions, and spell-cast intent beneath RuntimeActionState. Keep App as the input, world-query, DAT-policy, transport, and presentation adapter while preserving retail request and busy ordering. Add direct/graphical parity, reset, failure, and instance-isolation coverage. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
81b31857c6
commit
20df9d155d
49 changed files with 1949 additions and 634 deletions
|
|
@ -2,6 +2,7 @@ using AcDream.App.Combat;
|
|||
using AcDream.App.UI;
|
||||
using AcDream.App.UI.Layout;
|
||||
using AcDream.Core.Combat;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
using AcDream.UI.Abstractions.Panels.Settings;
|
||||
|
||||
namespace AcDream.App.Tests.UI.Layout;
|
||||
|
|
@ -33,7 +34,7 @@ public sealed class CombatUiControllerTests
|
|||
Assert.False(high.Selected);
|
||||
Assert.True(medium.Selected);
|
||||
Assert.False(low.Selected);
|
||||
Assert.Equal(CombatAttackController.InitialDesiredPower, power.ScalarPosition);
|
||||
Assert.Equal(RuntimeCombatAttackState.InitialDesiredPower, power.ScalarPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -123,7 +124,7 @@ public sealed class CombatUiControllerTests
|
|||
"Speed", "Power", "Repeat Attacks", "Auto Target", "Keep in View",
|
||||
"High", "Medium", "Low");
|
||||
|
||||
private static CombatAttackController CreateAttacks(
|
||||
private static RuntimeCombatAttackState CreateAttacks(
|
||||
CombatState combat,
|
||||
Func<double> now,
|
||||
List<(AttackHeight Height, float Power)> sent)
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ public class SelectedObjectControllerTests
|
|||
h.StackMap[Replacement] = 1u;
|
||||
|
||||
h.Selection.Select(Dead, SelectionChangeSource.World);
|
||||
// CombatTargetController is registered before the retained toolbar in
|
||||
// RuntimeCombatTargetState is registered before the retained toolbar in
|
||||
// production. Its clear handler selects a replacement reentrantly.
|
||||
h.Selection.Changed += transition =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using AcDream.App.UI.Layout;
|
|||
using AcDream.Core.Items;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.Core.Spells;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
|
||||
namespace AcDream.App.Tests.UI.Layout;
|
||||
|
||||
|
|
@ -330,14 +331,17 @@ public sealed class SpellcastingUiControllerTests
|
|||
SelectionState? selection = null,
|
||||
Action<uint>? examineSpell = null)
|
||||
{
|
||||
var casting = new SpellCastingController(
|
||||
spellbook, () => null, () => 1u, () => { }, _ => { }, (_, _) => { }, _ => { });
|
||||
SelectionState selectionState = selection ?? new SelectionState();
|
||||
var casting = new RuntimeSpellCastState(
|
||||
spellbook,
|
||||
selectionState,
|
||||
new NoopSpellCastOperations());
|
||||
return SpellcastingUiController.Bind(
|
||||
layout, spellbook, casting, objects, () => 1u,
|
||||
spellId => spellId,
|
||||
item => item.ObjectId,
|
||||
useItem,
|
||||
selection ?? new SelectionState(),
|
||||
selectionState,
|
||||
(tab, position, spellId) =>
|
||||
{
|
||||
spellbook.SetFavorite(tab, position, spellId);
|
||||
|
|
@ -349,6 +353,22 @@ public sealed class SpellcastingUiControllerTests
|
|||
examineSpell);
|
||||
}
|
||||
|
||||
private sealed class NoopSpellCastOperations : IRuntimeSpellCastOperations
|
||||
{
|
||||
public uint LocalPlayerId => 1u;
|
||||
public bool CanSend => true;
|
||||
public bool HasRequiredComponents(uint spellId) => true;
|
||||
public bool IsTargetCompatible(
|
||||
uint targetId,
|
||||
SpellMetadata spell,
|
||||
bool showMessage) => true;
|
||||
public void StopCompletely() { }
|
||||
public void SendUntargeted(uint spellId) { }
|
||||
public void SendTargeted(uint targetId, uint spellId) { }
|
||||
public void DisplayMessage(string message) { }
|
||||
public void IncrementBusy() { }
|
||||
}
|
||||
|
||||
private static void ApplyAnchors(UiElement parent)
|
||||
{
|
||||
foreach (UiElement child in parent.Children)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue