feat: Implement combat special effects
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m26s
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:
@@ -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)
|
||||
@@ -755,7 +782,10 @@ export const useGameStore = create<GameStore>()(
|
||||
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<GameStore>()(
|
||||
totalDamageDealt,
|
||||
totalSpellsCast,
|
||||
familiars,
|
||||
consecutiveHits: state.currentAction === 'climb' ? state.consecutiveHits + hitsThisTick : state.consecutiveHits,
|
||||
...craftingUpdates,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user