Commit Graph

4 Commits

Author SHA1 Message Date
Brian Fertig 4b86a85358 feat(total-annihilation): add unit/building repair system
Allow builders to repair damaged friendly units and buildings by
right-clicking them. Repair cost and duration are proportional to the
damage healed (X% HP restoration costs X% of build cost and takes X%
of build time).

Key changes:
- New 'repair' order type with validation (own units only, must be
  damaged, requires a builder)
- Separate _repairPower accumulator so repairing a damaged factory
  doesn't silently speed up its production queue
- Repair drains energy/mass through the same economy machinery as
  construction, including brownout throttling
- HUD hints guide players to right-click damaged allies to repair
- Repair order auto-clears when complete; unqueued orders interrupt it
  while queued orders wait behind it
- Visual waypoint color for repair orders
- Comprehensive test coverage in verifyTotalAnnihilation.js
2026-07-24 21:50:34 -06:00
Brian Fertig 1f4f8d1b30 fix(totalannihilation): ensure self-heal damage clock survives serialization
- Initialize lastDamagedTick to -1e9 for fresh units (finite sentinel to avoid JSON.stringify null)
- Add lastDamagedTick to serialize/deserialize so the pause timer persists across save/load
- Add comprehensive tests for self-heal behavior:
  - Rate verification (~33% max HP/min)
  - 30s pause after damage and clock restart on new hits
  - Sustained fire suppression
  - No overhealing
  - Non-selfHeal units don't regenerate
  - Damage clock survives save/load round-trip
2026-07-24 21:34:27 -06:00
Brian Fertig ddac7fcd5a feat(ta): add order queueing with CTRL and visual waypoint feedback
- Queue multiple orders per unit by holding CTRL (matching original game)
- Draw colored waypoint chains on the minimap/world for each queued order
- Display queued order count in selection detail panel
- Limit queue overlay to MAX_QUEUE_LINES to avoid clutter in large selections
- Use distinct colors per order type (move, attack, patrol, build, etc.)
- Update hint text and placement UI to mention queueing behavior
- Add verification tests for queue append/replace semantics, consumption order,
  and queued build orders
2026-07-24 20:58:08 -06:00
Brian Fertig e7da172896 feat: add Total Annihilation game with campaign, AI, and full engine
Add a complete Total Annihilation clone including:

- TotalAnnihilationGame.js: Main scene with fixed-step loop, input handling,
  camera controls, selection, orders, and match lifecycle
- TAHud.js: Resource strip with flow rates, selection info, build/production
  grid, minimap with fog of war, and toast notifications
- TAScreens.js: Main menu, skirmish setup, campaign list, pause menu, and
  victory/defeat results
- totalannihilation-campaign.json: 6 hand-authored campaign missions with
  escalating difficulty (skill 1→5)
- tools/genTACampaign.js: Campaign generator that bakes terrain from the
  seeded map generator
- tools/verifyTotalAnnihilation.js: 13-section end-to-end test suite covering
  rules integrity, artwork, economy, pathfinding, combat, fog of war,
  map generation, serialization, AI skill ladder, and campaign winnability
- tools/lib/taStubScene.js: Minimal Phaser stub for headless testing

Engine improvements:
- TALogic.js: Swept projectile collision (no tunneling), quadratic AoE
  falloff, manual weapon support (D-Gun), unrecoverable elimination, onTick
  callback for AI stepping
- TAAI.js: Skill-based economy ladders, simultaneous factory+economy growth,
  sticky focus-fire, home defense gating by skill, tune/profile overrides
- TANav.js: fitField dilation for unit clearance, stale fit mask invalidation
- TAWorldView.js: _addWorld for layer ordering, frame-accurate zoom anchor
  math, container depth sorting every frame
- TARules.js: autoRangeOf excludes manual weapons, manual flag compilation

Art & data:
- Mayan civilization artwork added to civilization-artwork.json
- Several opponents switched to mayan citySheet
- totalannihilation-rules.json: balanced unit stats, new commanderlaser weapon,
  restructured AI skill tuning, formatted JSON
- sprites.md: complete art spec for drop-in PNG sheets
- Registered in gamesRegistry, assetManifest, PreloadScene, GameRoomScene,
  and soundtrack service
2026-07-24 20:57:40 -06:00