feat: implement sword/melee auto-attack system (spec §3.1, §4.3)
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
- Add calcMeleeDamage() with elemental matchup for enchanted swords - Add meleeSwordProgress per-instance accumulator to combat state - Add melee branch in processCombatTick (no mana cost, no Executioner/Berserker) - Add baseDamage/attackSpeed stats to all 5 sword types - Wire equippedSwords through gameStore to combat tick pipeline - 16 new regression tests, all 937 tests pass
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import { createSafeStorage } from '../utils/safe-persist';
|
||||
import type { GameAction, SpellState, FloorState, GolemancyState, ActivityLogEntry, AchievementState, EquipmentSpellState, ActivityEventType, ActiveGolem, EnemyState } from '../types';
|
||||
import type { GameAction, SpellState, FloorState, GolemancyState, ActivityLogEntry, AchievementState, EquipmentSpellState, ActivityEventType, ActiveGolem, EnemyState, EquipmentInstance } from '../types';
|
||||
import { getFloorMaxHP } from '../utils';
|
||||
import { generateFloorState } from '../utils/room-utils';
|
||||
import { addActivityLogEntry } from '../utils/activity-log';
|
||||
@@ -66,6 +66,9 @@ export const useCombatStore = create<CombatStore>()(
|
||||
comboHitCount: 0,
|
||||
floorHitCount: 0,
|
||||
|
||||
// Melee sword progress accumulators (spec §3.1)
|
||||
meleeSwordProgress: {},
|
||||
|
||||
// Guardian defensive state
|
||||
guardianShield: 0,
|
||||
guardianShieldMax: 0,
|
||||
@@ -310,6 +313,7 @@ export const useCombatStore = create<CombatStore>()(
|
||||
bypassArmor?: boolean,
|
||||
bypassBarrier?: boolean,
|
||||
) => number,
|
||||
equippedSwords?: Record<string, EquipmentInstance>,
|
||||
) => {
|
||||
return processCombatTick(
|
||||
get,
|
||||
@@ -324,6 +328,7 @@ export const useCombatStore = create<CombatStore>()(
|
||||
golemancyState,
|
||||
golemApplyDamageToRoom,
|
||||
applyEnemyDefenses,
|
||||
equippedSwords,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -372,6 +377,7 @@ export const useCombatStore = create<CombatStore>()(
|
||||
guardianShieldMax: state.guardianShieldMax,
|
||||
guardianBarrier: state.guardianBarrier,
|
||||
guardianBarrierMax: state.guardianBarrierMax,
|
||||
meleeSwordProgress: state.meleeSwordProgress,
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user