feat: guardian floors use guardian elements instead of fixed cycle
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s

This commit is contained in:
2026-05-30 10:40:48 +02:00
parent 644bb8402c
commit b8e6d651b2
6 changed files with 88 additions and 36 deletions
+24
View File
@@ -15,9 +15,33 @@ export function getFloorMaxHP(floor: number): number {
return Math.floor(baseHP + floorScaling + exponentialScaling);
}
/**
* Get the primary element for a floor.
* Guardian floors use the guardian's first element.
* Non-guardian floors cycle through the base element list.
*/
export function getFloorElement(floor: number): string {
const guardian = getGuardianForFloor(floor);
if (guardian && guardian.element.length > 0) {
return guardian.element[0];
}
const len = FLOOR_ELEM_CYCLE.length;
const idx = ((floor - 1) % len + len) % len;
return FLOOR_ELEM_CYCLE[idx];
}
/**
* Get all elements for a floor.
* Guardian floors return all guardian elements (multi-element guardians).
* Non-guardian floors return a single-element array with the cycle element.
*/
export function getFloorElements(floor: number): string[] {
const guardian = getGuardianForFloor(floor);
if (guardian && guardian.element.length > 0) {
return [...guardian.element];
}
const len = FLOOR_ELEM_CYCLE.length;
const idx = ((floor - 1) % len + len) % len;
return [FLOOR_ELEM_CYCLE[idx]];
}
+1 -1
View File
@@ -5,7 +5,7 @@ export { fmt, fmtDec, formatSpellCost, getSpellCostColor, formatStudyTime, forma
export { createSafeStorage } from './safe-persist';
export { ok, okVoid, fail, failTyped, unwrapOr, isErrorCode, ErrorCode } from './result';
export type { Result, ErrorCodeType } from './result';
export { getFloorMaxHP, getFloorElement } from './floor-utils';
export { getFloorMaxHP, getFloorElement, getFloorElements } from './floor-utils';
export {
computeMaxMana,
computeRegen,