M1 回合制战斗架构收敛与 1v1 攻击闭环:BattleRuntime 内核、组件唯一入口、UI 数据驱动与 EditMode 测试
- 删除中间契约(BattleStartRequest/BattlePlayerInput/BattleReturnPlan/桥接与策略接口/FlowState),收敛为 BattleViewState/BattleStep/一层 BattleEvent - 新增内部 BattleRuntime/BattleUnit/BattleStatus 共享上下文;TurnBattleComponent 成为唯一外部入口,吸收启动/暂停/回写职责 - 内核支持 1v1 攻击闭环:效果公式、HP/MP 钳制、阵亡、Victory/TotalDefeat、敌人随机决策;敌人行动间歇 0.6s 由组件协程编排并经 StepListener 推送 - UI:玩家卡片/敌人槽/回合槽按战局重建,图标配置驱动(含新增 EnemyConfig.Icon),每轮刷新一次 TurnSlots 且轮内只移动高亮 - 新增 Tests 程序集 + InternalsVisibleTo,25 个 BattleRuntime 纯逻辑用例全部通过
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SepCore.Battle
|
||||
{
|
||||
/// <summary>
|
||||
/// 一次同步推进的返回值,是 UI 读取行动记录与最新视图的唯一来源。
|
||||
/// 不保存独立流程状态:Result 非 null 即表示战斗已完成。
|
||||
/// </summary>
|
||||
public sealed class BattleStep
|
||||
{
|
||||
/// <summary>
|
||||
/// 本次推进产生的有序行动记录列表。
|
||||
/// </summary>
|
||||
public readonly IReadOnlyList<BattleEvent> Events;
|
||||
|
||||
/// <summary>
|
||||
/// 推进结束后的只读战斗视图。
|
||||
/// </summary>
|
||||
public readonly BattleViewState View;
|
||||
|
||||
/// <summary>
|
||||
/// 仅在战斗完成时存在,否则为 null。
|
||||
/// </summary>
|
||||
public readonly BattleResult Result;
|
||||
|
||||
public BattleStep(IReadOnlyList<BattleEvent> events, BattleViewState view, BattleResult result)
|
||||
{
|
||||
Events = events != null ? Copy(events) : new BattleEvent[0];
|
||||
View = view;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
private static BattleEvent[] Copy(IReadOnlyList<BattleEvent> source)
|
||||
{
|
||||
BattleEvent[] copy = new BattleEvent[source.Count];
|
||||
for (int i = 0; i < source.Count; i++)
|
||||
{
|
||||
copy[i] = source[i];
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user