const powerEffects = { tank: [ { name: "Enhanced Strength", cost: 3, str: 2, hp: 0, ap: 0, dp: 0 }, { name: "Damage Resistance", cost: 3, str: 0, hp: 5, ap: 0, dp: 2 }, { name: "Powerful Charge", cost: 2, str: 0, hp: 0, ap: 3, dp: 0 }, { name: "Tough Skin", cost: 2, str: 0, hp: 0, ap: 0, dp: 3 }, { name: "Regeneration", cost: 4, str: 0, hp: 3, ap: 0, dp: 1 }, { name: "Indomitable Will", cost: 3, str: 0, hp: 0, ap: 2, dp: 1 }, { name: "Massive Stamina", cost: 2, str: 0, hp: 3, ap: 0, dp: 0 }, { name: "Fortified Body", cost: 3, str: 0, hp: 2, ap: 1, dp: 2 }, { name: "Iron Grip", cost: 2, str: 2, hp: 0, ap: 0, dp: 1 }, { name: "Brute Force", cost: 3, str: 3, hp: 0, ap: 2, dp: 0 }, { name: "Heavy Armor", cost: 4, str: 0, hp: 4, ap: 0, dp: 3 }, { name: "Shield Mastery", cost: 2, str: 0, hp: 0, ap: 1, dp: 2 }, { name: "War Cry", cost: 3, str: 1, hp: 1, ap: 2, dp: 0 }, { name: "Berserker Rage", cost: 4, str: 2, hp: 2, ap: 3, dp: -1 }, { name: "Titan Strength", cost: 5, str: 3, hp: 3, ap: 2, dp: 0 } ], // Similar power objects for other hero types // Example for Alien alien: [ { name: "Alien Physiology", cost: 3, str: 2, hp: 0, ap: 2, dp: 0 }, // More powers... ] }; let availablePoints = 25; let currentValues = { strength: 3, constitution: 3, dexterity: 3, intelligence: 3, wisdom: 3, charisma: 3 }; function updatePowers() { const heroType = document.getElementById('heroType').value; const powersContainer = document.getElementById('powersContainer'); const currentPowers = powerEffects[heroType] || []; powersContainer.innerHTML = ''; currentPowers.forEach(power => { const powerDiv = document.createElement('div'); powerDiv.innerHTML = ``; powersContainer.appendChild(powerDiv); }); } function addPower() { const heroType = document.getElementById('heroType').value; const powers = powerEffects[heroType] || []; if (availablePoints > 0 && powers.length > 0) { const powerSelect = document.createElement('select'); powerSelect.classList.add('powerSelect'); powerSelect.onchange = () => applyPowerEffects(powerSelect); powers.forEach(power => { const option = document.createElement('option'); option.value = power.name; option.text = `${power.name} (Cost: ${power.cost})`; powerSelect.appendChild(option); }); const powerDiv = document.createElement('div'); powerDiv.appendChild(powerSelect); document.getElementById('powersContainer').appendChild(powerDiv); } } function applyPowerEffects(select) { const selectedPowerName = select.value; const heroType = document.getElementById('heroType').value; const selectedPower = powerEffects[heroType].find(p => p.name === selectedPowerName); if (selectedPower && availablePoints >= selectedPower.cost) { availablePoints -= selectedPower.cost; document.getElementById('pointsAvailable').textContent = availablePoints; updateAttribute('strength', selectedPower.str); updateAttribute('constitution', selectedPower.hp / 2); // Example logic updateAttribute('dexterity', selectedPower.dp / 2); // Example logic updateCombatStats(); } } function updateAttribute(attribute, value) { currentValues[attribute] += value; document.getElementById(`${attribute}CurrentValue`).textContent = currentValues[attribute]; } function updateCombatStats() { const classValue = 10; // Example base value const level = 1; // Example level const hp = classValue + currentValues.strength + currentValues.constitution; const ap = classValue + currentValues.strength + level; const dp = classValue + currentValues.strength + currentValues.dexterity; document.getElementById('hp').textContent = hp; document.getElementById('ap').textContent = ap; document.getElementById('dp').textContent = dp; } function addSkill() { if (availablePoints > 0) { const skillInput = document.createElement('input'); skillInput.type = 'text'; skillInput.placeholder = 'Skill Name'; const skillDiv = document.createElement('div'); skillDiv.appendChild(skillInput); document.getElementById('skillsContainer').appendChild(skillDiv); } }