Szablon:Test1: Różnice pomiędzy wersjami

Z Altaron Wiki
(Anulowanie wersji 132026 autorstwa Siwyus (dyskusja))
Znacznik: Anulowanie edycji
Nie podano opisu zmian
 
(Nie pokazano 2 pośrednich wersji utworzonych przez tego samego użytkownika)
Linia 1: Linia 1:
<altaronpanel title="[[Plik:Zwój_Przemiany.gif]] Kalkulator wpływu alchemii na mikstury (leczenie/mana)" style="2" titleCSS="text-align: center;>
<altaronpanel title="[[Plik:Zwój_Przemiany.gif]] Kalkulator wpływu alchemii na wytwarzane mikstury" style="2" titleCSS="text-align: center;>


<html>
<html>
   <body>
   <body>
      <div class="form-group">
        <label for="potions">Wybierz wytworzoną miksturę:</label>
        <select class="form-control" id="potions">
        </select>
      </div>
       <div class="form-group">
       <div class="form-group">
         <label for="playerAlchemy">Wybierz poziom swojej alchemii:</label>
         <label for="playerAlchemy">Wybierz poziom swojej alchemii:</label>
Linia 18: Linia 23:
       </div>
       </div>
       <div class="form-group d-flex justify-content-center">
       <div class="form-group d-flex justify-content-center">
         <button onclick="calculateImpact()" class="btn btn-primary">Oblicz</button>
         <button id="submitBtn" onclick="calculateImpact()" class="btn btn-primary" disabled>Oblicz</button>
       </div>
       </div>
       <p id="alchemyImpact" class="font-weight-bold text-center">
       <p id="alchemyImpact" class="font-weight-bold text-center"></p>
       </p>
       <p id="potionValues" class="font-weight-bold text-center"></p>
     </div>
     </div>
   </body>
   </body>
Linia 30: Linia 35:
const potionCreatorAlchemySelect = document.querySelector('#potionCreatorAlchemy');
const potionCreatorAlchemySelect = document.querySelector('#potionCreatorAlchemy');
     const isAlchemicCheckbox = document.querySelector('#isAlchemic');
     const isAlchemicCheckbox = document.querySelector('#isAlchemic');
    const potionsSelect = document.querySelector('#potions');
    const submitButton = document.querySelector('#submitBtn')
    const potionsArray = [
    {name: 'Mikstura many', center: 100, dispersion: 0.3, type: 'mana'},
    {name: 'Mikstura mocy', center: 150, dispersion: 0.2, type: 'mana'},
    {name: 'Mikstura maga', center: 220, dispersion: 0.15, type: 'mana'},
    {name: 'Mikstura lecząca', center: 110, dispersion: 0.2, type: 'health'},
    {name: 'Mikstura uzdrowiciela', center: 300, dispersion: 0.2, type: 'health', type: 'health'},
    {name: 'Mikstura wyzdrowienia', center: 450, dispersion: 0.2, type: 'health'},
    ]


     const updateLevels = function() {
     const updateForm = function() {
playerAlchemySelect.innerHTML = '';
playerAlchemySelect.innerHTML = '';
potionCreatorAlchemySelect.innerHTML = '';
potionCreatorAlchemySelect.innerHTML = '';
Linia 47: Linia 62:
option2.textContent = i;
option2.textContent = i;
             potionCreatorAlchemySelect.appendChild(option2);
             potionCreatorAlchemySelect.appendChild(option2);
}
}
};
 
        potionsArray.forEach(potion => {
            const potionOption = document.createElement('option');
            potionOption.value = potion.name;
potionOption.textContent = potion.name;
            potionsSelect.appendChild(potionOption);
        });
 
        submitButton.disabled = false;
        };
   
    window.onAltaronLoaded = () => updateForm();
   
      
      
    setTimeout(()=> updateLevels(), 500);
window.calculateImpact = function() {
window.calculateImpact = function() {
         let mod = 1;
         let mod = 1;
Linia 58: Linia 83:


         if(isAlchemicCheckbox.checked){
         if(isAlchemicCheckbox.checked){
        mod = mod * 1.05;
          mod = mod * 1.05;
         }
         }
        mod = Math.floor(mod * 100) - 100;
          
          
         console.log(mod)
         const selectedPotion = potionsArray.find((potion) => potion.name == potionsSelect.value);
         mod = Math.floor(mod * 100) - 100;
        const potionMinValue = Math.floor((selectedPotion.center - selectedPotion.center * selectedPotion.dispersion) * (1 + mod/100));
         const potionMaxValue = Math.floor((selectedPotion.center + selectedPotion.center * selectedPotion.dispersion) * (1 + mod/100));


         document.getElementById("alchemyImpact").innerHTML = "Użyte przez Ciebie mikstury są efektywniejsze o " + mod + "%.";
         document.getElementById("alchemyImpact").innerHTML = "Użyta przez Ciebie mikstura jest efektywniejsza o " + mod + "%.";
        document.getElementById("potionValues").innerHTML = "Przywróci Ci od " + potionMinValue + " do " + potionMaxValue + (selectedPotion.type == 'mana' ? " many" : " życia") + ".";
};
};



Aktualna wersja na dzień 11:11, 27 cze 2023

Zwój Przemiany.gif Kalkulator wpływu alchemii na wytwarzane mikstury