function calculatePotionValue() {
var ingredient1Value = parseFloat(document.getElementById("ingredient1Value").value);
var ingredient2Value = parseFloat(document.getElementById("ingredient2Value").value);
var ingredient3Value = parseFloat(document.getElementById("ingredient3Value").value);
var playerLevel = parseFloat(document.getElementById("playerLevel").value);
var perksInvested = parseFloat(document.getElementById("perksInvested").value);
var resultElement = document.getElementById("potionResult");
var explanationElement = document.getElementById("explanation");
if (isNaN(ingredient1Value) || isNaN(ingredient2Value) || isNaN(ingredient3Value) || isNaN(playerLevel) || isNaN(perksInvested)) {
resultElement.innerHTML = "Please enter valid numbers for all fields.";
explanationElement.innerHTML = "";
return;
}
// Basic ingredient value summation (simplistic)
var baseValue = ingredient1Value + ingredient2Value + ingredient3Value;
// Alchemy skill multiplier (rough estimate, Skyrim's formula is complex)
var skillMultiplier = 1 + (playerLevel * 0.1);
// Perk multiplier (each perk might add a percentage, simplifying here)
// Let's assume each perk adds 5% to the potion value
var perkMultiplier = 1 + (perksInvested * 0.05);
// Combine multipliers and base value
var finalPotionValue = baseValue * skillMultiplier * perkMultiplier;
// Ensure a minimum value to avoid extremely low results
if (finalPotionValue < 1) {
finalPotionValue = 1;
}
resultElement.innerHTML = "Estimated Potion Value: " + finalPotionValue.toFixed(2);
explanationElement.innerHTML = "
How it works:
" +
"The value of a potion in Skyrim is determined by the combined values of its ingredients, your Alchemy skill, and the Alchemy perks you have invested in." +
"
Ingredient Values: Each ingredient has an inherent value. When you combine three ingredients, their base values are summed up. For this calculation, we've used the provided 'Per Unit' values for Ingredient 1, Ingredient 2, and Ingredient 3." +
"
Alchemy Skill: A higher Alchemy skill significantly increases the value of your potions. Our simplified formula adds 10% of your level to the base value. For example, a level 15 Alchemist gets a 1.5x multiplier from their skill alone (1 + 15 * 0.1 = 2.5, but this is a simplification, actual multiplier is more complex)." +
"
Alchemy Perks: Certain perks in the Alchemy skill tree further enhance potion potency and value. We've estimated that each perk you've invested adds an additional 5% to the potion's value. For instance, with 2 perks, you get a 10% boost (1 + 2 * 0.05 = 1.1)." +
"
Final Calculation: The final potion value is roughly the sum of ingredient values multiplied by the skill multiplier and the perk multiplier. " +
"
Note: This is a simplified model. The actual potion value in Skyrim can be influenced by other factors such as enchanted gear that boosts Alchemy, the specific effects of the ingredients, and their rarity.";
}
.calculator-container {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 600px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-inputs, .calculator-results {
margin-bottom: 20px;
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.input-group input[type="number"] {
width: calc(100% – 10px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
#potionResult {
font-size: 1.2em;
font-weight: bold;
color: #333;
margin-top: 10px;
}
#explanation {
margin-top: 15px;
border-top: 1px dashed #eee;
padding-top: 15px;
font-size: 0.9em;
line-height: 1.5;
}