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

- 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:
2026-06-03 21:59:30 +02:00
parent b506f0bcc3
commit 8dde423526
10 changed files with 564 additions and 183 deletions
+5
View File
@@ -12,6 +12,7 @@ export const SWORD_EQUIPMENT: Record<string, EquipmentType> = {
slot: 'mainHand',
baseCapacity: 30,
description: 'A simple iron sword. Can be enchanted with elemental effects.',
stats: { baseDamage: 8, attackSpeed: 1.2 },
},
steelBlade: {
id: 'steelBlade',
@@ -20,6 +21,7 @@ export const SWORD_EQUIPMENT: Record<string, EquipmentType> = {
slot: 'mainHand',
baseCapacity: 40,
description: 'A well-crafted steel sword. Balanced for combat and enchanting.',
stats: { baseDamage: 12, attackSpeed: 1.3 },
},
crystalBlade: {
id: 'crystalBlade',
@@ -28,6 +30,7 @@ export const SWORD_EQUIPMENT: Record<string, EquipmentType> = {
slot: 'mainHand',
baseCapacity: 55,
description: 'A blade made of crystallized mana. Excellent for elemental enchantments.',
stats: { baseDamage: 18, attackSpeed: 1.1 },
},
arcanistBlade: {
id: 'arcanistBlade',
@@ -36,6 +39,7 @@ export const SWORD_EQUIPMENT: Record<string, EquipmentType> = {
slot: 'mainHand',
baseCapacity: 65,
description: 'A sword forged for battle mages. High capacity for powerful enchantments.',
stats: { baseDamage: 22, attackSpeed: 1.4 },
},
voidBlade: {
id: 'voidBlade',
@@ -44,5 +48,6 @@ export const SWORD_EQUIPMENT: Record<string, EquipmentType> = {
slot: 'mainHand',
baseCapacity: 50,
description: 'A blade corrupted by void energy. Powerful but consumes more mana.',
stats: { baseDamage: 25, attackSpeed: 1.0 },
},
};
+4
View File
@@ -27,4 +27,8 @@ export interface EquipmentType {
baseCapacity: number;
description: string;
twoHanded?: boolean; // If true, weapon occupies both main hand and offhand slots
stats?: {
baseDamage?: number; // Base damage per hit (swords)
attackSpeed?: number; // Attacks per in-game hour (swords)
};
}