feat: v1 prototype — core game systems #30

Merged
naomi merged 84 commits from feat/prototype into main 2026-03-08 15:53:39 -07:00
4 changed files with 44 additions and 0 deletions
Showing only changes of commit 25d4a11eeb - Show all commits
@@ -60,6 +60,9 @@ const QuestCard = ({ quest, partyCombatPower, unlockHint, zoneHint }: QuestCardP
{!zoneHint && unlockHint && <p className="unlock-hint">📜 Complete: {unlockHint}</p>}
</>
)}
{quest.status === "available" && quest.lastFailedAt != null && (
<p className="quest-failed-hint"> Last attempt failed</p>
)}
{quest.status === "available" && (
<button
className="start-quest-button"
+31
View File
@@ -46,6 +46,32 @@ const checkAchievements = (state: GameState): Achievement[] => {
/** Maximum value any resource can accumulate to. Beyond this JS floats lose all useful precision. */
export const RESOURCE_CAP = 1e300;
/**
* Probability of quest failure per zone — scales from 10% (early game) to 40% (end game).
* On failure the quest resets to "available" with no rewards; the player must wait the
* full duration again on their next attempt.
*/
const ZONE_FAILURE_CHANCE: Record<string, number> = {
verdant_vale: 0.10,
shattered_ruins: 0.12,
frozen_peaks: 0.14,
shadow_marshes: 0.16,
volcanic_depths: 0.18,
astral_void: 0.20,
celestial_reaches: 0.22,
abyssal_trench: 0.24,
infernal_court: 0.26,
crystalline_spire: 0.28,
void_sanctum: 0.30,
eternal_throne: 0.32,
primordial_chaos: 0.34,
infinite_expanse: 0.36,
reality_forge: 0.38,
cosmic_maelstrom: 0.40,
primeval_sanctum: 0.40,
the_absolute: 0.40,
};
const capResource = (value: number): number => Math.min(value, RESOURCE_CAP);
/**
@@ -128,6 +154,11 @@ export const applyTick = (state: GameState, deltaSeconds: number): GameState =>
return quest;
}
const failureChance = ZONE_FAILURE_CHANCE[quest.zoneId] ?? 0.20;
if (Math.random() < failureChance) {
return { ...quest, status: "available" as const, startedAt: undefined, lastFailedAt: now };
}
for (const reward of quest.rewards) {
if (reward.type === "gold" && reward.amount != null) {
questGold += reward.amount;
+8
View File
@@ -1156,6 +1156,14 @@ body {
margin-top: 0.2rem;
}
.quest-failed-hint {
color: #e6a817;
font-size: 0.75rem;
font-style: italic;
margin-bottom: 0.25rem;
margin-top: 0;
}
.unlock-hint {
color: var(--colour-text-muted);
font-size: 0.75rem;
+2
View File
@@ -25,4 +25,6 @@ export interface Quest {
zoneId: string;
/** Minimum party combat power required to start this quest */
combatPowerRequired?: number;
/** Unix timestamp of the most recent failed attempt (if any) */
lastFailedAt?: number;
}