[Medium] [Task] Combat spec gap: implement DoT/debuff runtime system (spec §6, §5.3) #258
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Combat Spec Gap: DoT/Debuff Runtime System
Gap Summary
The debuff/DoT system is fully defined in the spec (effect types, application, tick processing, bypass flags) but has no runtime implementation.
EnemyStatelacksactiveEffectsandeffectiveArmorfields.SpellDefinitionlacksonHitEffect. The combat tick pipeline has no DoT tick processing phase.What Exists
EffectTypeenum values are documented in spec §6.1 (burn, poison, bleed, freeze, slow, curse, armor_corrode, blind)MODIFIER_CONFIGbarrier recharge rate exists inutils/enemy-generator.tsWhat's Missing
1. Type definitions (spec §6.1)
2. Spell on-hit effects (spec §6.2)
SpellDefinitionintypes/spells.tsneeds:Per spec §6.4, at minimum these spell-to-effect mappings must be defined:
burncursearmor_corrodefreeze/slowburnbypassArmor: true3. Effect application on hit (spec §6.2)
In
processCombatTick(stores/combat-actions.ts), after a successful spell hit:4. DoT tick processing (spec §6.3)
After all weapon attacks in
processCombatTick, add:5. bypassArmor support (AC-13)
Effects with
bypassArmor: truemust skip the armor reduction step entirely and apply damage directly toenemy.hp. This requires the enemy defense pipeline (issue #257) to check the flag.Files to Change
types/game.tsactiveEffects,effectiveArmortoEnemyState; addActiveEffect,EffectTypetypestypes/spells.tsonHitEffecttoSpellDefinitionconstants/spells-modules/*.tsonHitEffectto relevant spell definitions (fire, death, lightning, frost, void)stores/combat-actions.tsstores/pipelines/combat-tick.tsbypassArmor/bypassBarrierchecks in damage pipelineAcceptance Criteria
bypassArmoreffects skip the armor reduction step entirelyDependencies
applyEnemyDefenses()to existOut of Scope
Starting implementation of DoT/debuff runtime system (spec §6). This depends on #257 (regular enemy defenses) which is already done —
applyEnemyDefenses()andeffectiveArmorsupport exist incombat-tick.ts.Plan:
ActiveEffect,EffectTypetypes totypes/game.ts; addactiveEffects,effectiveArmortoEnemyStateonHitEffecttoSpellDefinitionintypes/spells.tsdebuffactivity event type totypes/game.tsonHitEffectto key spell definitions (fire→burn, death→curse, lightning→armor_corrode, frost→freeze/slow, soul→bypassArmor burn)stores/combat-actions.tsbypassArmor/bypassBarriersupport instores/pipelines/combat-tick.tsapplyEnemyDefenses()✅ Implementation complete. All 921 tests pass (45 test files).
What was implemented:
ActiveEffect,EffectTypetypes intypes/game.ts;activeEffects,effectiveArmoronEnemyStateSpellOnHitEffectinterface +onHitEffectfield onSpellDefinitionintypes/spells.tsonHitEffectwired to fire (burn), death (curse), lightning (armor_corrode), frost (freeze), soul (burn bypassArmor) spellsapplyOnHitEffect()— applies on-hit effect to first living enemy on successful spell hit (spec §6.2)processDoTPhase()— ticks all active effects on all enemies after weapon/golem attacks (spec §6.3)bypassArmor/bypassBarriersupport inapplyEnemyDefenses()(spec §6.4, AC-13)debuffactivity event typeFiles changed:
types/game.ts— New types + EnemyState fieldstypes/spells.ts— New SpellOnHitEffect + onHitEffect fieldtypes/index.ts— Re-export new typesstores/combat-actions.ts+60 lines — DoT runtime (applyOnHitEffect, processDoTPhase)stores/combat-actions.tsprocessCombatTick — on-hit + DoT phase callsstores/pipelines/combat-tick.ts+35 lines — exported applyEnemyDefenses with bypass flagsstores/combat-state.types.ts— Updated processCombatTick signaturestores/combatStore.ts— Pass-through applyEnemyDefenses paramstores/gameStore.ts— Pass applyEnemyDefenses to processCombatTick✅ Implementation complete and pushed to master.
Summary of changes:
types/game.ts— AddedActiveEffect,EffectTypetypes; addedactiveEffects: ActiveEffect[]andeffectiveArmor: numbertoEnemyStatetypes/spells.ts— AddedSpellOnHitEffectinterface +onHitEffect?: SpellOnHitEffecttoSpellDefinitiontypes/index.ts— Re-exported new typesstores/dot-runtime.ts(new, 135 lines) —applyOnHitEffect()andprocessDoTPhase()functionsstores/combat-actions.ts(372 lines) — Integrated on-hit effect + DoT phase calls inprocessCombatTickstores/pipelines/combat-tick.ts— Exported standaloneapplyEnemyDefenses()withbypassArmor/bypassBarrierparamsstores/combat-state.types.ts— UpdatedprocessCombatTicksignaturestores/combatStore.ts— Pass-through new paramstores/gameStore.ts— PassapplyEnemyDefensesto combat tickonHitEffectmappings per spec §6.4activeEffects: []andeffectiveArmordefaultsenemy-defenses.test.ts— Fixed tests for new required fieldsAll 921 tests pass (45 test files). All files under 400 lines.