zenno/race/stam: remove the hard parts for now

This commit is contained in:
2026-08-30 16:08:58 -04:00
parent 0d3cf24714
commit e5f18d3c78
+18 -13
View File
@@ -30,9 +30,9 @@
let thresh1: race.Stat | undefined = $state(); let thresh1: race.Stat | undefined = $state();
let thresh2: race.Stat | undefined = $state(); let thresh2: race.Stat | undefined = $state();
const rushedOpts = ['No Rushed', 'Rushed Enabled', 'Rushed Forced'] as const; // const rushedOpts = ['No Rushed', 'Rushed Enabled', 'Rushed Forced'] as const;
let rushedType: (typeof rushedOpts)[number] = $state('No Rushed'); // let rushedType: (typeof rushedOpts)[number] = $state('No Rushed');
let spotStruggleEnabled = $state(false); // let spotStruggleEnabled = $state(false);
const baseStats = $derived({ const baseStats = $derived({
[race.Stat.Speed]: race.baseStat(mood, rawStats[race.Stat.Speed]), [race.Stat.Speed]: race.baseStat(mood, rawStats[race.Stat.Speed]),
@@ -94,8 +94,8 @@
] as [number, number], ] as [number, number],
}); });
const isFront = $derived(style === race.RunningStyle.FrontRunner || style === race.RunningStyle.Runaway); // const isFront = $derived(style === race.RunningStyle.FrontRunner || style === race.RunningStyle.Runaway);
const spotStruggle = $derived(spotStruggleEnabled && isFront); // const spotStruggle = $derived(spotStruggleEnabled && isFront);
const maxHP = $derived(race.maxHP(raceLen, style, stats[race.Stat.Stamina])); const maxHP = $derived(race.maxHP(raceLen, style, stats[race.Stat.Stamina]));
@@ -129,6 +129,7 @@
), ),
); );
const needHP = $derived(race.fullSpurtHP(raceLen, phaseSpeed[race.Phase.LateRace][0], spurtHPRate)); const needHP = $derived(race.fullSpurtHP(raceLen, phaseSpeed[race.Phase.LateRace][0], spurtHPRate));
const needHPPer = $derived((100 * needHP) / maxHP);
const spurtStartHP = $derived(sections.findLast((s) => s.phase !== race.Phase.LateRace)?.remain); const spurtStartHP = $derived(sections.findLast((s) => s.phase !== race.Phase.LateRace)?.remain);
let slopeAddParams: course.Slope = $state({ per: 1, span: [0, 0] }); let slopeAddParams: course.Slope = $state({ per: 1, span: [0, 0] });
@@ -144,11 +145,11 @@
slopesRaw.splice(i, 1); slopesRaw.splice(i, 1);
} }
const phaseNames = { // const phaseNames = {
[race.Phase.EarlyRace]: 'Early', // [race.Phase.EarlyRace]: 'Early',
[race.Phase.MidRace]: 'Mid', // [race.Phase.MidRace]: 'Mid',
[race.Phase.LateRace]: 'Late', // [race.Phase.LateRace]: 'Late',
} as const; // } as const;
</script> </script>
<h1 class="text-4xl">Stamina Calculator</h1> <h1 class="text-4xl">Stamina Calculator</h1>
@@ -260,6 +261,7 @@
</select> </select>
</div> </div>
</div> </div>
<!--
<div class="mx-auto mt-8 grid max-w-lg grid-cols-2 gap-4 rounded-md p-4 text-center shadow-md ring"> <div class="mx-auto mt-8 grid max-w-lg grid-cols-2 gap-4 rounded-md p-4 text-center shadow-md ring">
<select id="rushed" class="w-full" bind:value={rushedType}> <select id="rushed" class="w-full" bind:value={rushedType}>
{#each rushedOpts as opt (opt)} {#each rushedOpts as opt (opt)}
@@ -271,7 +273,8 @@
<input type="checkbox" class="min-h-6 min-w-6 align-middle" id="rushed" role="switch" bind:checked={spotStruggleEnabled} /> <input type="checkbox" class="min-h-6 min-w-6 align-middle" id="rushed" role="switch" bind:checked={spotStruggleEnabled} />
</div> </div>
</div> </div>
<div class="mx-auto mt-8 max-w-4xl rounded-md p-4 text-center shadow-md ring"> -->
<div class="mx-auto mt-8 hidden max-w-4xl rounded-md p-4 text-center shadow-md ring">
<!-- TODO(zeph): this doesn't work for mobile --> <!-- TODO(zeph): this doesn't work for mobile -->
<table class="w-full table-fixed border-spacing-4"> <table class="w-full table-fixed border-spacing-4">
<caption>Slopes</caption> <caption>Slopes</caption>
@@ -302,7 +305,7 @@
{/each} {/each}
<tr> <tr>
<td> <td>
<select id={`slopeAddPer`} bind:value={slopeAddParams.per}> <select id="slopeAddPer" bind:value={slopeAddParams.per}>
<option value={2}>Uphill +2</option> <option value={2}>Uphill +2</option>
<option value={1.5}>Uphill +1.5</option> <option value={1.5}>Uphill +1.5</option>
<option value={1}>Uphill +1</option> <option value={1}>Uphill +1</option>
@@ -334,7 +337,7 @@
</div> </div>
<div class="m-2 flex-1 rounded-md border text-center shadow-sm transition-shadow hover:shadow-md"> <div class="m-2 flex-1 rounded-md border text-center shadow-sm transition-shadow hover:shadow-md">
<span class="block text-lg">Spurt Threshold</span> <span class="block text-lg">Spurt Threshold</span>
<span class="block text-2xl">{Math.ceil(needHP)}</span> <span class="block text-2xl">{Math.ceil(needHP)} ({needHPPer.toFixed(1)}%)</span>
</div> </div>
<div class="m-2 flex-1 rounded-md border text-center shadow-sm transition-shadow hover:shadow-md"> <div class="m-2 flex-1 rounded-md border text-center shadow-sm transition-shadow hover:shadow-md">
<span class="block text-lg">Late Race Start</span> <span class="block text-lg">Late Race Start</span>
@@ -343,6 +346,7 @@
{/if} {/if}
</div> </div>
</div> </div>
<!--
<table class="mt-8 w-full border text-center"> <table class="mt-8 w-full border text-center">
<thead> <thead>
<tr> <tr>
@@ -388,3 +392,4 @@
{/each} {/each}
</tbody> </tbody>
</table> </table>
-->