From fec3a2b88f842bb005667b0db50b5101d470cc74 Mon Sep 17 00:00:00 2001 From: zhipu Date: Thu, 26 Mar 2026 13:33:14 +0000 Subject: [PATCH] feat: Implement combat special effects - BATTLE_FURY: +10% damage per consecutive hit (resets on floor change) - COMBO_MASTER: Every 5th attack deals 3x damage - ADRENALINE_RUSH: Restore 5% mana on floor clear - Add hitsThisTick tracking for proper consecutive hit counting - Reset consecutiveHits when floor changes --- src/lib/game/store.ts | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/lib/game/store.ts b/src/lib/game/store.ts index f50473c..1a741b0 100755 --- a/src/lib/game/store.ts +++ b/src/lib/game/store.ts @@ -357,6 +357,9 @@ export const useGameStore = create()( const state = get(); if (state.gameOver || state.paused) return; + // Track hits this tick for BATTLE_FURY + let hitsThisTick = 0; + // Compute unified effects (includes skill upgrades AND equipment enchantments) const effects = getUnifiedEffects(state); @@ -649,6 +652,23 @@ export const useGameStore = create()( dmg *= 1.5; } + // BATTLE_FURY: +10% damage per consecutive hit (resets on floor change) + const currentConsecutiveHits = state.consecutiveHits + hitsThisTick; + if (hasSpecial(effects, SPECIAL_EFFECTS.BATTLE_FURY)) { + dmg *= 1 + (currentConsecutiveHits * 0.1); + } + + // COMBO_MASTER: Every 5th attack deals 3x damage + const totalHitsThisLoop = state.totalTicks || 0; + const isFifthHit = ((totalHitsThisLoop + hitsThisTick) % 5) === 4; // 5th, 10th, 15th, etc. + if (hasSpecial(effects, SPECIAL_EFFECTS.COMBO_MASTER) && isFifthHit) { + dmg *= 3; + log = [`💥 Combo Master! Triple damage!`, ...log.slice(0, 49)]; + } + + // Track hits for BATTLE_FURY + hitsThisTick++; + // Familiar bonuses dmg *= familiarBonuses.damageMultiplier; dmg *= familiarBonuses.elementalDamageMultiplier; @@ -732,6 +752,13 @@ export const useGameStore = create()( } } + // ADRENALINE_RUSH: Restore 5% mana on floor clear + if (hasSpecial(effects, SPECIAL_EFFECTS.ADRENALINE_RUSH)) { + const adrenalineHeal = maxMana * 0.05; + rawMana = Math.min(rawMana + adrenalineHeal, maxMana); + log = [`⚡ Adrenaline Rush! Restored ${Math.floor(adrenalineHeal)} mana!`, ...log.slice(0, 49)]; + } + // Move to next floor based on direction const nextFloor = climbDirection === 'up' ? Math.min(currentFloor + 1, 100) @@ -755,7 +782,10 @@ export const useGameStore = create()( newCombo.count = Math.floor(newCombo.count * 0.5); newCombo.multiplier = 1 + newCombo.count * 0.02; newCombo.elementChain = []; - + + // Reset consecutive hits on floor change + set((s) => ({ ...s, consecutiveHits: 0 })); + // Reset ALL spell progress on floor change equipmentSpellStates = equipmentSpellStates.map(s => ({ ...s, castProgress: 0 })); spellState = { ...spellState, castProgress: 0 }; @@ -891,6 +921,7 @@ export const useGameStore = create()( totalDamageDealt, totalSpellsCast, familiars, + consecutiveHits: state.currentAction === 'climb' ? state.consecutiveHits + hitsThisTick : state.consecutiveHits, ...craftingUpdates, }); },