Add AbilitySystem — core effect execution, trigger hooks, activate_ability handler
- AbilitySystem.cs: full rewrite — ActivateAbility, FireTrigger, FireCardEffects, ExecuteActions, ResolveTargets, ExecuteEffect (§5.1–5.10), condition evaluation, filter evaluation, trigger matching, value/affinity resolution - GameState.cs: CardInstance gains AbilitiesJson, EffectsJson, AbilityUsesThisTurn, Genus; PlayerState gains SpAccumulationBonus, DrawPerTurnBonus and 12 action- restriction flags; GameState gains ActiveEffects list; new ActiveEffect class - GameMessages.cs: GameActivateAbilityRequest/Response + AbilityTarget DTO - GameEngine.cs: ActivateAbility public method; trigger hooks in ChannelCard, MoveUnit, Attack (UnitAttack + UnitDeath), Sacrifice, EndTurn (TurnEnd/TurnStart), Ascend, Transition; AbilitiesJson/EffectsJson copied in DefinitionToInstance, BuildPlayerState, ToFieldCard; Repentance/Instinct/Ruin now fire EffectsJson inline - GameActivateAbilityHandler: game.activate_ability message handler - ServiceRegistration: register GameActivateAbilityHandler 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:
@@ -67,6 +67,17 @@ public sealed record GameAscendRequest(Guid SessionId, string IncomingCardInstan
|
||||
/// </summary>
|
||||
public sealed record GameTransitionRequest(Guid SessionId, string IncomingCardInstanceId);
|
||||
|
||||
/// <summary>
|
||||
/// Activate an Active ability on one of the player's field units.
|
||||
/// AbilityIndex is 0-based into the source unit's AbilitiesJson array.
|
||||
/// Targets is required when the ability needs player-chosen targets.
|
||||
/// </summary>
|
||||
public sealed record GameActivateAbilityRequest(
|
||||
Guid SessionId,
|
||||
string SourceInstanceId,
|
||||
int AbilityIndex,
|
||||
IReadOnlyList<AbilityTarget>? Targets = null);
|
||||
|
||||
// ── Custom lobby requests ─────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Create a new custom lobby. Host provides their deck and optional rule overrides.</summary>
|
||||
@@ -125,6 +136,8 @@ public sealed record GameAscendResponse(GameStateDto State);
|
||||
|
||||
public sealed record GameTransitionResponse(GameStateDto State);
|
||||
|
||||
public sealed record GameActivateAbilityResponse(GameStateDto State);
|
||||
|
||||
// ── Custom lobby responses ─────────────────────────────────────────────────────
|
||||
|
||||
public sealed record CreateCustomLobbyResponse(
|
||||
@@ -255,3 +268,15 @@ public sealed record CustomRulesDto(
|
||||
int SpCap,
|
||||
int BoardWidth,
|
||||
int BoardHeight);
|
||||
|
||||
/// <summary>
|
||||
/// A single client-provided target for one action in an ability.
|
||||
/// Exactly one of InstanceId or Coord should be set, matching the action's TargetType.
|
||||
/// </summary>
|
||||
public sealed record AbilityTarget(
|
||||
/// <summary>0-based index of the ability action this target satisfies.</summary>
|
||||
int ActionIndex,
|
||||
/// <summary>Set for unit/card targets.</summary>
|
||||
string? InstanceId = null,
|
||||
/// <summary>Set for tile targets.</summary>
|
||||
CoordDto? Coord = null);
|
||||
|
||||
Reference in New Issue
Block a user