feat: Implement combat special effects
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m26s

- 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
This commit is contained in:
2026-03-26 13:33:14 +00:00
parent 751b317af2
commit fec3a2b88f

View File

@@ -357,6 +357,9 @@ export const useGameStore = create<GameStore>()(
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<GameStore>()(
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<GameStore>()(
}
}
// 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)
@@ -756,6 +783,9 @@ export const useGameStore = create<GameStore>()(
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<GameStore>()(
totalDamageDealt,
totalSpellsCast,
familiars,
consecutiveHits: state.currentAction === 'climb' ? state.consecutiveHits + hitsThisTick : state.consecutiveHits,
...craftingUpdates,
});
},