[priority: critical] Guardian pact mana cost should scale with HP, power, and armor #200

Closed
opened 2026-05-29 13:05:08 +02:00 by Anexim · 3 comments
Owner

BUG: Pact mana cost doesn't scale with guardian difficulty

Bug Summary

Guardian pact costs are hardcoded arbitrary values that don't scale with guardian stats. Only combo guardians (floor 150+) derive cost from HP. User wants cost to scale with all relevant stats: HP, power, AND armor.

Current Behavior

  • File: src/lib/game/data/guardian-data.ts - All pact costs are hardcoded round numbers

  • Floor 10: pactCost: 500 vs HP: 5,000 / PWR: 50 / ARM: 10%

  • Floor 20: pactCost: 1,000 vs HP: 11,486 / PWR: 150 / ARM: 15%

  • Floor 140: pactCost: 300,000 vs HP: 578,096 / PWR: 30,000 / ARM: 35%

  • No formula ties cost to stats

  • File: src/lib/game/data/guardian-encounters.ts, line 96 - Only combo guardians use formula: pactCost: Math.floor(hp * 0.5)

Required Fix

Create a formula that scales pact cost with HP, power, AND armor:

pactCost = f(hp, power, armor, floor)

Suggested formula (balance as needed):

pactCost = Math.floor((hp * 0.3 + power * 5 + hp * armor * 0.5) * scalingFactor)

Apply this to ALL guardians, not just combo guardians.

Priority

CRITICAL - Required for guardian restructure and game balance

**BUG: Pact mana cost doesn't scale with guardian difficulty** ### Bug Summary Guardian pact costs are hardcoded arbitrary values that don't scale with guardian stats. Only combo guardians (floor 150+) derive cost from HP. User wants cost to scale with all relevant stats: HP, power, AND armor. ### Current Behavior - **File:** `src/lib/game/data/guardian-data.ts` - All pact costs are hardcoded round numbers - Floor 10: `pactCost: 500` vs HP: 5,000 / PWR: 50 / ARM: 10% - Floor 20: `pactCost: 1,000` vs HP: 11,486 / PWR: 150 / ARM: 15% - Floor 140: `pactCost: 300,000` vs HP: 578,096 / PWR: 30,000 / ARM: 35% - **No formula ties cost to stats** - **File:** `src/lib/game/data/guardian-encounters.ts`, line 96 - Only combo guardians use formula: `pactCost: Math.floor(hp * 0.5)` ### Required Fix Create a formula that scales pact cost with HP, power, AND armor: ``` pactCost = f(hp, power, armor, floor) ``` Suggested formula (balance as needed): ``` pactCost = Math.floor((hp * 0.3 + power * 5 + hp * armor * 0.5) * scalingFactor) ``` Apply this to ALL guardians, not just combo guardians. ### Priority CRITICAL - Required for guardian restructure and game balance
Anexim added the ai:todo label 2026-05-29 13:05:08 +02:00
n8n-gitea was assigned by Anexim 2026-05-29 13:05:08 +02:00
Author
Owner

Starting work on guardian pact mana cost scaling. Will replace hardcoded pactCost values in guardian-data.ts with a formula that scales with HP, power, and armor, using the suggested formula from the issue as a starting point.

Starting work on guardian pact mana cost scaling. Will replace hardcoded pactCost values in guardian-data.ts with a formula that scales with HP, power, and armor, using the suggested formula from the issue as a starting point.
Author
Owner

Fix applied and committed.

Changes Made

src/lib/game/data/guardian-data.ts

  • Added pactCost(hpVal, power, armor) helper function using the formula:
    pactCost = floor(hp * 0.3 + power * 5 + hp * armor * 0.5)
    
  • Replaced all 14 hardcoded pactCost values with calls to the formula, passing each guardian's actual HP, power, and armor values.

src/lib/game/data/guardian-encounters.ts

  • Updated getComboGuardian() to use the same formula for both pactCost and signingCost, replacing the old Math.floor(hp * 0.5) which only scaled with HP.

Sample Output (new costs)

Floor HP Power Armor Old Cost New Cost
10 5,000 50 10% 500 2,000
50 43,911 800 20% 8,000 21,564
100 199,053 8,000 25% 80,000 124,597
140 578,096 30,000 35% 300,000 424,595

All 896 tests passing. Pre-commit checks passed (file sizes, circular deps).

**Fix applied and committed.** ### Changes Made **`src/lib/game/data/guardian-data.ts`** - Added `pactCost(hpVal, power, armor)` helper function using the formula: ``` pactCost = floor(hp * 0.3 + power * 5 + hp * armor * 0.5) ``` - Replaced all 14 hardcoded `pactCost` values with calls to the formula, passing each guardian's actual HP, power, and armor values. **`src/lib/game/data/guardian-encounters.ts`** - Updated `getComboGuardian()` to use the same formula for both `pactCost` and `signingCost`, replacing the old `Math.floor(hp * 0.5)` which only scaled with HP. ### Sample Output (new costs) | Floor | HP | Power | Armor | Old Cost | New Cost | |-------|----|-------|-------|----------|----------| | 10 | 5,000 | 50 | 10% | 500 | 2,000 | | 50 | 43,911 | 800 | 20% | 8,000 | 21,564 | | 100 | 199,053 | 8,000 | 25% | 80,000 | 124,597 | | 140 | 578,096 | 30,000 | 35% | 300,000 | 424,595 | All 896 tests passing. Pre-commit checks passed (file sizes, circular deps).
Author
Owner

Issue resolved. Guardian pact costs now scale with HP, power, and armor using the formula floor(hp * 0.3 + power * 5 + hp * armor * 0.5). Applied to all 14 static guardians and combo guardians. Commit: 86c80a2.

Issue resolved. Guardian pact costs now scale with HP, power, and armor using the formula `floor(hp * 0.3 + power * 5 + hp * armor * 0.5)`. Applied to all 14 static guardians and combo guardians. Commit: 86c80a2.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#200