How to Navigate the Spire
- Click a node to climb the way
- Choose your battles night or day
- Rest at fires, heal or train
- Each new card will grow your gain.
- At the summit face the fight
- Defeat the boss, win the night
Courage, dear heart.
// Simple audio utility function playSound(soundFile) { try { const audio = new Audio(`assets/sounds/${soundFile}`); audio.volume = 0.3; audio.play().catch(e => { console.log(e) }); // Silently fail if no audio } catch (e) { // Silently fail if audio not available } } async function showMessagesModal() { const { getAllMessages } = await import("../data/messages.js"); const messages = getAllMessages(); const modal = document.createElement('div'); modal.className = 'messages-modal-overlay'; modal.innerHTML = `
`; // Close functionality const closeModal = () => { modal.remove(); }; const closeBtn = modal.querySelector('.messages-close-btn'); closeBtn.addEventListener('click', closeModal); // Close on overlay click modal.addEventListener('click', (e) => { if (e.target === modal) closeModal(); }); // Close on Escape key const handleEscape = (e) => { if (e.key === 'Escape') { closeModal(); document.removeEventListener('keydown', handleEscape); } }; document.addEventListener('keydown', handleEscape); // Add to DOM document.body.appendChild(modal); } export function showDamageNumber(damage, target, isPlayer = false) { const targetElement = isPlayer ? document.querySelector('.player-battle-zone') : document.querySelector('.enemy-battle-zone'); if (!targetElement) return; const damageNumber = document.createElement('div'); damageNumber.className = 'damage-number'; damageNumber.textContent = damage; const rect = targetElement.getBoundingClientRect(); damageNumber.style.left = `${rect.left + rect.width / 2}px`; damageNumber.style.top = `${rect.top + rect.height / 2}px`; document.body.appendChild(damageNumber); requestAnimationFrame(() => { damageNumber.classList.add('damage-number-animate'); }); setTimeout(() => { if (damageNumber.parentNode) { damageNumber.parentNode.removeChild(damageNumber); } }, 1000); } export async function renderBattle(root) { const app = root.app; const p = root.player, e = root.enemy; const { ENEMIES } = await import("../data/enemies.js"); const { CARDS } = await import("../data/cards.js"); const { RELICS } = await import("../data/relics.js"); const enemyData = ENEMIES[e.id]; const backgroundImage = enemyData?.background || null; const intentInfo = { attack: { emoji: '', text: `Will attack for ${e.intent.value} damage`, color: 'danger' }, block: { emoji: '', text: `Will gain ${e.intent.value} block`, color: 'info' }, debuff: { emoji: '', text: 'Will apply a debuff', color: 'warning' }, heal: { emoji: '', text: `Will heal for ${e.intent.value} HP`, color: 'success' } }[e.intent.type] || { emoji: '', text: 'Unknown intent', color: 'neutral' }; app.innerHTML = `



Courage, dear heart.
Take a moment to restore your strength
Select a card from your deck to permanently improve it
Spend your hard-earned gold on powerful upgrades
${root.player.gold || 100}
50 gold each
50
100 gold
${shopRelic.text}
100
Select one of the following relics to begin your run.
A birthday adventure awaits your decision
${event.text}
ThePrimeagen's birthday celebration can continue in peace!
It seems age has slowed the CPU upstairs… Better luck on the next run!