Release Healer Man 0.1.38

This commit is contained in:
phenom committed 2026-09-12 23:55:24 -04:00
1 parent 361734bc41
commit b417b7c3c3
48 files changed
+1982 -90

No files matched your search

+24 -6
View File
@@ -1,23 +1,41 @@
import { useCombatStore } from "./combatStore";
import { useCombatStore, type MobCombatState } from "./combatStore";
import type { CombatActorState } from "./combatActors";
import { requireDungeonDefinition } from "./dungeonRegistry";
import { useGameStore } from "./store";
import { resolveResurrectionCheckpoint } from "./resurrectionCheckpoints";
import { usePartyStore, type PartyMember } from "./partyStore";
import {
activeDungeonCompletedObjectiveIds,
resetDungeonEncounters,
} from "./dungeonEncounterRuntime";
/**
* Atomically returns a defeated player to the saved run spawn and resets the
* current pull. Defeated enemies and persisted dungeon progress remain clear,
* matching a wipe instead of silently starting a brand-new dungeon.
*/
export function partyFightStillActive(
members: readonly Pick<PartyMember, "id" | "health">[],
mobs: Readonly<Record<string, MobCombatState>>,
actors: Readonly<Record<string, Pick<CombatActorState, "health">>> = {},
): boolean {
return members.some((member) => (actors[member.id]?.health ?? member.health) > 0)
&& Object.values(mobs).some((mob) => mob.engaged && !mob.dead && !mob.despawned);
}
/** Recover only the player during an ongoing party fight; otherwise retain wipe recovery. */
export function respawnDefeatedPlayer(checkpointId?: string): boolean {
const combat = useCombatStore.getState();
if (combat.health > 0) return false;
const game = useGameStore.getState();
if (game.gameMode !== "dungeon") return false;
const checkpoint = checkpointId === undefined ? null : resolveResurrectionCheckpoint(checkpointId);
if (checkpointId !== undefined && !checkpoint) return false;
if (partyFightStillActive(usePartyStore.getState().members, combat.mobs, combat.actors)) {
const spawn = checkpoint?.spawn ?? game.activeSpawn;
if (!combat.respawnPlayerOnly(spawn.footPosition)) return false;
// Relocation does not fire the resetRevision watched by PartyBridge/PartyPopulation.
useGameStore.getState().relocatePlayer(spawn, true);
useGameStore.getState().closeOverlay();
return true;
}
const dungeonId = useGameStore.getState().activeDungeonId;
const completedObjectiveIds = new Set(activeDungeonCompletedObjectiveIds(dungeonId));
const retrySpawnIds = new Set(