Browse Source

Fix combat UI to show database skills with class names

Combat skill buttons now:
- Check both hardcoded SKILLS and database SKILLS_DB
- Display class-specific skill names (e.g., "Brand New Hokas")
- Use fallback icon for database-only skills

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
master
HikeMap User 1 month ago
parent
commit
30ced96eb6
  1. 16
      index.html

16
index.html

@ -11024,15 +11024,23 @@
// Use unlockedSkills if available, otherwise fall back to basic_attack only // Use unlockedSkills if available, otherwise fall back to basic_attack only
const unlockedSkills = playerStats.unlockedSkills || ['basic_attack']; const unlockedSkills = playerStats.unlockedSkills || ['basic_attack'];
unlockedSkills.forEach(skillId => { unlockedSkills.forEach(skillId => {
const skill = SKILLS[skillId];
if (!skill) return; // Skip if skill doesn't exist
// Check both hardcoded SKILLS and database SKILLS_DB
const hardcodedSkill = SKILLS[skillId];
const dbSkill = SKILLS_DB[skillId];
const skillInfo = getSkillForClass(skillId, playerStats.class);
if (!hardcodedSkill && !dbSkill) return; // Skip if skill doesn't exist
const displayName = skillInfo?.displayName || hardcodedSkill?.name || dbSkill?.name || skillId;
const icon = hardcodedSkill?.icon || '⚔️';
const mpCost = hardcodedSkill?.mpCost || dbSkill?.mpCost || 0;
const btn = document.createElement('button'); const btn = document.createElement('button');
btn.className = 'skill-btn'; btn.className = 'skill-btn';
btn.dataset.skillId = skillId; btn.dataset.skillId = skillId;
btn.innerHTML = ` btn.innerHTML = `
<span class="skill-name">${skill.icon} ${skill.name}</span>
<span class="skill-cost ${skill.mpCost === 0 ? 'free' : ''}">${skill.mpCost > 0 ? skill.mpCost + ' MP' : 'Free'}</span>
<span class="skill-name">${icon} ${displayName}</span>
<span class="skill-cost ${mpCost === 0 ? 'free' : ''}">${mpCost > 0 ? mpCost + ' MP' : 'Free'}</span>
`; `;
btn.onclick = () => executePlayerSkill(skillId); btn.onclick = () => executePlayerSkill(skillId);
skillsContainer.appendChild(btn); skillsContainer.appendChild(btn);

Loading…
Cancel
Save