diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor index 9abd4dd..4b03178 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor @@ -948,9 +948,13 @@ var typeKey = eff["$type"]?.GetValue() ?? "DealDamage"; var d = new EffectDraft { TypeKey = typeKey }; - // ValueExpr helpers + // ValueExpr helpers — eff[key] may be a raw JsonValue (legacy) or a JsonObject + // with a "Fixed" int field or a "Ref" string field. Calling GetValue() on a + // JsonObject throws InvalidOperationException, so we branch on the node kind. int ReadFixed(string key, int def = 1) => - eff[key]?["Fixed"]?.GetValue() ?? eff[key]?.GetValue() ?? def; + eff[key] is JsonObject o + ? o["Fixed"]?.GetValue() ?? def + : eff[key]?.GetValue() ?? def; string ReadRef(string key) => eff[key]?["Ref"]?.GetValue() ?? ""; void ReadValueExpr(string key) { d.Amount = ReadFixed(key); d.AmountRef = ReadRef(key); } diff --git a/Server/src/SOR.Game/Abilities/AbilitySystem.cs b/Server/src/SOR.Game/Abilities/AbilitySystem.cs index 9883603..8d32288 100644 --- a/Server/src/SOR.Game/Abilities/AbilitySystem.cs +++ b/Server/src/SOR.Game/Abilities/AbilitySystem.cs @@ -482,6 +482,13 @@ public static class AbilitySystem [state.Players[ctx.ActorId]], TargetOwnership.Enemy => state.Players.Values.Where(p => p.AccountId != ctx.ActorId).Cast().ToList(), + // Target: resolve the owner of the last CardInstance selected in a prior action. + // Used for abilities like Bounce (return a spirit, then refund its SP cost to its owner). + TargetOwnership.Target when + ctx.ResolvedTargets.Count > 0 && + ctx.ResolvedTargets.Values.Last().FirstOrDefault() is CardInstance lastCard && + FindCardOwner(state, lastCard.InstanceId) is { } owner => + [(object)owner], _ => state.Players.Values.Cast().ToList(), }; }