[medium] Discipline stat bonuses use raw stat keys instead of player-friendly text #135

Closed
opened 2026-05-25 11:36:14 +02:00 by Anexim · 2 comments
Owner

UI Issue: Discipline cards show raw stat keys like "elementCap_fire" instead of readable text

Description

The DisciplineCard component renders disc.statBonus directly, which contains raw internal stat keys like elementCap_fire, maxManaBonus, enchantPower, etc. These are not player-friendly.

Current State

In DisciplinesTab.tsx:

<div className="mt-2 text-sm">
  <strong>Stat Bonus:</strong> {activeStatBonus.toFixed(2)} on {statBonus}
</div>

Where statBonus is disc.statBonus.stat — the raw key from the discipline definition.

Example outputs players see:

  • elementCap_fire (should be "Fire Mana Capacity")
  • maxManaBonus (should be "Max Mana")
  • enchantPower (should be "Enchantment Power")
  • clickManaMultiplier (should be "Click Mana Multiplier")
  • baseDamageBonus (should be "Base Damage")
  • golemCapacity (should be "Golem Capacity")
  • craftingCostReduction (should be "Crafting Cost Reduction")

Expected Behavior

All stat bonus descriptions should use human-readable, properly formatted text. Either:

  1. Add a statBonus.name or statBonus.label field to DisciplineDefinition with display text
  2. OR create a mapping function/object that translates stat keys to display names
  3. OR add a displayName field to the statBonus object in the type definition

Files Involved

  • src/lib/game/types/disciplines.tsstatBonus: { stat: string; baseValue: number } needs a display name field
  • src/lib/game/data/disciplines/*.ts — all discipline definitions need display names
  • src/components/game/tabs/DisciplinesTab.tsxDisciplineCardDefinition.statBonus should be the display name, not the key
  • src/lib/game/effects/discipline-effects.ts — uses def.statBonus.stat internally (should keep using the key for computation, display separately)

Suggested Fix (Option A — add label to type)

// In types/disciplines.ts
statBonus: { stat: string; baseValue: number; label: string }

Then in each discipline:

statBonus: { stat: 'elementCap_fire', baseValue: 5, label: 'Fire Mana Capacity' }

Suggested Fix (Option B — mapping object)

Create a STAT_DISPLAY_NAMES mapping in a utility file and use it in the UI component. This avoids changing the type definition but requires maintaining a separate mapping.

## UI Issue: Discipline cards show raw stat keys like "elementCap_fire" instead of readable text ### Description The `DisciplineCard` component renders `disc.statBonus` directly, which contains raw internal stat keys like `elementCap_fire`, `maxManaBonus`, `enchantPower`, etc. These are not player-friendly. ### Current State In `DisciplinesTab.tsx`: ```tsx <div className="mt-2 text-sm"> <strong>Stat Bonus:</strong> {activeStatBonus.toFixed(2)} on {statBonus} </div> ``` Where `statBonus` is `disc.statBonus.stat` — the raw key from the discipline definition. Example outputs players see: - `elementCap_fire` (should be "Fire Mana Capacity") - `maxManaBonus` (should be "Max Mana") - `enchantPower` (should be "Enchantment Power") - `clickManaMultiplier` (should be "Click Mana Multiplier") - `baseDamageBonus` (should be "Base Damage") - `golemCapacity` (should be "Golem Capacity") - `craftingCostReduction` (should be "Crafting Cost Reduction") ### Expected Behavior All stat bonus descriptions should use human-readable, properly formatted text. Either: 1. Add a `statBonus.name` or `statBonus.label` field to `DisciplineDefinition` with display text 2. OR create a mapping function/object that translates stat keys to display names 3. OR add a `displayName` field to the `statBonus` object in the type definition ### Files Involved - `src/lib/game/types/disciplines.ts` — `statBonus: { stat: string; baseValue: number }` needs a display name field - `src/lib/game/data/disciplines/*.ts` — all discipline definitions need display names - `src/components/game/tabs/DisciplinesTab.tsx` — `DisciplineCardDefinition.statBonus` should be the display name, not the key - `src/lib/game/effects/discipline-effects.ts` — uses `def.statBonus.stat` internally (should keep using the key for computation, display separately) ### Suggested Fix (Option A — add label to type) ```ts // In types/disciplines.ts statBonus: { stat: string; baseValue: number; label: string } ``` Then in each discipline: ```ts statBonus: { stat: 'elementCap_fire', baseValue: 5, label: 'Fire Mana Capacity' } ``` ### Suggested Fix (Option B — mapping object) Create a `STAT_DISPLAY_NAMES` mapping in a utility file and use it in the UI component. This avoids changing the type definition but requires maintaining a separate mapping.
Anexim added the ai:todo label 2026-05-25 11:36:14 +02:00
n8n-gitea was assigned by Anexim 2026-05-25 11:36:14 +02:00
Author
Owner

Fix applied for Issue #135: Discipline stat bonuses now show player-friendly labels

Changes Made

Type definition (src/lib/game/types/disciplines.ts):

  • Added label: string to statBonus in DisciplineDefinition

All discipline data files — added label field to every statBonus object:

  • base.ts — "Max Mana", "Fire Mana Capacity"
  • elemental-regen.ts — dynamic ${name} Regen/tick (Fire/Water/Air/Earth/Light/Dark/Death), "Transference Regen/tick"
  • elemental-regen-advanced.ts — "Metal/Sand/Lightning/Crystal/Stellar/Void Regen/tick"
  • enchanter.ts — "Enchantment Power" (×3), "Click Mana Multiplier"
  • enchanter-special.ts — "Enchantment Power"
  • enchanter-spells.ts — "Enchantment Power" (×3)
  • enchanter-utility.ts — "Study Speed", "Max Mana"
  • fabricator.ts — "Golem Capacity", "Crafting Cost Reduction"
  • invoker.ts — "Base Damage", "Base Damage Multiplier"

UI component (DisciplinesTab.tsx):

  • Added statBonusLabel: string to DisciplineCardDefinition interface
  • Updated DisciplineCard to destructure and display statBonusLabel instead of raw statBonus key
  • Updated card definition mapping to pass disc.statBonus.label

Verification: TypeScript compiles cleanly, all 42 discipline-math tests pass.

**Fix applied for Issue #135: Discipline stat bonuses now show player-friendly labels** ### Changes Made **Type definition** (`src/lib/game/types/disciplines.ts`): - Added `label: string` to `statBonus` in `DisciplineDefinition` **All discipline data files** — added `label` field to every `statBonus` object: - `base.ts` — "Max Mana", "Fire Mana Capacity" - `elemental-regen.ts` — dynamic `${name} Regen/tick` (Fire/Water/Air/Earth/Light/Dark/Death), "Transference Regen/tick" - `elemental-regen-advanced.ts` — "Metal/Sand/Lightning/Crystal/Stellar/Void Regen/tick" - `enchanter.ts` — "Enchantment Power" (×3), "Click Mana Multiplier" - `enchanter-special.ts` — "Enchantment Power" - `enchanter-spells.ts` — "Enchantment Power" (×3) - `enchanter-utility.ts` — "Study Speed", "Max Mana" - `fabricator.ts` — "Golem Capacity", "Crafting Cost Reduction" - `invoker.ts` — "Base Damage", "Base Damage Multiplier" **UI component** (`DisciplinesTab.tsx`): - Added `statBonusLabel: string` to `DisciplineCardDefinition` interface - Updated `DisciplineCard` to destructure and display `statBonusLabel` instead of raw `statBonus` key - Updated card definition mapping to pass `disc.statBonus.label` **Verification**: TypeScript compiles cleanly, all 42 discipline-math tests pass.
Author
Owner

Fixed — all discipline stat bonuses now display player-friendly labels instead of raw stat keys.

Fixed — all discipline stat bonuses now display player-friendly labels instead of raw stat keys.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#135