Vorlage:Charactersheet: Unterschied zwischen den Versionen

Aus Meddlerde
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 47: Zeile 47:
             <table style="width: 100%; border-collapse: collapse; font-size: 10px;">
             <table style="width: 100%; border-collapse: collapse; font-size: 10px;">
                 <tr>
                 <tr>
                     <td><strong>Strength:</strong> {{{strengthSave}}}</td>
                     <td><strong>Strength:</strong> <span id="strengthSave"></span></td>
                     <td><strong>Dexterity:</strong> {{{dexteritySave}}}</td>
                     <td><strong>Dexterity:</strong> <span id="dexteritySave"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Constitution:</strong> {{{constitutionSave}}}</td>
                     <td><strong>Constitution:</strong> <span id="constitutionSave"></span></td>
                     <td><strong>Intelligence:</strong> {{{intelligenceSave}}}</td>
                     <td><strong>Intelligence:</strong> <span id="intelligenceSave"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Wisdom:</strong> {{{wisdomSave}}}</td>
                     <td><strong>Wisdom:</strong> <span id="wisdomSave"></span></td>
                     <td><strong>Charisma:</strong> {{{charismaSave}}}</td>
                     <td><strong>Charisma:</strong> <span id="charismaSave"></span></td>
                 </tr>
                 </tr>
             </table>
             </table>
Zeile 63: Zeile 63:
             <table style="width: 100%; border-collapse: collapse; font-size: 10px;">
             <table style="width: 100%; border-collapse: collapse; font-size: 10px;">
                 <tr>
                 <tr>
                     <td><strong>Acrobatics:</strong> {{{acrobatics}}}</td>
                     <td><strong>Acrobatics:</strong> <span id="acrobatics"></span></td>
                     <td><strong>Animal Handling:</strong> {{{animalHandling}}}</td>
                     <td><strong>Animal Handling:</strong> <span id="animalHandling"></span></td>
                     <td><strong>Arcana:</strong> {{{arcana}}}</td>
                     <td><strong>Arcana:</strong> <span id="arcana"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Athletics:</strong> {{{athletics}}}</td>
                     <td><strong>Athletics:</strong> <span id="athletics"></span></td>
                     <td><strong>Deception:</strong> {{{deception}}}</td>
                     <td><strong>Deception:</strong> <span id="deception"></span></td>
                     <td><strong>History:</strong> {{{history}}}</td>
                     <td><strong>History:</strong> <span id="history"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Insight:</strong> {{{insight}}}</td>
                     <td><strong>Insight:</strong> <span id="insight"></span></td>
                     <td><strong>Intimidation:</strong> {{{intimidation}}}</td>
                     <td><strong>Intimidation:</strong> <span id="intimidation"></span></td>
                     <td><strong>Investigation:</strong> {{{investigation}}}</td>
                     <td><strong>Investigation:</strong> <span id="investigation"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Medicine:</strong> {{{medicine}}}</td>
                     <td><strong>Medicine:</strong> <span id="medicine"></span></td>
                     <td><strong>Nature:</strong> {{{nature}}}</td>
                     <td><strong>Nature:</strong> <span id="nature"></span></td>
                     <td><strong>Perception:</strong> {{{perception}}}</td>
                     <td><strong>Perception:</strong> <span id="perception"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Performance:</strong> {{{performance}}}</td>
                     <td><strong>Performance:</strong> <span id="performance"></span></td>
                     <td><strong>Persuasion:</strong> {{{persuasion}}}</td>
                     <td><strong>Persuasion:</strong> <span id="persuasion"></span></td>
                     <td><strong>Religion:</strong> {{{religion}}}</td>
                     <td><strong>Religion:</strong> <span id="religion"></span></td>
                 </tr>
                 </tr>
                 <tr>
                 <tr>
                     <td><strong>Sleight of Hand:</strong> {{{sleightOfHand}}}</td>
                     <td><strong>Sleight of Hand:</strong> <span id="sleightOfHand"></span></td>
                     <td><strong>Stealth:</strong> {{{stealth}}}</td>
                     <td><strong>Stealth:</strong> <span id="stealth"></span></td>
                     <td><strong>Survival:</strong> {{{survival}}}</td>
                     <td><strong>Survival:</strong> <span id="survival"></span></td>
                 </tr>
                 </tr>
             </table>
             </table>
Zeile 96: Zeile 96:
     </div>
     </div>
</div>
</div>
<script>
function calculateBonus(stat) {
    return Math.floor((stat - 10) / 2);
}
function calculateSkill(baseBonus, proficiencyBonus, isProficient, isExpert) {
    let skillBonus = baseBonus;
    if (isProficient) skillBonus += proficiencyBonus;
    if (isExpert) skillBonus += proficiencyBonus;
    return skillBonus;
}
document.addEventListener("DOMContentLoaded", function() {
    const level = parseInt("{{{level}}}");
    const proficiencyBonus = Math.floor((level - 1) / 4) + 2;
    const stats = {
        strength: parseInt("{{{strength}}}"),
        dexterity: parseInt("{{{dexterity}}}"),
        constitution: parseInt("{{{constitution}}}"),
        intelligence: parseInt("{{{intelligence}}}"),
        wisdom: parseInt("{{{wisdom}}}"),
        charisma: parseInt("{{{charisma}}}")
    };
    const bonuses = {
        strength: calculateBonus(stats.strength),
        dexterity: calculateBonus(stats.dexterity),
        constitution: calculateBonus(stats.constitution),
        intelligence: calculateBonus(stats.intelligence),
        wisdom: calculateBonus(stats.wisdom),
        charisma: calculateBonus(stats.charisma)
    };
    const savingThrows = {
        strength: calculateSkill(bonuses.strength, proficiencyBonus, true, false),
        dexterity: calculateSkill(bonuses.dexterity, proficiencyBonus, true, false),
        constitution: calculateSkill(bonuses.constitution, proficiencyBonus, true, false),
        intelligence: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        wisdom: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
        charisma: calculateSkill(bonuses.charisma, proficiencyBonus, false, false)
    };
    document.getElementById("strengthSave").textContent = savingThrows.strength;
    document.getElementById("dexteritySave").textContent = savingThrows.dexterity;
    document.getElementById("constitutionSave").textContent = savingThrows.constitution;
    document.getElementById("intelligenceSave").textContent = savingThrows.intelligence;
    document.getElementById("wisdomSave").textContent = savingThrows.wisdom;
    document.getElementById("charismaSave").textContent = savingThrows.charisma;
    const skills = {
        acrobatics: calculateSkill(bonuses.dexterity, proficiencyBonus, true, false),
        animalHandling: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
        arcana: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        athletics: calculateSkill(bonuses.strength, proficiencyBonus, true, false),
        deception: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
        history: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        insight: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
        intimidation: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
        investigation: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        medicine: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
        nature: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        perception: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
        performance: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
        persuasion: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
        religion: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
        sleightOfHand: calculateSkill(bonuses.dexterity, proficiencyBonus, false, false),
        stealth: calculateSkill(bonuses.dexterity, proficiencyBonus, false, false),
        survival: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false)
    };
    document.getElementById("acrobatics").textContent = skills.acrobatics;
    document.getElementById("animalHandling").textContent = skills.animalHandling;
    document.getElementById("arcana").textContent = skills.arcana;
    document.getElementById("athletics").textContent = skills.athletics;
    document.getElementById("deception").textContent = skills.deception;
    document.getElementById("history").textContent = skills.history;
    document.getElementById("insight").textContent = skills.insight;
    document.getElementById("intimidation").textContent = skills.intimidation;
    document.getElementById("investigation").textContent = skills.investigation;
    document.getElementById("medicine").textContent = skills.medicine;
    document.getElementById("nature").textContent = skills.nature;
    document.getElementById("perception").textContent = skills.perception;
    document.getElementById("performance").textContent = skills.performance;
    document.getElementById("persuasion").textContent = skills.persuasion;
    document.getElementById("religion").textContent = skills.religion;
    document.getElementById("sleightOfHand").textContent = skills.sleightOfHand;
    document.getElementById("stealth").textContent = skills.stealth;
    document.getElementById("survival").textContent = skills.survival;
});
</script>


<includeonly>{{Sandbox other|| <!-- Categories below this line --> }}</includeonly>
<includeonly>{{Sandbox other|| <!-- Categories below this line --> }}</includeonly>

Version vom 23. Februar 2025, 17:42 Uhr

Character Sheet

{{{name}}}

Class: {{{class}}} Level: {{{level}}}
Race: {{{race}}} Background: {{{background}}}
Armor Class: {{{armorClass}}} Hit Points: {{{hitPoints}}}
Strength: {{{strength}}} ({{{strengthBonus}}}) Dexterity: {{{dexterity}}} ({{{dexterityBonus}}})
Constitution: {{{constitution}}} ({{{constitutionBonus}}}) Intelligence: {{{intelligence}}} ({{{intelligenceBonus}}})
Wisdom: {{{wisdom}}} ({{{wisdomBonus}}}) Charisma: {{{charisma}}} ({{{charismaBonus}}})

Saving Throws

Strength: Dexterity:
Constitution: Intelligence:
Wisdom: Charisma:

Skills

Acrobatics: Animal Handling: Arcana:
Athletics: Deception: History:
Insight: Intimidation: Investigation:
Medicine: Nature: Perception:
Performance: Persuasion: Religion:
Sleight of Hand: Stealth: Survival:

<script> function calculateBonus(stat) {

   return Math.floor((stat - 10) / 2);

}

function calculateSkill(baseBonus, proficiencyBonus, isProficient, isExpert) {

   let skillBonus = baseBonus;
   if (isProficient) skillBonus += proficiencyBonus;
   if (isExpert) skillBonus += proficiencyBonus;
   return skillBonus;

}

document.addEventListener("DOMContentLoaded", function() {

   const level = parseInt("{{{level}}}");
   const proficiencyBonus = Math.floor((level - 1) / 4) + 2;
   const stats = {
       strength: parseInt("{{{strength}}}"),
       dexterity: parseInt("{{{dexterity}}}"),
       constitution: parseInt("{{{constitution}}}"),
       intelligence: parseInt("{{{intelligence}}}"),
       wisdom: parseInt("{{{wisdom}}}"),
       charisma: parseInt("{{{charisma}}}")
   };
   const bonuses = {
       strength: calculateBonus(stats.strength),
       dexterity: calculateBonus(stats.dexterity),
       constitution: calculateBonus(stats.constitution),
       intelligence: calculateBonus(stats.intelligence),
       wisdom: calculateBonus(stats.wisdom),
       charisma: calculateBonus(stats.charisma)
   };
   const savingThrows = {
       strength: calculateSkill(bonuses.strength, proficiencyBonus, true, false),
       dexterity: calculateSkill(bonuses.dexterity, proficiencyBonus, true, false),
       constitution: calculateSkill(bonuses.constitution, proficiencyBonus, true, false),
       intelligence: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       wisdom: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
       charisma: calculateSkill(bonuses.charisma, proficiencyBonus, false, false)
   };
   document.getElementById("strengthSave").textContent = savingThrows.strength;
   document.getElementById("dexteritySave").textContent = savingThrows.dexterity;
   document.getElementById("constitutionSave").textContent = savingThrows.constitution;
   document.getElementById("intelligenceSave").textContent = savingThrows.intelligence;
   document.getElementById("wisdomSave").textContent = savingThrows.wisdom;
   document.getElementById("charismaSave").textContent = savingThrows.charisma;
   const skills = {
       acrobatics: calculateSkill(bonuses.dexterity, proficiencyBonus, true, false),
       animalHandling: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
       arcana: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       athletics: calculateSkill(bonuses.strength, proficiencyBonus, true, false),
       deception: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
       history: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       insight: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
       intimidation: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
       investigation: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       medicine: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
       nature: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       perception: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false),
       performance: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
       persuasion: calculateSkill(bonuses.charisma, proficiencyBonus, false, false),
       religion: calculateSkill(bonuses.intelligence, proficiencyBonus, false, false),
       sleightOfHand: calculateSkill(bonuses.dexterity, proficiencyBonus, false, false),
       stealth: calculateSkill(bonuses.dexterity, proficiencyBonus, false, false),
       survival: calculateSkill(bonuses.wisdom, proficiencyBonus, false, false)
   };
   document.getElementById("acrobatics").textContent = skills.acrobatics;
   document.getElementById("animalHandling").textContent = skills.animalHandling;
   document.getElementById("arcana").textContent = skills.arcana;
   document.getElementById("athletics").textContent = skills.athletics;
   document.getElementById("deception").textContent = skills.deception;
   document.getElementById("history").textContent = skills.history;
   document.getElementById("insight").textContent = skills.insight;
   document.getElementById("intimidation").textContent = skills.intimidation;
   document.getElementById("investigation").textContent = skills.investigation;
   document.getElementById("medicine").textContent = skills.medicine;
   document.getElementById("nature").textContent = skills.nature;
   document.getElementById("perception").textContent = skills.perception;
   document.getElementById("performance").textContent = skills.performance;
   document.getElementById("persuasion").textContent = skills.persuasion;
   document.getElementById("religion").textContent = skills.religion;
   document.getElementById("sleightOfHand").textContent = skills.sleightOfHand;
   document.getElementById("stealth").textContent = skills.stealth;
   document.getElementById("survival").textContent = skills.survival;

}); </script>