feat: endurance tickets — coûts visibles partout + budget dashboard
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 31s

Combat: coût 5 affiché, compteur "X combats possibles", bouton disabled
Forge: coût 10 + or affiché (baissé de 15 à 10), bouton disabled
Dashboard: indicateur budget "X combats · Y forges · Z repos"
Repos: coût 10 affiché, disabled si insuffisant
This commit is contained in:
2026-03-24 17:09:06 +01:00
parent cfdc5c9b02
commit eafac3d8c7
4 changed files with 98 additions and 36 deletions

View File

@@ -153,6 +153,11 @@ export function DashboardPage() {
const xpNext = (char as any).xpToNextLevel ?? Math.round(100 * Math.pow(char.level, 1.5));
const statPoints = (char as any).statPoints ?? 0;
const needsHeal = char.hpCurrent < char.hpMax;
const endurance = (char as any).enduranceCurrent ?? (char as any).endurance ?? 0;
const REST_COST = 10;
const COMBAT_COST = 5;
const FORGE_COST = 10;
const canRest = endurance >= REST_COST && needsHeal;
return (
<div>
@@ -210,17 +215,28 @@ export function DashboardPage() {
</div>
<Bar value={char.xp} max={xpNext} type="xp" showValues={false} />
</div>
{/* Budget endurance */}
<div style={{ marginTop: 8, padding: '6px 8px', background: '#111620', borderRadius: 6, fontSize: 11, color: '#6b7a99' }}>
<span style={{ fontWeight: 700, color: '#5ba4f5' }}> Budget :</span>
{' '}{Math.floor(endurance / COMBAT_COST)} combats
{' · '}{Math.floor(endurance / FORGE_COST)} forges
{' · '}{Math.floor(endurance / REST_COST)} repos
</div>
{needsHeal && (
<button
className="btn btn-ghost"
style={{ marginTop: 4, fontSize: 12, display: 'flex', alignItems: 'center', gap: 6, justifyContent: 'center' }}
disabled={restMut.isPending}
style={{ marginTop: 4, fontSize: 12, display: 'flex', alignItems: 'center', gap: 6, justifyContent: 'center', opacity: canRest ? 1 : 0.5 }}
disabled={restMut.isPending || !canRest}
onClick={() => restMut.mutate()}
>
<BedDouble size={13} />
{restMut.isPending ? 'Repos…' : 'Se reposer (+50% PV, -20 endurance)'}
{restMut.isPending ? 'Repos…' : `Se reposer (+50% PV, ${REST_COST}⚡)`}
</button>
)}
{needsHeal && !canRest && endurance < REST_COST && (
<p style={{ fontSize: 10, color: '#e84040', textAlign: 'center', margin: '2px 0 0' }}>Endurance insuffisante pour se reposer</p>
)}
{restMut.isError && <p style={{ color: '#e84040', fontSize: 11, marginTop: 2 }}>{(restMut.error as Error).message}</p>}
</div>
</div>