feat(ability): implement AbilityBuilderR3 + engine additions
Engine: - AbilityDefinition: add SourceZoneGate (zone-restricted triggers) and TriggerLimitPerGame - Effects: add StatModOperator (Add/Subtract/Multiply/Divide/Percent) on all stat mod effects; reversal stored as delta - Action/CostEntry: add CostPickMode enum (Random/SelfPick/EnemySeePick/EnemyRandomPick/EnemyPick) - PendingCostPick: new model for interactive cost pause/resume (mirrors PendingTriggeredTarget) - GameState: PendingCostPick field - GameMessages: CostPickRequestPush, GameCostPickRequest, GameCostPickResponse records - AbilitySystem: FireTrigger scans Hand/Discard/Deck when SourceZoneGate set; per-game trigger limit tracking; ApplyStatOperator helper; PayCosts/ResumeCostPick for interactive cost flow - GameCostPickHandler + ServiceRegistration wiring Admin: - AbilityBuilderR3.razor: full ability builder at /cards/ability-builder-r3 (39 triggers, 69 effects, 32 conditions, form/canvas/mermaid modes, compiles to engine-native $type JSON) - AbilityBuilderR2-Draft.razor: fix switch expression no-best-type error Docs: - BuilderR3.md: master plan document 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:
@@ -449,7 +449,7 @@
|
||||
public int TimeLimitMinutes { get; set; } = 0;
|
||||
public int TurnLimit { get; set; } = 0;
|
||||
public int MpBuff { get; set; } = 0;
|
||||
public int StartingRandomTilePct { get; set; } = 0;
|
||||
public int StartingRandomTilePct { get; set; } = 75;
|
||||
public string BoardShape { get; set; } = "Default";
|
||||
public string GridType { get; set; } = "Square";
|
||||
public int HexSides { get; set; } = 6;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,9 @@ public static class AbilitySystem
|
||||
// Runtime limiter for Triggered abilities: (source instance, ability key, turn) -> count
|
||||
private static readonly Dictionary<(string SourceInstanceId, string AbilityKey, int Turn), int> _triggerCountsPerTurn = new();
|
||||
|
||||
// Per-game trigger limiter: (session+source instance, ability key) -> count; never resets mid-game
|
||||
private static readonly Dictionary<(string SessionAndSource, string AbilityKey), int> _triggerCountsPerGame = new();
|
||||
|
||||
// Transient prevention markers.
|
||||
private static readonly Dictionary<string, int?> _preventNextDamageByUnit = new();
|
||||
private static readonly HashSet<string> _preventDeathUnits = new();
|
||||
@@ -106,11 +109,14 @@ public static class AbilitySystem
|
||||
if (!ValidateSourceActivationConditions(def, ctx, source))
|
||||
throw new GameException("ABILITY_CONDITION_NOT_MET");
|
||||
|
||||
if (def.Cost is { Length: > 0 })
|
||||
PayCost(def.Cost, ctx);
|
||||
|
||||
source.AbilityUsesThisTurn[abilityIndex] = usedThisTurn + 1;
|
||||
|
||||
if (def.Cost is { Length: > 0 })
|
||||
{
|
||||
bool paused = PayCosts(def.Cost, ctx, abilityIndex, def.Actions, def.Range, def.Duration);
|
||||
if (paused) return state; // waiting for client cost pick
|
||||
}
|
||||
|
||||
ExecuteActions(def.Actions, ctx, clientTargets, requireClientTargets: true, activationRange: def.Range, forceDuration: def.Duration);
|
||||
|
||||
return state;
|
||||
@@ -185,56 +191,98 @@ public static class AbilitySystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scans every battlefield unit for Triggered abilities matching the occurrence
|
||||
/// and fires each matching one. Called inline from GameEngine mutation methods.
|
||||
/// Scans every battlefield unit (and, when SourceZoneGate is set, hand/discard/deck cards)
|
||||
/// for Triggered abilities matching the occurrence and fires each matching one.
|
||||
/// Called inline from GameEngine mutation methods.
|
||||
/// </summary>
|
||||
public static GameState FireTrigger(GameState state, TriggerOccurrence occurrence)
|
||||
{
|
||||
foreach (var (ownerId, player) in state.Players)
|
||||
{
|
||||
var units = player.Field.OfType<FieldCard>().ToList(); // snapshot
|
||||
foreach (var unit in units)
|
||||
{
|
||||
// SetCanUseAbility(false) suppresses triggered ability firing for this unit.
|
||||
if (!unit.CanUseAbility) continue;
|
||||
// Build the set of cards to scan for triggered abilities.
|
||||
// Always include battlefield units. Cards with SourceZoneGate including
|
||||
// Hand/Discard/Deck are scanned from those zones too.
|
||||
var scanTargets = new List<(CardInstance Card, string Zone)>();
|
||||
foreach (var fc in player.Field.OfType<FieldCard>())
|
||||
scanTargets.Add((fc, "Battlefield"));
|
||||
foreach (var c in player.Hand)
|
||||
scanTargets.Add((c, "Hand"));
|
||||
foreach (var c in player.Discard)
|
||||
scanTargets.Add((c, "Discard"));
|
||||
foreach (var c in player.Deck)
|
||||
scanTargets.Add((c, "Deck"));
|
||||
|
||||
var abilities = ParseAbilities(unit.AbilitiesJson);
|
||||
foreach (var (card, zone) in scanTargets)
|
||||
{
|
||||
// SetCanUseAbility(false) suppresses triggered ability firing.
|
||||
if (card is FieldCard fc2 && !fc2.CanUseAbility) continue;
|
||||
|
||||
var abilities = ParseAbilities(card.AbilitiesJson);
|
||||
for (int i = 0; i < abilities.Length; i++)
|
||||
{
|
||||
var def = abilities[i];
|
||||
if (def.Type != AbilityType.Triggered) continue;
|
||||
if (def.TriggerEvent is null) continue;
|
||||
if (!TriggerMatches(def.TriggerEvent, occurrence, state, ownerId, unit)) continue;
|
||||
|
||||
// ── SourceZoneGate ────────────────────────────────────────
|
||||
// When a gate is configured, only fire when the card is in one of the
|
||||
// specified zones. When no gate is configured, apply the legacy rule:
|
||||
// only battlefield cards fire (skip non-battlefield cards).
|
||||
if (def.SourceZoneGate is { Length: > 0 })
|
||||
{
|
||||
if (!def.SourceZoneGate.Contains(zone, StringComparer.OrdinalIgnoreCase))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No gate → legacy: only battlefield cards trigger.
|
||||
if (zone != "Battlefield") continue;
|
||||
}
|
||||
|
||||
if (!TriggerMatches(def.TriggerEvent, occurrence, state, ownerId,
|
||||
card is FieldCard fc3 ? fc3 : null)) continue;
|
||||
|
||||
var ctx = new AbilityContext
|
||||
{
|
||||
State = state,
|
||||
ActorId = ownerId,
|
||||
Source = unit,
|
||||
Source = card,
|
||||
EventData = occurrence.Data,
|
||||
};
|
||||
|
||||
if (def.ActivationConditions is { Length: > 0 })
|
||||
if (def.ActivationConditions.Any(c => !EvaluateCondition(c, ctx, unit)))
|
||||
if (def.ActivationConditions.Any(c => !EvaluateCondition(c, ctx, card)))
|
||||
continue;
|
||||
|
||||
// ── Per-turn limit ────────────────────────────────────────
|
||||
if (def.TriggerLimitPerTurn is > 0)
|
||||
{
|
||||
var abilityKey = !string.IsNullOrWhiteSpace(def.Name) ? def.Name! : $"idx:{i}";
|
||||
var key = (unit.InstanceId, abilityKey, state.TurnNumber);
|
||||
var key = (card.InstanceId, abilityKey, state.TurnNumber);
|
||||
_triggerCountsPerTurn.TryGetValue(key, out var used);
|
||||
if (used >= def.TriggerLimitPerTurn.Value)
|
||||
continue;
|
||||
_triggerCountsPerTurn[key] = used + 1;
|
||||
}
|
||||
|
||||
// ── Per-game limit ────────────────────────────────────────
|
||||
if (def.TriggerLimitPerGame is > 0)
|
||||
{
|
||||
var abilityKey = !string.IsNullOrWhiteSpace(def.Name) ? def.Name! : $"idx:{i}";
|
||||
var gameKey = ($"{state.SessionId}:{card.InstanceId}", abilityKey);
|
||||
_triggerCountsPerGame.TryGetValue(gameKey, out var usedGame);
|
||||
if (usedGame >= def.TriggerLimitPerGame.Value)
|
||||
continue;
|
||||
_triggerCountsPerGame[gameKey] = usedGame + 1;
|
||||
}
|
||||
|
||||
// If any action needs a human pick, pause and request client input.
|
||||
if (def.Actions.Any(ActionNeedsClientTargets))
|
||||
{
|
||||
state.PendingTriggeredTarget = new PendingTriggeredTarget
|
||||
{
|
||||
ActorId = ownerId,
|
||||
SourceInstanceId = unit.InstanceId,
|
||||
SourceInstanceId = card.InstanceId,
|
||||
AbilityName = def.Name ?? "Triggered Ability",
|
||||
ActionsJson = JsonSerializer.Serialize(def.Actions, _jsonOpts),
|
||||
RangeJson = def.Range is not null
|
||||
@@ -370,81 +418,240 @@ public static class AbilitySystem
|
||||
|
||||
// ── Cost payment ──────────────────────────────────────────────────────────
|
||||
|
||||
private static void PayCost(CostEntry[] costs, AbilityContext ctx)
|
||||
/// <summary>
|
||||
/// Pays all costs in <paramref name="costs"/> that can be auto-resolved.
|
||||
/// When an interactive pick-mode cost is encountered, stores <see cref="PendingCostPick"/>
|
||||
/// on <paramref name="ctx"/>.State and returns <c>true</c> (caller must stop and return state).
|
||||
/// Returns <c>false</c> when all costs are paid without pausing.
|
||||
/// </summary>
|
||||
private static bool PayCosts(
|
||||
CostEntry[] costs,
|
||||
AbilityContext ctx,
|
||||
int abilityIndex,
|
||||
Models.Action[] pendingActions,
|
||||
AbilityRange? range,
|
||||
DurationModel? forceDuration)
|
||||
{
|
||||
var player = ctx.State.Players[ctx.ActorId];
|
||||
|
||||
foreach (var cost in costs)
|
||||
for (int ci = 0; ci < costs.Length; ci++)
|
||||
{
|
||||
switch (cost.Type)
|
||||
var cost = costs[ci];
|
||||
|
||||
// Interactive costs: pause for player pick.
|
||||
if (cost.PickMode is CostPickMode.SelfPick or CostPickMode.EnemySeePick
|
||||
or CostPickMode.EnemyRandomPick or CostPickMode.EnemyPick)
|
||||
{
|
||||
case CostType.SpiritPoints:
|
||||
if (player.CurrentSp < cost.Amount) throw new GameException("INSUFFICIENT_SP");
|
||||
player.CurrentSp -= cost.Amount;
|
||||
break;
|
||||
|
||||
case CostType.SacrificeTokens:
|
||||
if (player.CurrentSt < cost.Amount) throw new GameException("INSUFFICIENT_ST");
|
||||
player.CurrentSt -= cost.Amount;
|
||||
break;
|
||||
|
||||
case CostType.DiscardFromHand:
|
||||
// Only DiscardFromHand / SendSpiritFromBattlefieldToDiscard / DealDamageToOwnSpirit
|
||||
// support interactive pick. Auto-resolve all others even if PickMode is set.
|
||||
if (cost.Type is CostType.DiscardFromHand
|
||||
or CostType.SendSpiritFromBattlefieldToDiscard
|
||||
or CostType.DealDamageToOwnSpirit)
|
||||
{
|
||||
var candidates = player.Hand
|
||||
.Where(c => cost.Filters is null || FiltersMatch(cost.Filters, c, ctx))
|
||||
.Take(cost.Amount).ToList();
|
||||
if (candidates.Count < cost.Amount)
|
||||
throw new GameException("INSUFFICIENT_CARDS_TO_DISCARD");
|
||||
foreach (var c in candidates) { player.Hand.Remove(c); player.Discard.Add(c); }
|
||||
break;
|
||||
}
|
||||
// Determine who picks.
|
||||
var pickerActorId = cost.PickMode is CostPickMode.SelfPick
|
||||
? ctx.ActorId
|
||||
: ctx.State.GetEnemyIds(ctx.ActorId).FirstOrDefault() ?? ctx.ActorId;
|
||||
|
||||
case CostType.MillTopOfDeck:
|
||||
for (int i = 0; i < cost.Amount && player.Deck.Count > 0; i++)
|
||||
// Remaining costs after this one.
|
||||
var remaining = costs.Skip(ci + 1).ToArray();
|
||||
|
||||
ctx.State.PendingCostPick = new PendingCostPick
|
||||
{
|
||||
var top = player.Deck[^1];
|
||||
player.Deck.RemoveAt(player.Deck.Count - 1);
|
||||
player.Discard.Add(top);
|
||||
}
|
||||
break;
|
||||
|
||||
case CostType.MillBottomOfDeck:
|
||||
for (int i = 0; i < cost.Amount && player.Deck.Count > 0; i++)
|
||||
{
|
||||
var bottom = player.Deck[0];
|
||||
player.Deck.RemoveAt(0);
|
||||
player.Discard.Add(bottom);
|
||||
}
|
||||
break;
|
||||
|
||||
case CostType.DealDamageToOwnArchSpirit:
|
||||
if (player.ArchSpirit is null) throw new GameException("NO_ARCHSPIRIT");
|
||||
ApplyDamageToUnit(player.ArchSpirit, cost.Amount, bypassDefense: false, ctx);
|
||||
break;
|
||||
|
||||
case CostType.DealDamageToOwnSpirit:
|
||||
{
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => !f.IsLeader
|
||||
&& (cost.Filters is null || FiltersMatch(cost.Filters, f, ctx)));
|
||||
if (spirit is null) throw new GameException("NO_VALID_SPIRIT_FOR_COST");
|
||||
ApplyDamageToUnit(spirit, cost.Amount, bypassDefense: false, ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
case CostType.SendSpiritFromBattlefieldToDiscard:
|
||||
{
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => !f.IsLeader
|
||||
&& (cost.Filters is null || FiltersMatch(cost.Filters, f, ctx)));
|
||||
if (spirit is null) throw new GameException("NO_VALID_SPIRIT_FOR_COST");
|
||||
ctx.State.Board?.RemoveUnit(spirit.InstanceId);
|
||||
player.Field.Remove(spirit);
|
||||
player.Discard.Add(spirit);
|
||||
break;
|
||||
ActorId = ctx.ActorId,
|
||||
SourceInstanceId = ctx.Source?.InstanceId ?? string.Empty,
|
||||
AbilityIndex = abilityIndex,
|
||||
PickerActorId = pickerActorId,
|
||||
CostType = cost.Type.ToString(),
|
||||
Amount = cost.Amount,
|
||||
PickMode = cost.PickMode.ToString()!,
|
||||
FiltersJson = cost.Filters is not null
|
||||
? JsonSerializer.Serialize(cost.Filters, _jsonOpts) : null,
|
||||
RemainingCostsJson = JsonSerializer.Serialize(remaining, _jsonOpts),
|
||||
ActionsJson = JsonSerializer.Serialize(pendingActions, _jsonOpts),
|
||||
RangeJson = range is not null
|
||||
? JsonSerializer.Serialize(range, _jsonOpts) : null,
|
||||
ForceDurationJson = forceDuration is not null
|
||||
? JsonSerializer.Serialize(forceDuration, _jsonOpts) : null,
|
||||
};
|
||||
return true; // paused
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-resolve the cost.
|
||||
PaySingleCost(cost, player, ctx);
|
||||
}
|
||||
return false; // all paid
|
||||
}
|
||||
|
||||
private static void PaySingleCost(CostEntry cost, PlayerState player, AbilityContext ctx)
|
||||
{
|
||||
switch (cost.Type)
|
||||
{
|
||||
case CostType.SpiritPoints:
|
||||
if (player.CurrentSp < cost.Amount) throw new GameException("INSUFFICIENT_SP");
|
||||
player.CurrentSp -= cost.Amount;
|
||||
break;
|
||||
|
||||
case CostType.SacrificeTokens:
|
||||
if (player.CurrentSt < cost.Amount) throw new GameException("INSUFFICIENT_ST");
|
||||
player.CurrentSt -= cost.Amount;
|
||||
break;
|
||||
|
||||
case CostType.DiscardFromHand:
|
||||
{
|
||||
var pool = player.Hand
|
||||
.Where(c => cost.Filters is null || FiltersMatch(cost.Filters, c, ctx))
|
||||
.ToList();
|
||||
if (cost.PickMode == CostPickMode.Random)
|
||||
pool = pool.OrderBy(_ => Random.Shared.Next()).ToList();
|
||||
var candidates = pool.Take(cost.Amount).ToList();
|
||||
if (candidates.Count < cost.Amount)
|
||||
throw new GameException("INSUFFICIENT_CARDS_TO_DISCARD");
|
||||
foreach (var c in candidates) { player.Hand.Remove(c); player.Discard.Add(c); }
|
||||
break;
|
||||
}
|
||||
|
||||
case CostType.MillTopOfDeck:
|
||||
for (int i = 0; i < cost.Amount && player.Deck.Count > 0; i++)
|
||||
{
|
||||
var top = player.Deck[^1];
|
||||
player.Deck.RemoveAt(player.Deck.Count - 1);
|
||||
player.Discard.Add(top);
|
||||
}
|
||||
break;
|
||||
|
||||
case CostType.MillBottomOfDeck:
|
||||
for (int i = 0; i < cost.Amount && player.Deck.Count > 0; i++)
|
||||
{
|
||||
var bottom = player.Deck[0];
|
||||
player.Deck.RemoveAt(0);
|
||||
player.Discard.Add(bottom);
|
||||
}
|
||||
break;
|
||||
|
||||
case CostType.DealDamageToOwnArchSpirit:
|
||||
if (player.ArchSpirit is null) throw new GameException("NO_ARCHSPIRIT");
|
||||
ApplyDamageToUnit(player.ArchSpirit, cost.Amount, bypassDefense: false, ctx);
|
||||
break;
|
||||
|
||||
case CostType.DealDamageToOwnSpirit:
|
||||
{
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => !f.IsLeader
|
||||
&& (cost.Filters is null || FiltersMatch(cost.Filters, f, ctx)));
|
||||
if (spirit is null) throw new GameException("NO_VALID_SPIRIT_FOR_COST");
|
||||
ApplyDamageToUnit(spirit, cost.Amount, bypassDefense: false, ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
case CostType.SendSpiritFromBattlefieldToDiscard:
|
||||
{
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => !f.IsLeader
|
||||
&& (cost.Filters is null || FiltersMatch(cost.Filters, f, ctx)));
|
||||
if (spirit is null) throw new GameException("NO_VALID_SPIRIT_FOR_COST");
|
||||
ctx.State.Board?.RemoveUnit(spirit.InstanceId);
|
||||
player.Field.Remove(spirit);
|
||||
player.Discard.Add(spirit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes an Active ability after the picker has submitted their cost-pick selections.
|
||||
/// Called by <c>GameCostPickHandler</c>.
|
||||
/// </summary>
|
||||
public static GameState ResumeCostPick(
|
||||
GameState state,
|
||||
string actorId,
|
||||
string requestId,
|
||||
IReadOnlyList<string> selectedInstanceIds)
|
||||
{
|
||||
var pending = state.PendingCostPick
|
||||
?? throw new GameException("NO_PENDING_COST_PICK");
|
||||
|
||||
if (pending.RequestId != requestId)
|
||||
throw new GameException("REQUEST_ID_MISMATCH");
|
||||
|
||||
// Allow both the actor and the designated picker to respond.
|
||||
if (actorId != pending.ActorId && actorId != pending.PickerActorId)
|
||||
throw new GameException("NOT_YOUR_COST_PICK");
|
||||
|
||||
state.PendingCostPick = null;
|
||||
|
||||
var player = state.Players[pending.ActorId];
|
||||
|
||||
// Validate and pay the interactive cost using the client-selected IDs.
|
||||
switch (pending.CostType)
|
||||
{
|
||||
case nameof(CostType.DiscardFromHand):
|
||||
{
|
||||
var toDiscard = selectedInstanceIds
|
||||
.Select(id => player.Hand.FirstOrDefault(c => c.InstanceId == id))
|
||||
.OfType<CardInstance>()
|
||||
.Take(pending.Amount)
|
||||
.ToList();
|
||||
if (toDiscard.Count < pending.Amount)
|
||||
throw new GameException("INVALID_COST_PICK_SELECTION");
|
||||
foreach (var c in toDiscard) { player.Hand.Remove(c); player.Discard.Add(c); }
|
||||
break;
|
||||
}
|
||||
case nameof(CostType.SendSpiritFromBattlefieldToDiscard):
|
||||
{
|
||||
var picked = selectedInstanceIds.FirstOrDefault()
|
||||
?? throw new GameException("INVALID_COST_PICK_SELECTION");
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => f.InstanceId == picked)
|
||||
?? throw new GameException("INVALID_COST_PICK_SELECTION");
|
||||
state.Board?.RemoveUnit(spirit.InstanceId);
|
||||
player.Field.Remove(spirit);
|
||||
player.Discard.Add(spirit);
|
||||
break;
|
||||
}
|
||||
case nameof(CostType.DealDamageToOwnSpirit):
|
||||
{
|
||||
var picked = selectedInstanceIds.FirstOrDefault()
|
||||
?? throw new GameException("INVALID_COST_PICK_SELECTION");
|
||||
var spirit = player.Field.OfType<FieldCard>()
|
||||
.FirstOrDefault(f => f.InstanceId == picked)
|
||||
?? throw new GameException("INVALID_COST_PICK_SELECTION");
|
||||
// Temporary context for damage application.
|
||||
var dmgCtx = new AbilityContext { State = state, ActorId = pending.ActorId };
|
||||
ApplyDamageToUnit(spirit, pending.Amount, bypassDefense: false, dmgCtx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the source unit (may have left the field while waiting — skip if gone).
|
||||
var source = state.Players.Values
|
||||
.SelectMany(p => p.Field).OfType<FieldCard>()
|
||||
.FirstOrDefault(f => f.InstanceId == pending.SourceInstanceId);
|
||||
if (source is null) return state;
|
||||
|
||||
var ctx = new AbilityContext { State = state, ActorId = pending.ActorId, Source = source };
|
||||
|
||||
// Pay any remaining non-interactive costs.
|
||||
var remainingCosts = JsonSerializer.Deserialize<CostEntry[]>(
|
||||
pending.RemainingCostsJson, _jsonOpts) ?? [];
|
||||
foreach (var c in remainingCosts)
|
||||
PaySingleCost(c, player, ctx);
|
||||
|
||||
// Execute the ability actions.
|
||||
var actions = JsonSerializer.Deserialize<Models.Action[]>(
|
||||
pending.ActionsJson, _jsonOpts) ?? [];
|
||||
DurationModel? forceDuration = pending.ForceDurationJson is not null
|
||||
? JsonSerializer.Deserialize<DurationModel>(pending.ForceDurationJson, _jsonOpts)
|
||||
: null;
|
||||
AbilityRange? range = pending.RangeJson is not null
|
||||
? JsonSerializer.Deserialize<AbilityRange>(pending.RangeJson, _jsonOpts)
|
||||
: null;
|
||||
|
||||
ExecuteActions(actions, ctx, clientTargets: null, requireClientTargets: false,
|
||||
activationRange: range, forceDuration: forceDuration);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
// ── Action execution ──────────────────────────────────────────────────────
|
||||
@@ -842,50 +1049,83 @@ public static class AbilitySystem
|
||||
// ── §5.1 Stat modification ─────────────────────────────────────────
|
||||
case ModifyHealthEffect mh when target is CardInstance ci:
|
||||
{
|
||||
int amt = ResolveValue(mh.Amount, ctx);
|
||||
int raw = ResolveValue(mh.Amount, ctx);
|
||||
if (mh.StatTarget == StatTarget.Current)
|
||||
{
|
||||
ci.CurrentHealth = (ci.CurrentHealth ?? 0) + amt;
|
||||
if (ci.MaxHealth.HasValue)
|
||||
ci.CurrentHealth = Math.Min(ci.CurrentHealth.Value, ci.MaxHealth.Value);
|
||||
int cur = ci.CurrentHealth ?? 0;
|
||||
int newVal = ApplyStatOperator(cur, raw, mh.Operator);
|
||||
if (ci.MaxHealth.HasValue) newVal = Math.Min(newVal, ci.MaxHealth.Value);
|
||||
int delta = newVal - cur;
|
||||
ci.CurrentHealth = newVal;
|
||||
if (ci.CurrentHealth <= 0) KillUnit(ci, ctx, ctx.Source?.InstanceId);
|
||||
TrackEffect(new ModifyHealthEffect { Amount = V(-delta), StatTarget = mh.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
ci.MaxHealth = (ci.MaxHealth ?? 0) + amt;
|
||||
int cur = ci.MaxHealth ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, raw, mh.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.MaxHealth = newVal;
|
||||
if (ci.CurrentHealth > ci.MaxHealth) ci.CurrentHealth = ci.MaxHealth;
|
||||
TrackEffect(new ModifyHealthEffect { Amount = V(-delta), StatTarget = mh.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
TrackEffect(new ModifyHealthEffect { Amount = V(-amt), StatTarget = mh.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
break;
|
||||
}
|
||||
case ModifyDefenseEffect md when target is CardInstance ci:
|
||||
{
|
||||
int amt = ResolveValue(md.Amount, ctx);
|
||||
int raw = ResolveValue(md.Amount, ctx);
|
||||
if (md.StatTarget == StatTarget.Current)
|
||||
ci.CurrentDefense = Math.Max(0, (ci.CurrentDefense ?? 0) + amt);
|
||||
{
|
||||
int cur = ci.CurrentDefense ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, raw, md.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.CurrentDefense = newVal;
|
||||
TrackEffect(new ModifyDefenseEffect { Amount = V(-delta), StatTarget = md.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
else
|
||||
ci.MaxDefense = (ci.MaxDefense ?? 0) + amt;
|
||||
TrackEffect(new ModifyDefenseEffect { Amount = V(-amt), StatTarget = md.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
{
|
||||
int cur = ci.MaxDefense ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, raw, md.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.MaxDefense = newVal;
|
||||
TrackEffect(new ModifyDefenseEffect { Amount = V(-delta), StatTarget = md.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ModifyDamageEffect mdam when target is CardInstance ci:
|
||||
{
|
||||
int amt = ResolveValue(mdam.Amount, ctx);
|
||||
ci.Damage = Math.Max(0, (ci.Damage ?? 0) + amt);
|
||||
TrackEffect(new ModifyDamageEffect { Amount = V(-amt) }, ci.InstanceId, duration, ctx);
|
||||
int cur = ci.Damage ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, ResolveValue(mdam.Amount, ctx), mdam.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.Damage = newVal;
|
||||
TrackEffect(new ModifyDamageEffect { Amount = V(-delta) }, ci.InstanceId, duration, ctx);
|
||||
break;
|
||||
}
|
||||
case ModifyMPEffect mmp when target is CardInstance ci:
|
||||
{
|
||||
int amt = ResolveValue(mmp.Amount, ctx);
|
||||
int raw = ResolveValue(mmp.Amount, ctx);
|
||||
if (mmp.StatTarget == StatTarget.Current && ci is FieldCard fc)
|
||||
fc.CurrentMp = Math.Max(0, fc.CurrentMp + amt);
|
||||
{
|
||||
int cur = fc.CurrentMp;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, raw, mmp.Operator));
|
||||
int delta = newVal - cur;
|
||||
fc.CurrentMp = newVal;
|
||||
TrackEffect(new ModifyMPEffect { Amount = V(-delta), StatTarget = mmp.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
else
|
||||
ci.MaxMp = Math.Max(0, (ci.MaxMp ?? 0) + amt);
|
||||
TrackEffect(new ModifyMPEffect { Amount = V(-amt), StatTarget = mmp.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
{
|
||||
int cur = ci.MaxMp ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, raw, mmp.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.MaxMp = newVal;
|
||||
TrackEffect(new ModifyMPEffect { Amount = V(-delta), StatTarget = mmp.StatTarget },
|
||||
ci.InstanceId, duration, ctx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SetMovementTypeEffect smt when target is CardInstance ci:
|
||||
@@ -908,19 +1148,21 @@ public static class AbilitySystem
|
||||
}
|
||||
case ModifyMinAttackRangeEffect mmar when target is CardInstance ci:
|
||||
{
|
||||
int orig = ci.MinAttackRange ?? 0;
|
||||
int newVal = Math.Max(0, orig + ResolveValue(mmar.Amount, ctx));
|
||||
int cur = ci.MinAttackRange ?? 0;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, ResolveValue(mmar.Amount, ctx), mmar.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.MinAttackRange = newVal;
|
||||
TrackEffect(new ModifyMinAttackRangeEffect { Amount = V(orig - newVal) },
|
||||
TrackEffect(new ModifyMinAttackRangeEffect { Amount = V(-delta) },
|
||||
ci.InstanceId, duration, ctx);
|
||||
break;
|
||||
}
|
||||
case ModifyMaxAttackRangeEffect mmax when target is CardInstance ci:
|
||||
{
|
||||
int orig = ci.MaxAttackRange ?? 1;
|
||||
int newVal = Math.Max(0, orig + ResolveValue(mmax.Amount, ctx));
|
||||
int cur = ci.MaxAttackRange ?? 1;
|
||||
int newVal = Math.Max(0, ApplyStatOperator(cur, ResolveValue(mmax.Amount, ctx), mmax.Operator));
|
||||
int delta = newVal - cur;
|
||||
ci.MaxAttackRange = newVal;
|
||||
TrackEffect(new ModifyMaxAttackRangeEffect { Amount = V(orig - newVal) },
|
||||
TrackEffect(new ModifyMaxAttackRangeEffect { Amount = V(-delta) },
|
||||
ci.InstanceId, duration, ctx);
|
||||
break;
|
||||
}
|
||||
@@ -2350,6 +2592,20 @@ public static class AbilitySystem
|
||||
|
||||
// ── Value / affinity resolution ───────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// Applies a <see cref="StatModOperator"/> to a current stat value.
|
||||
/// Returns the new value (pre-clamping). The caller stores delta = newVal - oldVal
|
||||
/// so the reversal can be expressed as a simple Add(-delta).
|
||||
/// </summary>
|
||||
private static int ApplyStatOperator(int current, int amount, StatModOperator op) => op switch
|
||||
{
|
||||
StatModOperator.Subtract => current - amount,
|
||||
StatModOperator.Multiply => current * amount,
|
||||
StatModOperator.Divide => amount == 0 ? current : current / amount,
|
||||
StatModOperator.Percent => current + current * amount / 100,
|
||||
_ => current + amount, // Add (default)
|
||||
};
|
||||
|
||||
private static int ResolveValue(ValueExpr expr, AbilityContext ctx)
|
||||
{
|
||||
if (expr.Fixed.HasValue) return expr.Fixed.Value;
|
||||
|
||||
@@ -53,10 +53,24 @@ public sealed class AbilityDefinition
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of times this Triggered ability may resolve per turn.
|
||||
/// Null or <= 0 means unlimited.
|
||||
/// Null or <= 0 means unlimited.
|
||||
/// </summary>
|
||||
public int? TriggerLimitPerTurn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of times this Triggered ability may resolve for the entire game.
|
||||
/// Null or <= 0 means unlimited.
|
||||
/// </summary>
|
||||
public int? TriggerLimitPerGame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Restricts which zones the source card must be in for the trigger to be active.
|
||||
/// Valid values: "Battlefield", "Hand", "Discard", "Deck".
|
||||
/// Null or empty means the trigger fires regardless of the source card's zone.
|
||||
/// Default behaviour (null) retains the existing battlefield-only scan.
|
||||
/// </summary>
|
||||
public string[]? SourceZoneGate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional display name shown in the admin tool and client ability list.
|
||||
/// Not required for game logic.
|
||||
|
||||
@@ -113,16 +113,40 @@ public enum CostType
|
||||
DealDamageToOwnSpirit,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How the player(s) resolve the selection for an interactive cost (e.g. DiscardFromHand).
|
||||
/// Null / absent: server auto-resolves (picks first N valid candidates).
|
||||
/// </summary>
|
||||
public enum CostPickMode
|
||||
{
|
||||
/// <summary>Server picks randomly from valid candidates.</summary>
|
||||
Random,
|
||||
/// <summary>Controlling player sees and picks which cards to pay.</summary>
|
||||
SelfPick,
|
||||
/// <summary>Opponent picks on behalf of the controlling player (sees all options).</summary>
|
||||
EnemySeePick,
|
||||
/// <summary>Opponent picks randomly from the controlling player's valid candidates.</summary>
|
||||
EnemyRandomPick,
|
||||
/// <summary>Opponent has free choice of which cards the controlling player pays.</summary>
|
||||
EnemyPick,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A single cost element for an Active ability.
|
||||
/// Multiple CostEntry items must all be paid simultaneously before the ability resolves.
|
||||
/// </summary>
|
||||
public sealed class CostEntry
|
||||
{
|
||||
public CostType Type { get; set; }
|
||||
public int Amount { get; set; } = 1;
|
||||
public CostType Type { get; set; }
|
||||
public int Amount { get; set; } = 1;
|
||||
/// <summary>Optional filter for targeted costs (e.g. "Discard a Spirit card from hand").</summary>
|
||||
public Filter[]? Filters { get; set; }
|
||||
public Filter[]? Filters { get; set; }
|
||||
/// <summary>
|
||||
/// When set, the cost resolution is interactive: a player (controlling or opponent)
|
||||
/// is prompted to pick which specific cards/units satisfy the cost.
|
||||
/// Null = auto-resolve (engine picks first N matching candidates).
|
||||
/// </summary>
|
||||
public CostPickMode? PickMode { get; set; }
|
||||
}
|
||||
|
||||
// ── Ability range ─────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -104,15 +104,24 @@ public abstract class Effect { }
|
||||
|
||||
public enum StatTarget { Current, Max }
|
||||
|
||||
public sealed class ModifyHealthEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
public sealed class ModifyDefenseEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
public sealed class ModifyDamageEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifyMPEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; }
|
||||
/// <summary>
|
||||
/// How to apply the Amount to the current stat value.
|
||||
/// "Add" (default) and "Subtract" use the Amount directly (positive integer recommended;
|
||||
/// Subtract flips the sign before applying). "Multiply" and "Divide" treat Amount as
|
||||
/// the multiplier/divisor integer (e.g. Multiply 2 = ×2). "Percent" treats Amount as
|
||||
/// a percentage (e.g. Percent 50 adds 50% of the base value).
|
||||
/// </summary>
|
||||
public enum StatModOperator { Add, Subtract, Multiply, Divide, Percent }
|
||||
|
||||
public sealed class ModifyHealthEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
public sealed class ModifyDefenseEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
public sealed class ModifyDamageEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
public sealed class ModifyMPEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatTarget StatTarget { get; set; } = StatTarget.Current; public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
|
||||
public sealed class SetMovementTypeEffect : Effect { public MovementType MovementType { get; set; } }
|
||||
public sealed class SetAttackRangeEffect : Effect { public int Min { get; set; } public int Max { get; set; } }
|
||||
public sealed class ModifyMinAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifyMaxAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); }
|
||||
public sealed class ModifyMinAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
public sealed class ModifyMaxAttackRangeEffect : Effect { public ValueExpr Amount { get; set; } = new(); public StatModOperator Operator { get; set; } = StatModOperator.Add; }
|
||||
public sealed class ModifyCostEffect : Effect { public int? Sp { get; set; } public int? St { get; set; } }
|
||||
public sealed class SetAffinityEffect : Effect { public AffinityExpr Affinity { get; set; } = new(); }
|
||||
public sealed class GrantAdditionalAttackEffect : Effect { public int N { get; set; } = 1; }
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
namespace SOR.Game.Abilities.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Stored in GameState when an Active ability's cost requires interactive player selection
|
||||
/// (e.g. "Discard a card of your choice from hand").
|
||||
///
|
||||
/// The engine pauses cost payment, pushes a CostPickRequestPush to the picker player,
|
||||
/// then resumes via GameCostPickHandler once the player submits their selection.
|
||||
/// </summary>
|
||||
public sealed class PendingCostPick
|
||||
{
|
||||
/// <summary>Correlation ID sent to the client so responses can be matched.</summary>
|
||||
public string RequestId { get; set; } = Guid.NewGuid().ToString("N");
|
||||
|
||||
/// <summary>AccountId of the player who activated the ability.</summary>
|
||||
public string ActorId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>InstanceId of the unit whose ability cost is being resolved.</summary>
|
||||
public string SourceInstanceId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>0-based index of the ability in the source unit's AbilitiesJson array.</summary>
|
||||
public int AbilityIndex { get; set; }
|
||||
|
||||
/// <summary>AccountId of the player who must pick (may differ from ActorId for EnemyPick modes).</summary>
|
||||
public string PickerActorId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>The cost type being interactively resolved.</summary>
|
||||
public string CostType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Number of cards/units the picker must select.</summary>
|
||||
public int Amount { get; set; } = 1;
|
||||
|
||||
/// <summary>The pick mode driving who selects and how.</summary>
|
||||
public string PickMode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>JSON-serialized Filter[]? — constraints on what the picker may select.</summary>
|
||||
public string? FiltersJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// JSON-serialized CostEntry[] of costs that still need paying after this pick resolves.
|
||||
/// Empty when this is the last interactive cost.
|
||||
/// </summary>
|
||||
public string RemainingCostsJson { get; set; } = "[]";
|
||||
|
||||
/// <summary>JSON-serialized Action[] — the full action list to execute after all costs are paid.</summary>
|
||||
public string ActionsJson { get; set; } = "[]";
|
||||
|
||||
/// <summary>JSON-serialized AbilityRange? — passed through to ExecuteActions on resume.</summary>
|
||||
public string? RangeJson { get; set; }
|
||||
|
||||
/// <summary>JSON-serialized DurationModel? — forceDuration passed to ExecuteActions on resume.</summary>
|
||||
public string? ForceDurationJson { get; set; }
|
||||
}
|
||||
@@ -831,3 +831,34 @@ public sealed record GameTriggeredTargetRequest(
|
||||
string RequestId,
|
||||
IReadOnlyList<AbilityTarget> Targets);
|
||||
|
||||
/// <summary>
|
||||
/// Pushed to the picker player when an Active ability cost requires interactive card/unit
|
||||
/// selection (e.g. "Discard a Spirit card of your choice").
|
||||
/// The client shows a zone picker and replies with <see cref="GameCostPickRequest"/>.
|
||||
/// </summary>
|
||||
public sealed record CostPickRequestPush(
|
||||
/// <summary>Correlation ID — must be echoed back in the response.</summary>
|
||||
string RequestId,
|
||||
/// <summary>InstanceId of the unit whose ability cost is being resolved.</summary>
|
||||
string SourceInstanceId,
|
||||
/// <summary>The cost type being resolved (e.g. "DiscardFromHand").</summary>
|
||||
string CostType,
|
||||
/// <summary>How many cards/units the picker must select.</summary>
|
||||
int Amount,
|
||||
/// <summary>Who is picking: "SelfPick", "EnemySeePick", "EnemyRandomPick", "EnemyPick".</summary>
|
||||
string PickMode,
|
||||
/// <summary>JSON-serialized Filter[]? constraining valid selections. Null = no constraint.</summary>
|
||||
string? FiltersJson);
|
||||
|
||||
/// <summary>
|
||||
/// Sent by the picker to submit their card/unit selections for a pending cost.
|
||||
/// </summary>
|
||||
public sealed record GameCostPickRequest(
|
||||
Guid SessionId,
|
||||
string RequestId,
|
||||
/// <summary>InstanceIds of the selected cards or units.</summary>
|
||||
IReadOnlyList<string> SelectedInstanceIds);
|
||||
|
||||
/// <summary>Acknowledged response for a cost pick submission.</summary>
|
||||
public sealed record GameCostPickResponse(bool Success);
|
||||
|
||||
|
||||
@@ -100,6 +100,13 @@ public sealed class GameState
|
||||
/// submits a <c>game.triggered_target</c> response.
|
||||
/// </summary>
|
||||
public Abilities.Models.PendingTriggeredTarget? PendingTriggeredTarget { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Non-null when an Active ability's cost requires interactive card/unit selection
|
||||
/// (CostPickMode.SelfPick / EnemyPick etc.). The game is effectively "paused" until
|
||||
/// the picker submits a <c>game.cost_pick</c> response.
|
||||
/// </summary>
|
||||
public Abilities.Models.PendingCostPick? PendingCostPick { get; set; }
|
||||
}
|
||||
|
||||
public sealed class PlayerState
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace SOR.Game.Handlers;
|
||||
|
||||
using System.Text.Json;
|
||||
using SOR.Database.Contexts;
|
||||
using SOR.Game.Abilities;
|
||||
using SOR.Networking.Abstractions.Messaging;
|
||||
using SOR.Networking.Abstractions.Push;
|
||||
using SOR.Networking.Abstractions.Transport;
|
||||
using SOR.Shared.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// game.cost_pick — player (or opponent) submits their card/unit selections for a
|
||||
/// paused Active ability cost (CostPickMode.SelfPick / EnemyPick etc.).
|
||||
///
|
||||
/// This handler resumes and completes cost payment, then executes the ability actions
|
||||
/// and broadcasts the updated game state to all players in the session.
|
||||
/// </summary>
|
||||
internal sealed class GameCostPickHandler : GameHandlerBase, IMessageHandler
|
||||
{
|
||||
private readonly IMessageSerializer _serializer;
|
||||
private readonly GameDbContext _gameDb;
|
||||
private readonly IClientPush _clientPush;
|
||||
|
||||
public GameCostPickHandler(
|
||||
IMessageSerializer serializer,
|
||||
GameDbContext gameDb,
|
||||
IClientPush clientPush)
|
||||
{
|
||||
_serializer = serializer;
|
||||
_gameDb = gameDb;
|
||||
_clientPush = clientPush;
|
||||
}
|
||||
|
||||
public string MessageType => "game.cost_pick";
|
||||
|
||||
public async Task<IServerMessage?> HandleAsync(
|
||||
IClientMessage message,
|
||||
AuthenticatedConnection connection,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var req = _serializer.DeserializePayload<GameCostPickRequest>(message.Payload);
|
||||
var actorId = connection.UserId;
|
||||
|
||||
var session = await LoadActiveSessionAsync(_gameDb, req.SessionId, actorId, ct);
|
||||
var prevStateJson = session.StateJson!;
|
||||
var state = GameEngine.Deserialize(prevStateJson);
|
||||
|
||||
var newState = AbilitySystem.ResumeCostPick(
|
||||
state, actorId, req.RequestId, req.SelectedInstanceIds);
|
||||
|
||||
await SaveStateAsync(_gameDb, session, newState, actorId, "game.cost_pick",
|
||||
JsonSerializer.Serialize(req), ct);
|
||||
|
||||
await PushStateToPlayersAsync(_clientPush, session, newState, ct, prevStateJson);
|
||||
|
||||
return ServerMessage.Reply("game.cost_pick.ack", message.Seq,
|
||||
new GameCostPickResponse(true));
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,9 @@ public static class ServiceRegistration
|
||||
// Triggered ability target response (player submits picks for a paused trigger)
|
||||
services.AddTransient<IMessageHandler, GameTriggeredTargetHandler>();
|
||||
|
||||
// Interactive cost pick response (player submits card/unit selections for an interactive cost)
|
||||
services.AddTransient<IMessageHandler, GameCostPickHandler>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user