fix: resolve 3 critical bugs — #354 attunement ReferenceError, #353 preparation mana exploit, #352 golem mana wipe
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m1s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m1s
- #354: unlockAttunement now uses _get() instead of undefined 'state' variable - #353: startPreparing now deducts raw mana from the mana store after validation - #352: processGolemAttacks/processBasicAttack accept current mana as params instead of initializing to 0/{} - Updated golem-combat-actions.test.ts to pass new currentRawMana/currentElements params - Added regression tests for all 3 bugs (16 new tests, all passing)
This commit is contained in:
@@ -95,9 +95,9 @@ export interface BasicAttackResult {
|
||||
* AoE frames distribute damage across up to frame.aoeTargets enemies (spec §11).
|
||||
* Single-target frames attack the lowest-HP enemy.
|
||||
*/
|
||||
export function processBasicAttack(ctx: BasicAttackContext): BasicAttackResult {
|
||||
let rawMana = 0;
|
||||
let elements: Record<string, { current: number; max: number; unlocked: boolean }> = {};
|
||||
export function processBasicAttack(ctx: BasicAttackContext, currentRawMana: number, currentElements: Record<string, { current: number; max: number; unlocked: boolean }>): BasicAttackResult {
|
||||
let rawMana = currentRawMana;
|
||||
let elements: Record<string, { current: number; max: number; unlocked: boolean }> = { ...currentElements };
|
||||
let floorHP = 0;
|
||||
let floorMaxHP = 0;
|
||||
let totalDamageDealt = 0;
|
||||
@@ -174,6 +174,8 @@ export function processGolemAttacksFromStore(
|
||||
enemyElement: string,
|
||||
get: () => CombatStore,
|
||||
set: (s: Partial<CombatState>) => void,
|
||||
currentRawMana: number,
|
||||
currentElements: Record<string, { current: number; max: number; unlocked: boolean }>,
|
||||
): GolemCombatResult {
|
||||
return processGolemAttacks(
|
||||
activeGolems,
|
||||
@@ -212,5 +214,7 @@ export function processGolemAttacksFromStore(
|
||||
});
|
||||
set({ currentRoom: { ...room, enemies: updatedEnemies } });
|
||||
},
|
||||
currentRawMana,
|
||||
currentElements,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user