Fix: remove [JsonPolymorphic] from Effect/Condition/TriggerEvent/Filter base classes
Having both [JsonPolymorphic] on the class AND a custom JsonConverter<T> in options causes NotSupportedException: the built-in polymorphic resolver tries to configure alongside the custom converter but requires it to support metadata reads/writes. Our custom PolymorphicAbilityConverter<T> takes full ownership of polymorphic dispatch, so [JsonPolymorphic] is redundant. The [JsonDerivedType] attributes remain — our converter reads them via reflection for the type map; the framework ignores them without [JsonPolymorphic] present. 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:
@@ -10,7 +10,6 @@ using SOR.Database.Enums;
|
||||
/// The default subject is Self (the source unit or ability owner).
|
||||
/// Override with Subject = "Target" to evaluate against the current action's resolved target.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// Composite
|
||||
[JsonDerivedType(typeof(AndCondition), "AND")]
|
||||
[JsonDerivedType(typeof(OrCondition), "OR")]
|
||||
|
||||
@@ -9,7 +9,6 @@ using SOR.Database.Enums;
|
||||
/// The atomic unit of game-state mutation delivered to a resolved target.
|
||||
/// All effects share a DurationModel (from their containing Action).
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// §5.1 Stat modification
|
||||
[JsonDerivedType(typeof(ModifyHealthEffect), "ModifyHealth")]
|
||||
[JsonDerivedType(typeof(ModifyDefenseEffect), "ModifyDefense")]
|
||||
|
||||
@@ -9,7 +9,6 @@ using SOR.Database.Enums;
|
||||
/// Narrows which entities a TargetSelector or condition matches.
|
||||
/// Unit/card filters apply to spirits and ArchSpirits; tile filters to board tiles.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// ── Unit / card filters ──────────────────────────────────────────────────────
|
||||
[JsonDerivedType(typeof(GenusContainsFilter), "GenusContains")]
|
||||
[JsonDerivedType(typeof(AffinityMatchesFilter), "AffinityMatches")]
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Text.Json.Serialization;
|
||||
/// Every event supports an optional ownership scope applied to the acting entity
|
||||
/// and most accept an optional filter for further narrowing.
|
||||
/// </summary>
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
|
||||
// §8.1 Turn phase
|
||||
[JsonDerivedType(typeof(OnTurnStartTrigger), "OnTurnStart")]
|
||||
[JsonDerivedType(typeof(OnTurnEndTrigger), "OnTurnEnd")]
|
||||
|
||||
Reference in New Issue
Block a user