feat: add active effects inspector to tile drawer
- Track active effects with human-readable labels in AbilitySystem (LabelFromReversal/LabelFromTick for stat mods, status flags, DOT/HOT) - Add ActiveEffectDto to GameStateDto and GameStateDelta; delta now always includes the full effects list so clients are never stale - Add ResolveLabelFromEffectJson fallback for effects stored before the Label field was introduced (old game sessions show correct labels) - Client _append_active_effect_lines helper filters activeEffects by targetRef and appends formatted lines to the tile drawer for spirits, archspirits, spirit tokens, and ruins Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -72,7 +72,8 @@ internal static class GameStateDiffer
|
||||
PlayerStatsByAccount: statsByAccount,
|
||||
PublicCountsByAccount: countsByAccount,
|
||||
PrivateByViewer: privateByViewer,
|
||||
MetaDelta: metaDelta);
|
||||
MetaDelta: metaDelta,
|
||||
ActiveEffects: DiffActiveEffects(next));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -98,11 +99,27 @@ internal static class GameStateDiffer
|
||||
PlayerStatsByAccount: statsByAccount,
|
||||
PublicCountsByAccount: countsByAccount,
|
||||
PrivateByViewer: null,
|
||||
MetaDelta: metaDelta);
|
||||
MetaDelta: metaDelta,
|
||||
ActiveEffects: DiffActiveEffects(next));
|
||||
}
|
||||
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Always returns the full current active-effects list so every delta keeps the client in sync.
|
||||
/// Active effects are a small collection; the overhead of always including them is negligible.
|
||||
/// </summary>
|
||||
private static IReadOnlyList<ActiveEffectDto> DiffActiveEffects(GameState next)
|
||||
=> next.ActiveEffects.Select(ae => new ActiveEffectDto(
|
||||
SourceInstanceId : ae.SourceInstanceId,
|
||||
SourceName : GameEngine.ResolveInstanceName(next, ae.SourceInstanceId),
|
||||
TargetRef : ae.TargetRef,
|
||||
Label : string.IsNullOrEmpty(ae.Label)
|
||||
? GameEngine.ResolveLabelFromEffectJson(ae.EffectJson)
|
||||
: ae.Label,
|
||||
DurationType : GameEngine.ResolveDurationType(ae.DurationJson),
|
||||
TurnsRemaining : ae.TurnsRemaining)).ToList();
|
||||
|
||||
private static List<TileDelta>? DiffTiles(GameState prev, GameState next)
|
||||
{
|
||||
if (prev.Board == null || next.Board == null) return null;
|
||||
|
||||
Reference in New Issue
Block a user