Skip to content

feat: Charge Up system — 8-hour free forge timer with capped rarity - #354

Draft
driver727-pixel wants to merge 2 commits into
mainfrom
gamma/charge-up-system-dc01
Draft

feat: Charge Up system — 8-hour free forge timer with capped rarity#354
driver727-pixel wants to merge 2 commits into
mainfrom
gamma/charge-up-system-dc01

Conversation

@driver727-pixel

Copy link
Copy Markdown
Owner

Summary

Implements the "Charge Up" mechanic — every 8 hours players earn one free forge attempt, capped at Apprentice rarity. This is the first cadence hook in the Daily → Weekly → Seasonal engagement loop, designed to bring players back 2–3x/day.

How It Works

  1. Every 8 hours, the ChargeUpIndicator shows "Charge Up Ready" with a lightning bolt and pulse animation
  2. When ready, the player can forge a card for free — rarity is automatically clamped to Punch Skater or Apprentice (no Rare/Legendary via charge)
  3. After use, the timer resets and counts down to the next available charge
  4. The charge timer persists via localStorage and is independent of tier/credits

Integration Points

  • canForge extended: TierContext now considers chargeUp.available — players who are out of credits AND have used their free card can still forge if a charge is ready
  • Credit priority: Charge Up is only consumed when no other forge method is available (paid tier takes priority, then free card, then credits, then charge)
  • Rarity clamping: When forging via Charge Up, clampToChargeRarity() ensures the generated card is at most Apprentice rarity

Files Changed

File Change
src/lib/chargeUp.ts Core timer logic, rarity clamping, localStorage persistence
src/hooks/useChargeUp.ts React hook with live 1-second countdown ticker
src/components/ChargeUpIndicator.tsx UI component: timer countdown or "Ready" state
src/context/TierContext.tsx Extended canForge to include charge availability
src/pages/cardForge/useForgeGeneration.ts Detects charge forge, clamps rarity, consumes charge
src/pages/cardForge/useCardForgeController.ts Passes chargeUp through controller
src/pages/CardForge.tsx Mounts ChargeUpIndicator below quick actions
src/lib/featureFlags.ts Added CHARGE_UP flag (default false)
src/lib/sharedTypes.ts Added ChargeUpState interface for Firestore persistence
firestore.rules Added chargeUps/{uid} read-only stub rule
src/index.css Charge Up indicator styles with pulse animation

Feature Flag

Ships behind VITE_FF_CHARGE_UP. Set to true to enable. Default false in production until QA.

Testing

  • ESLint: passes clean
  • TypeScript: tsc --noEmit passes clean
Open in Web Open in Cursor 

cursoragent and others added 2 commits April 23, 2026 04:31
…ture flags, server stubs, Firestore rule stubs

- docs/DATA_MODEL.md: audit of all existing Firestore collections with document shapes
- docs/AGENT_STATUS.md: daily sync artifact for Gamma/Charlie coordination
- src/lib/sharedTypes.ts: append-only shared contract file (DailyStreak, Mission, BattlePassState, Crew, RankedSeason, RankedEntry, ShareLink)
- src/lib/featureFlags.ts: central feature-flag registry (all default false)
- server/battlePass.js, server/ranked.js, server/crews.js, server/dailyRewards.js: no-op handler stubs
- firestore.rules: read-only stub rules for dailyStreaks, missions, battlePass, crews, rankedSeasons, shareLinks

Co-authored-by: SP Digital <driver727@gmail.com>
- src/lib/chargeUp.ts: core timer logic (8h interval, localStorage persistence, rarity clamping to Apprentice max)
- src/hooks/useChargeUp.ts: React hook with live countdown ticker
- src/components/ChargeUpIndicator.tsx: UI indicator showing timer/ready state
- TierContext: extended canForge to include chargeUp.available
- useForgeGeneration: detects charge forge, clamps rarity, consumes charge
- CardForge.tsx: mounts ChargeUpIndicator below quick actions
- featureFlags.ts: added CHARGE_UP flag (default false)
- sharedTypes.ts: added ChargeUpState interface
- firestore.rules: added chargeUps/{uid} read-only stub
- index.css: charge-up-indicator styles with pulse animation

Co-authored-by: SP Digital <driver727@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants