Fix: add ExactSelf to TargetOwnership enum + resolve in AbilitySystem
`ExactSelf` was accepted by the admin builder dropdown but crashed on deserialization because the TargetOwnership enum was missing the value. - Added `ExactSelf` to `TargetOwnership` enum in Action.cs - BuildCandidates treats ExactSelf like Self/Owner (actor's player pool) - ResolveTargets post-filters to ctx.Source.InstanceId when ExactSelf 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:
@@ -407,6 +407,10 @@ public static class AbilitySystem
|
|||||||
|
|
||||||
var candidates = BuildCandidates(selector, state, ctx.ActorId);
|
var candidates = BuildCandidates(selector, state, ctx.ActorId);
|
||||||
|
|
||||||
|
// ExactSelf: narrow to the exact unit instance that owns this ability.
|
||||||
|
if (selector.Ownership == TargetOwnership.ExactSelf && ctx.Source is not null)
|
||||||
|
candidates = candidates.Where(c => c.InstanceId == ctx.Source.InstanceId).ToList();
|
||||||
|
|
||||||
if (selector.Filters is { Length: > 0 })
|
if (selector.Filters is { Length: > 0 })
|
||||||
candidates = candidates.Where(c => FiltersMatch(selector.Filters, c, ctx)).ToList();
|
candidates = candidates.Where(c => FiltersMatch(selector.Filters, c, ctx)).ToList();
|
||||||
|
|
||||||
@@ -442,7 +446,7 @@ public static class AbilitySystem
|
|||||||
|
|
||||||
IEnumerable<string> ownerIds = selector.Ownership switch
|
IEnumerable<string> ownerIds = selector.Ownership switch
|
||||||
{
|
{
|
||||||
TargetOwnership.Owner or TargetOwnership.Self => [actorId],
|
TargetOwnership.Owner or TargetOwnership.Self or TargetOwnership.ExactSelf => [actorId],
|
||||||
TargetOwnership.Enemy => state.Players.Keys.Where(k => k != actorId),
|
TargetOwnership.Enemy => state.Players.Keys.Where(k => k != actorId),
|
||||||
TargetOwnership.Ally => state.Players.Keys.Where(k => k != actorId),
|
TargetOwnership.Ally => state.Players.Keys.Where(k => k != actorId),
|
||||||
_ => state.Players.Keys,
|
_ => state.Players.Keys,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public sealed class AffinityExpr
|
|||||||
|
|
||||||
public enum TargetScope { Hand, Deck, Discard, Battlefield, Player, AnyZone }
|
public enum TargetScope { Hand, Deck, Discard, Battlefield, Player, AnyZone }
|
||||||
public enum TargetType { Unit, ArchSpirit, Spirit, SpiritToken, Ruin, Tile, Card, Player }
|
public enum TargetType { Unit, ArchSpirit, Spirit, SpiritToken, Ruin, Tile, Card, Player }
|
||||||
public enum TargetOwnership { Self, Owner, Ally, Enemy, Any, Random, Target }
|
public enum TargetOwnership { Self, ExactSelf, Owner, Ally, Enemy, Any, Random, Target }
|
||||||
|
|
||||||
public sealed class TargetCount
|
public sealed class TargetCount
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user