[Phase 2.3] Macro/Micro Combat Loop, Layered Stat Math & End-of-Turn Healing #9

Open
opened 2026-11-17 06:12:17 +00:00 by john4064 · 0 comments
Owner

Goal

Implement the pure apply_match_intent macro/micro turn state machine (MatchState, MatchIntent, MatchDomainEvent, MatchRuleError).

Metadata

  • Phase / Step: Phase 2.3
  • Depends On: #8, #23
  • Unlocks: #10, #24, #25, #26
  • Target Crates / Paths: crates/chaotic_core/src/match_state.rs, crates/chaotic_core/src/combat.rs
  • Line Budget Plan: Production .rs <= 400 lines, test .rs <= 600 lines, mod.rs < 80 lines (AGENTS.md Section 2.3)

Acceptance Criteria

  • Implement pub fn apply_match_intent(state: &mut MatchState, player: PlayerId, intent: MatchIntent) -> Result<Vec<MatchDomainEvent>, MatchRuleError>.
  • Macro turn loop: Location flip (previous Active Location returns face-down to bottom of owner's Location Deck — zero Location discard pile) -> Action Step -> Engagement -> Recovery Step.
  • Combat micro-loop: Start-of-combat triggers -> InitiativeCriteria evaluation (ties to Active Player) -> Strike Phase -> Damage resolution.
  • Strike hand flow: 2-card starting Attack hand, draw 1 Attack at start of each Strike (3-card choice), deterministic discard reshuffle on empty Attack deck.
  • Evaluate BaseDamage, active Element damage, Check/Fail/Challenge, and Outperform; break simultaneous final-Creature destruction ties in favor of Active Player.
  • Recovery Step resets current_damage_taken = 0, restores Expended Elements, and expires end-of-turn modifiers.
## Goal Implement the pure `apply_match_intent` macro/micro turn state machine (`MatchState`, `MatchIntent`, `MatchDomainEvent`, `MatchRuleError`). ## Metadata - **Phase / Step:** Phase 2.3 - **Depends On:** #8, #23 - **Unlocks:** #10, #24, #25, #26 - **Target Crates / Paths:** `crates/chaotic_core/src/match_state.rs`, `crates/chaotic_core/src/combat.rs` - **Line Budget Plan:** Production `.rs` <= 400 lines, test `.rs` <= 600 lines, `mod.rs` < 80 lines (`AGENTS.md` Section 2.3) ## Acceptance Criteria - [ ] Implement `pub fn apply_match_intent(state: &mut MatchState, player: PlayerId, intent: MatchIntent) -> Result<Vec<MatchDomainEvent>, MatchRuleError>`. - [ ] Macro turn loop: Location flip (previous Active Location returns face-down to bottom of owner's Location Deck — zero Location discard pile) -> Action Step -> Engagement -> Recovery Step. - [ ] Combat micro-loop: Start-of-combat triggers -> `InitiativeCriteria` evaluation (ties to Active Player) -> Strike Phase -> Damage resolution. - [ ] Strike hand flow: 2-card starting Attack hand, draw 1 Attack at start of each Strike (3-card choice), deterministic discard reshuffle on empty Attack deck. - [ ] Evaluate `BaseDamage`, active `Element` damage, `Check`/`Fail`/`Challenge`, and `Outperform`; break simultaneous final-Creature destruction ties in favor of Active Player. - [ ] Recovery Step resets `current_damage_taken = 0`, restores **Expended Elements**, and expires end-of-turn modifiers.
Sign in to join this conversation.
No description provided.