Fix Spire Mode floor rendering and swarm floors (Tasks 5 & 6)
- Added enemy naming system with getEnemyName() function - Updated EnemyState type to include name field - Updated generateSwarmEnemies() and generateFloorState() to assign enemy names - Fixed SpireTab.tsx (both versions) to display: - Floor type (Combat/Swarm/Speed/Guardian/Puzzle) with icons - Named enemies based on element and floor tier - Special floor properties (armor %, dodge chance) - Multiple enemies for swarm floors with individual HP bars - Added ROOM_TYPE_LABELS to constants for display - Verified floor type generation logic works correctly - Build succeeds with npm run build
This commit is contained in:
+61
-1
@@ -1269,6 +1269,19 @@ export const useGameStore = create<GameStore>()(
|
||||
const puzzle = PUZZLE_ROOMS[currentRoom.puzzleId || ''];
|
||||
log = [`🧩 ${puzzle?.name || 'Puzzle'} solved! Proceeding to floor ${currentFloor + 1}.`, ...log.slice(0, 49)];
|
||||
|
||||
// Log puzzle solved to activity log
|
||||
activityLog = addActivityLogEntry(state, 'puzzle_solved',
|
||||
`🧩 ${puzzle?.name || 'Puzzle'} solved!`,
|
||||
{ floor: currentFloor }
|
||||
);
|
||||
|
||||
// Log floor transition to activity log
|
||||
const newFloorElem = getFloorElement(currentFloor + 1);
|
||||
activityLog = addActivityLogEntry(state, 'floor_transition',
|
||||
`⬆️ Advanced to floor ${currentFloor + 1} (${newFloorElem})`,
|
||||
{ floor: currentFloor + 1 }
|
||||
);
|
||||
|
||||
currentFloor = currentFloor + 1;
|
||||
if (currentFloor > 100) currentFloor = 100;
|
||||
currentRoom = generateFloorState(currentFloor);
|
||||
@@ -1392,24 +1405,40 @@ export const useGameStore = create<GameStore>()(
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.FIRST_STRIKE) && floorHitCount === 1) {
|
||||
dmg *= 1.15;
|
||||
log = [`⚡ First Strike! +15% damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`⚡ First Strike! +15% damage!`,
|
||||
{ effectName: 'First Strike', floor: currentFloor }
|
||||
);
|
||||
}
|
||||
|
||||
// Combo Master: Every 5th attack deals 3x damage
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.COMBO_MASTER) && comboHitCount % 5 === 0) {
|
||||
dmg *= 3;
|
||||
log = [`🌀 Combo Master! Triple damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`🌀 Combo Master! Triple damage!`,
|
||||
{ effectName: 'Combo Master', floor: currentFloor }
|
||||
);
|
||||
}
|
||||
|
||||
// Executioner: +100% damage to enemies below 25% HP
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.EXECUTIONER) && enemy.hp / enemy.maxHP < 0.25) {
|
||||
dmg *= 2;
|
||||
log = [`💀 Executioner! Double damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`💀 Executioner! Double damage!`,
|
||||
{ effectName: 'Executioner', floor: currentFloor }
|
||||
);
|
||||
}
|
||||
|
||||
// Berserker: +50% damage when below 50% mana
|
||||
if (hasSpecial(effects, SPECIAL_EFFECTS.BERSERKER) && rawMana < maxMana * 0.5) {
|
||||
dmg *= 1.5;
|
||||
log = [`🔥 Berserker! +50% damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`🔥 Berserker! +50% damage!`,
|
||||
{ effectName: 'Berserker', floor: currentFloor }
|
||||
);
|
||||
}
|
||||
|
||||
// EXOTIC_MASTERY: +20% damage with exotic elements
|
||||
@@ -1418,6 +1447,10 @@ export const useGameStore = create<GameStore>()(
|
||||
if (elemDef?.cat === 'exotic') {
|
||||
dmg *= 1.2;
|
||||
log = [`🌟 Exotic Mastery! +20% damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`🌟 Exotic Mastery! +20% damage!`,
|
||||
{ effectName: 'Exotic Mastery', spellName: spellDef.name, floor: currentFloor }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,6 +1459,10 @@ export const useGameStore = create<GameStore>()(
|
||||
if (Math.random() < echoChance) {
|
||||
dmg *= 2;
|
||||
log = [`✨ Spell Echo! Double damage!`, ...log.slice(0, 49)];
|
||||
activityLog = addActivityLogEntry(state, 'special_effect',
|
||||
`✨ Spell Echo! Double damage!`,
|
||||
{ effectName: 'Spell Echo', spellName: spellDef.name, floor: currentFloor }
|
||||
);
|
||||
}
|
||||
|
||||
// Apply damage to enemy
|
||||
@@ -1734,7 +1771,14 @@ export const useGameStore = create<GameStore>()(
|
||||
damage *= (1 - effectiveArmor);
|
||||
|
||||
// Apply damage
|
||||
enemy.hp = Math.max(0, enemy.hp - Math.floor(damage));
|
||||
const golemDmgDealt = Math.floor(damage);
|
||||
enemy.hp = Math.max(0, enemy.hp - golemDmgDealt);
|
||||
|
||||
// Log golem damage to activity log
|
||||
activityLog = addActivityLogEntry(state, 'golem_attack',
|
||||
`🗿 ${golemDef.name || summonedGolem.golemId} dealt ${golemDmgDealt} damage`,
|
||||
{ damage: golemDmgDealt, enemyName: 'enemy', floor: currentFloor, spellName: golemDef.name }
|
||||
);
|
||||
}
|
||||
|
||||
// Update currentRoom with damaged enemies
|
||||
@@ -1754,6 +1798,11 @@ export const useGameStore = create<GameStore>()(
|
||||
if (wasGuardian && !signedPacts.includes(currentFloor)) {
|
||||
signedPacts = [...signedPacts, currentFloor];
|
||||
log = [`⚔️ ${wasGuardian.name} defeated by golems! Pact signed! (${wasGuardian.pact}x)`, ...log.slice(0, 49)];
|
||||
// Log guardian defeated to activity log
|
||||
activityLog = addActivityLogEntry(state, 'enemy_defeated',
|
||||
`⚔️ ${wasGuardian.name} defeated by golems! Pact signed! (${wasGuardian.pact}x)`,
|
||||
{ enemyName: wasGuardian.name, floor: currentFloor }
|
||||
);
|
||||
} else if (!wasGuardian) {
|
||||
const roomTypeName = currentRoom.roomType === 'swarm' ? 'Swarm'
|
||||
: currentRoom.roomType === 'speed' ? 'Speed floor'
|
||||
@@ -1761,6 +1810,11 @@ export const useGameStore = create<GameStore>()(
|
||||
: 'Floor';
|
||||
if (currentFloor % 5 === 0 || currentRoom.roomType !== 'combat') {
|
||||
log = [`🗿 ${roomTypeName} ${currentFloor} cleared by golems!`, ...log.slice(0, 49)];
|
||||
// Log floor cleared to activity log
|
||||
activityLog = addActivityLogEntry(state, 'floor_cleared',
|
||||
`🗿 ${roomTypeName} ${currentFloor} cleared by golems!`,
|
||||
{ floor: currentFloor }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3045,6 +3099,12 @@ export const useGameStore = create<GameStore>()(
|
||||
golemancy: state.golemancy,
|
||||
// Conversion drains tracking
|
||||
conversionDrains: state.conversionDrains,
|
||||
// Spire Mode state
|
||||
clearedFloors: state.clearedFloors,
|
||||
climbDirection: state.climbDirection,
|
||||
isDescending: state.isDescending,
|
||||
// Activity Log (for Spire Mode UI)
|
||||
activityLog: state.activityLog,
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user