Release v0.1.5 2026-07-12
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { SaveRepository, type StorageAdapter } from "./saveRepository";
|
||||
import { groupDrop } from "../game/progression/loot";
|
||||
import { RUN_BUFF_ORDER } from "../game/roguelike";
|
||||
|
||||
function memoryStorage(): StorageAdapter {
|
||||
const data = new Map<string, string>();
|
||||
@@ -169,16 +170,29 @@ describe("SaveRepository", () => {
|
||||
const repository = new SaveRepository(storage, () => "2026-07-10T12:00:00.000Z");
|
||||
const created = repository.create(1, "Infused");
|
||||
created.gearProgress.priest.infusionAbilityId = "priest-sanctuary";
|
||||
created.gearProgress.priest.passiveInfusionId = "restoring-grace";
|
||||
created.gearProgress.priest.passiveInfusionId = "restoring-grace" as never;
|
||||
created.gearProgress.druid.passiveInfusionId = "mend-echo";
|
||||
created.gearProgress.brann.infusionAbilityId = "removed-infusion";
|
||||
created.gearProgress.brann.passiveInfusionId = "deep-wells";
|
||||
created.gearProgress.brann.passiveInfusionId = "deep-wells" as never;
|
||||
storage.setItem("i-want-to-heal:saves:local:v1", JSON.stringify({ 1: created }));
|
||||
|
||||
const migrated = repository.list(null)[0].local!;
|
||||
expect(migrated.schemaVersion).toBe(5);
|
||||
expect(migrated.gearProgress.priest.infusionAbilityId).toBe("priest-sanctuary");
|
||||
expect(migrated.gearProgress.priest.passiveInfusionId).toBe("restoring-grace");
|
||||
expect(migrated.gearProgress.priest.passiveInfusionId).toBeNull();
|
||||
expect(migrated.gearProgress.druid.passiveInfusionId).toBe("mend-echo");
|
||||
expect(migrated.gearProgress.brann.infusionAbilityId).toBeNull();
|
||||
expect(migrated.gearProgress.brann.passiveInfusionId).toBeNull();
|
||||
});
|
||||
|
||||
it("persists every new roguelike buff as a healer passive infusion", () => {
|
||||
for (const passiveId of RUN_BUFF_ORDER) {
|
||||
const storage = memoryStorage();
|
||||
const repository = new SaveRepository(storage, () => "2026-07-10T12:00:00.000Z");
|
||||
const created = repository.create(1, "Infused");
|
||||
created.gearProgress.priest.passiveInfusionId = passiveId;
|
||||
storage.setItem("i-want-to-heal:saves:local:v1", JSON.stringify({ 1: created }));
|
||||
expect(repository.list(null)[0].local?.gearProgress.priest.passiveInfusionId).toBe(passiveId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+21
-2
@@ -3,14 +3,14 @@ import { DEFAULT_SETTINGS, normalizeHunterName } from "./data";
|
||||
import { SaveRepository } from "./saveRepository";
|
||||
import { AccountRepository, type AccountResult } from "./accountRepository";
|
||||
import type { AppScreen, GameModeId, GameSettings, HunterSave, SaveSlotId, SaveSlotState } from "./types";
|
||||
import type { BossId, HealerClassId, InventoryItem } from "../game/types";
|
||||
import type { AbilityId, BossId, HealerClassId, InventoryItem, RunBuffId } from "../game/types";
|
||||
import { RUN_BUFF_ORDER, RUN_BUFFS } from "../game/roguelike";
|
||||
import { upgradeGearSlot, type GearOwnerId, type GearSlotId } from "../game/progression/gear";
|
||||
import {
|
||||
equipActiveInfusion,
|
||||
equipPassiveInfusion,
|
||||
infusionsForOwner,
|
||||
} from "../game/progression/infusions";
|
||||
import type { RunBuffId } from "../game/types";
|
||||
import { normalizeDifficultySlug, rollBossReward, type BossRewardAward, type DifficultySlug } from "../game/progression/loot";
|
||||
|
||||
const repository = new SaveRepository();
|
||||
@@ -59,6 +59,8 @@ export interface FrontendState {
|
||||
selectedGearSlotId: GearSlotId;
|
||||
gearWorkshopMode: "upgrade" | "infusion";
|
||||
selectedInfusionId: string;
|
||||
selectedPassiveAbilityId: AbilityId;
|
||||
selectedPassiveInfusionId: RunBuffId;
|
||||
recentRewards: BossRewardAward[];
|
||||
settings: GameSettings;
|
||||
notice: string;
|
||||
@@ -81,6 +83,8 @@ export interface FrontendState {
|
||||
selectGearSlot: (slotId: GearSlotId) => void;
|
||||
selectGearWorkshopMode: (mode: "upgrade" | "infusion") => void;
|
||||
selectInfusion: (infusionId: string) => void;
|
||||
selectPassiveAbility: (abilityId: AbilityId) => void;
|
||||
selectPassiveInfusion: (passiveId: RunBuffId) => void;
|
||||
upgradeSelectedGear: () => boolean;
|
||||
equipSelectedInfusion: () => boolean;
|
||||
equipPassiveInfusion: (passiveId: RunBuffId) => boolean;
|
||||
@@ -110,6 +114,8 @@ export const useFrontendStore = create<FrontendState>((set, get) => ({
|
||||
selectedGearSlotId: "weapon",
|
||||
gearWorkshopMode: "upgrade",
|
||||
selectedInfusionId: infusionsForOwner("priest")[0].id,
|
||||
selectedPassiveAbilityId: "mend",
|
||||
selectedPassiveInfusionId: "mend-echo",
|
||||
recentRewards: [],
|
||||
settings: loadSettings(),
|
||||
notice: "",
|
||||
@@ -187,6 +193,15 @@ export const useFrontendStore = create<FrontendState>((set, get) => ({
|
||||
selectGearSlot: (selectedGearSlotId) => set({ selectedGearSlotId, notice: "" }),
|
||||
selectGearWorkshopMode: (gearWorkshopMode) => set({ gearWorkshopMode, notice: "" }),
|
||||
selectInfusion: (selectedInfusionId) => set({ selectedInfusionId, notice: "" }),
|
||||
selectPassiveAbility: (selectedPassiveAbilityId) => {
|
||||
const selectedPassiveInfusionId = RUN_BUFF_ORDER.find((id) => RUN_BUFFS[id].abilityId === selectedPassiveAbilityId) ?? "mend-echo";
|
||||
set({ selectedPassiveAbilityId, selectedPassiveInfusionId, notice: "" });
|
||||
},
|
||||
selectPassiveInfusion: (selectedPassiveInfusionId) => set({
|
||||
selectedPassiveAbilityId: RUN_BUFFS[selectedPassiveInfusionId].abilityId,
|
||||
selectedPassiveInfusionId,
|
||||
notice: "",
|
||||
}),
|
||||
upgradeSelectedGear: () => {
|
||||
const { activeSlotId, accountId, selectedGearOwnerId, selectedGearSlotId } = get();
|
||||
if (!activeSlotId) return false;
|
||||
@@ -326,6 +341,8 @@ export type FrontendSnapshot = Omit<FrontendState,
|
||||
| "selectGearSlot"
|
||||
| "selectGearWorkshopMode"
|
||||
| "selectInfusion"
|
||||
| "selectPassiveAbility"
|
||||
| "selectPassiveInfusion"
|
||||
| "upgradeSelectedGear"
|
||||
| "equipSelectedInfusion"
|
||||
| "equipPassiveInfusion"
|
||||
@@ -359,6 +376,8 @@ export function getFrontendSnapshot(): FrontendSnapshot {
|
||||
selectGearSlot: _selectGearSlot,
|
||||
selectGearWorkshopMode: _selectGearWorkshopMode,
|
||||
selectInfusion: _selectInfusion,
|
||||
selectPassiveAbility: _selectPassiveAbility,
|
||||
selectPassiveInfusion: _selectPassiveInfusion,
|
||||
upgradeSelectedGear: _upgradeSelectedGear,
|
||||
equipSelectedInfusion: _equipSelectedInfusion,
|
||||
equipPassiveInfusion: _equipPassiveInfusion,
|
||||
|
||||
Reference in New Issue
Block a user