Commit Graph

9 Commits

Author SHA1 Message Date
Brian Fertig 313d2548d9 feat: implement card leveling system and campaign progression
Adds a 5-level scaling system to all cards with progressively increasing stats and skill values. Introduces a campaign structure with unlock conditions, level requirements, and completion rewards that grant new cards and player level-ups.

Key changes:
- Refactored `data/cards.json` to use a `levels` array for stat progression
- Added `data/campaigns.json` defining 5 faction campaigns with mission lists and rewards
- Updated `CardManager.createInstance()` to accept a level parameter and resolve stats accordingly
- Implemented save migration (v1→v2) to track player level and unlocked campaigns
- Added `CampaignSelectScene` for browsing unlocked campaigns by faction/level
- Added `SkirmishSetupScene` allowing players to choose card levels for skirmishes
- Enhanced combat engine to pass level data to both player and AI decks
- Implemented visual animations for new skills: `enfeeble` (ATK reduction) and `jam` (skill suppression) with floating text feedback
- Updated UI components (Collection, Deck Builder, Store, Fusion) to display Level 1 stats by default
2026-03-14 13:00:16 -06:00
Brian Fertig 3c92d58055 feat(combat): implement preBattle/attack phases with pierce, protect, siege & counter animations
Refactor combat flow to separate preBattle (buffs/siege/protect) and attack phases. Introduce `preAttack` and `postAttack` events to handle temporary armor modifications (pierce) and restores.

Key changes:
- **Data Updates**: Updated `cards.json` and `skills.json` to reflect new triggers (`preBattle`, `preAttack`) for skills like Pierce, Protect, Siege, and Counter. Adjusted stats for Imperial Assault card.
- **Combat Logic**: Modified `CombatEngine.js` to process preBattle buffs sequentially (rally, siege, protect) and handle pierce armor reduction/restoration logic.
- **Skill Processor**: Updated `SkillProcessor.js` to implement positional logic for Protect (self + neighbors), direct armor reduction for Pierce, and counter damage calculation.
- **Animations**: Added new animation methods in `CardObject.js` (`animateArmorLoss`, `animateArmorGain`) and `BattleScene.js` to visualize:
  - **Pierce**: Projectile flying to target with armor drop animation, restored after attack.
  - **Protect**: Shields rising on source and flying to neighbors with armor gain animation.
  - **Siege**: Launcher overlay, missile arc trajectory, and explosion impact.
  - **Counter**: Spike projectile fired at impact during the attack hold phase.
- **Deck Builder**: Overhauled `DeckBuilderScene.js` with a scrollable card grid, faction/rarity filters, and improved deck management UI (owned/used counts).
2026-03-13 20:46:32 -06:00
Brian Fertig 031264bbb9 feat: Implement Siege mechanic and add Fullscreen toggle
- **Combat Logic**: Changed `siege` skill trigger from `on_attack` to `preBattle`.
- **Engine Updates**: Modified `_collectPreBattleBuffs` (renamed to `_collectPreBattleFires`) in `CombatEngine.js` to capture and log siege damage events separately from buffs.
- **Skill Processor**: Updated `SkillProcessor.js` to record `siegeTarget` and `siegeDamage` in the context for event logging.
- **Data Updates**: Adjusted descriptions and triggers in `cards.json` and `skills.json`.
- **UI**: Added a "Toggle Fullscreen" button to the Main Menu with state-aware labeling.
2026-03-13 17:08:30 -06:00
Brian Fertig a17adba1e9 feat(combat): implement pre-battle buffs and pre-attack skill animations
- Updated `cards.json` and `skills.json` to define `preBattle` (Rally) and `preAttack` (Strike, Mortar) triggers with new descriptions.
- Added `_preBattlePhase` in `CombatEngine.js` to process Rally skills before combat, tracking temporary buffs on cards.
- Added `_postBattlePhase` to remove temporary buffs after combat resolves, ensuring stat changes are cleared for the next turn.
- Modified `SkillProcessor.js` to handle `Strike`, `Mortar`, and `Rally` logic with context data for animation targets and damage values.
- Implemented `_onPreAttackStep` in `BattleScene.js` to sequence animations before the main attack:
  - `_animateMortarFire`: Flies a mortar shell in an arc, explodes on impact, and handles HP loss/death.
  - `_animateStrikeFire`: Launches a missile at the opposing lane/commander with similar impact effects.
  - `_animateRallyBuff`: Animates a flag flying between cards to visualize ATK gains.
- Updated `CardObject.js` `animateHPLoss` to accept explicit `fromHP`/`toHP` arguments, ensuring correct display values during multi-step damage sequences.
- Added `_playSkillExplosion` for consistent impact visual effects during skill resolution.
- Adjusted attack flow to pause for pre-attack animations before the standard card clash sequence.
2026-03-13 15:45:57 -06:00
Brian Fertig c7f4dc9bbb feat(combat): implement alternating initiative with enhanced attack animations
- Added `playerGoesFirst` state to `CombatEngine` to alternate turn order each round.
- Updated `beginTurn` and `beginCommit` to handle AI deployment based on the current initiative (opponent deploys first if they have initiative, otherwise after the player).
- Modified `_buildPendingAttacks` to respect the alternating attack order.
- Added `animateHPLoss` to `CardObject.js` for a visual HP reduction animation similar to the Berserk gain effect.
- Enhanced `_animateAttack` in `BattleScene.js`:
  - Integrated sprite animations for attacks (gun turret) and explosions using new spritesheets.
  - Synchronized HP loss and Berserk gain animations with the attack sprite completion.
  - Added an "Attacks First" indicator icon next to the commander of the side with initiative.
- Updated `BootScene.js` to load the new `attacksFirst` UI image and `attacks` spritesheet.
2026-03-13 10:31:09 -06:00
Brian Fertig 73ce826100 refactor(combat): change Berserk trigger to on_attack with animated gain
- Updated `cards.json` and `skills.json` to trigger Berserk on damage dealt (`on_attack`) instead of on kill, adjusting descriptions accordingly.
- Modified `CombatEngine.js` to emit a `berserk` event after successful attacks and removed the previous kill-based logic.
- Enhanced `SkillProcessor.js` to apply Berserk attack power gains only when damage is dealt during an attack.
- Added `animateBerserkGain` in `CardObject.js` to visually display the ATK increase with scaling, a "+N" label, and smooth transitions.
- Overhauled `_animateAttack` in `BattleScene.js`:
  - Cards now slide to the center and scale up during attacks, then return to their original positions.
  - Added a "VS" image that appears between cards during the clash.
  - Synchronized particle bursts, shakes, and damage numbers with the new centered animation timing.
  - Integrated Berserk gain animation into the attack flow, rewinding ATK text before animating the increase.
- Added `vs.png` asset loading in `BootScene.js`.
2026-03-13 09:32:55 -06:00
Brian Fertig e1656838fc refactor(combat): granular attack processing with live state updates
- Split `commitPlayerDeploy` into `beginCommit`, `processNextAttack`, and `finalizeCommit` to enable per-attack animation control.
- Introduce `_pendingAttacks` queue in CombatEngine to sequence attacks one by one, allowing the UI to react to intermediate damage (e.g., counter-kills).
- Refactor BattleScene commander rendering into persistent Containers (`commanderObjects`) that support live `refresh()` for HP/stats updates during combat.
- Update `_animateAttack` to handle commander targets and skip scale-back animations for dead cards, deferring cleanup to `_refreshCardAfterAttack`.
- Implement recursive attack loop in `_processNextAttackStep` that drives the battle forward, updating visuals immediately after each hit before proceeding.
2026-03-12 17:45:18 -06:00
Brian Fertig b9ee2b5aea refactor(combat): split turn into begin/commit phases with animated card picker
- Split CombatEngine.stepTurn() into beginTurn() (draw + AI deploy) and commitPlayerDeploy() (player choice + combat resolution).
- Add a card picker UI in BattleScene for player deployment, with pass option.
- Implement phased animations: deploy scale-in, sequential attack sequences with enlarged cards, particle bursts, shake/flash on defender, and floating damage numbers.
- Update CardObject to scale fonts/layout with card size and show ATK/HP/ARM/DLY stats plus skills text.
- Adjust battlefield layout constants (lane positions/commander column) and UI button placements for the new flow.
2026-03-12 17:11:17 -06:00
Brian Fertig 1a28234859 initial commit 2026-03-12 16:36:32 -06:00