CharakterCreator: Unterschied zwischen den Versionen
Aus Dunkelherzen Wiki
DRP (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
DRP (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 42: | Zeile 42: | ||
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
white-space: pre-wrap; | white-space: pre-wrap; | ||
} | |||
.points-info { | |||
font-weight: bold; | |||
margin-top: 10px; | |||
color: green; | |||
} | |||
.hint { | |||
font-size: 0.9em; | |||
color: #888; | |||
margin-top: 5px; | |||
} | } | ||
</style> | </style> | ||
| Zeile 56: | Zeile 68: | ||
<option value="Krieger">Krieger (+2 Stärke, +1 Ausdauer)</option> | <option value="Krieger">Krieger (+2 Stärke, +1 Ausdauer)</option> | ||
<option value="Magier">Magier (+2 Intelligenz, +1 Wahrnehmung)</option> | <option value="Magier">Magier (+2 Intelligenz, +1 Wahrnehmung)</option> | ||
</select> | |||
<label for="subklasse">Subklasse:</label> | |||
<select id="subklasse"> | |||
<option value="">Keine</option> | |||
<option value="Paladin">Paladin (+1 Stärke, +1 Konstitution)</option> | |||
<option value="Hexer">Hexer (+1 Intelligenz, +1 Charisma)</option> | |||
</select> | </select> | ||
| Zeile 64: | Zeile 83: | ||
<option value="Elf">Elf (+1 Geschick, +1 Intelligenz)</option> | <option value="Elf">Elf (+1 Geschick, +1 Intelligenz)</option> | ||
</select> | </select> | ||
<label for="subspezies">Subspezies:</label> | |||
<select id="subspezies"> | |||
<option value="">Keine</option> | |||
<option value="Waldelf">Waldelf (+1 Wahrnehmung)</option> | |||
<option value="Stadtmensch">Stadtmensch (+1 Charisma)</option> | |||
</select> | |||
<div class="points-info" id="punkteAnzeige">Verfügbare Punkte: 160</div> | |||
<div class="hint">Hinweis: Du kannst theoretisch bis zu 3 Gegenstände wählen, die je 10 Bonuspunkte geben würden.</div> | |||
<table class="attr-table" id="attrTabelle"> | <table class="attr-table" id="attrTabelle"> | ||
| Zeile 84: | Zeile 113: | ||
<script> | <script> | ||
const | const attribute = [ | ||
" | "Agilität", "Ausdauer", "Charisma", "Geschick", "Intelligenz", | ||
"Konstitution", "Resistenz", "Stärke", "Wahrnehmung" | |||
]; | |||
" | const basispunkte = 160; | ||
const klassenBoni = { | const klassenBoni = { | ||
"Krieger": { "Stärke": 2, "Ausdauer": 1 }, | "Krieger": { "Stärke": 2, "Ausdauer": 1 }, | ||
"Magier": { "Intelligenz": 2, "Wahrnehmung": 1 } | "Magier": { "Intelligenz": 2, "Wahrnehmung": 1 } | ||
}; | |||
const subklassenBoni = { | |||
"Paladin": { "Stärke": 1, "Konstitution": 1 }, | |||
"Hexer": { "Intelligenz": 1, "Charisma": 1 } | |||
}; | }; | ||
| Zeile 102: | Zeile 133: | ||
"Mensch": { "Charisma": 1, "Konstitution": 1 }, | "Mensch": { "Charisma": 1, "Konstitution": 1 }, | ||
"Elf": { "Geschick": 1, "Intelligenz": 1 } | "Elf": { "Geschick": 1, "Intelligenz": 1 } | ||
}; | |||
const subspeziesBoni = { | |||
"Waldelf": { "Wahrnehmung": 1 }, | |||
"Stadtmensch": { "Charisma": 1 } | |||
}; | }; | ||
| Zeile 107: | Zeile 143: | ||
const name = document.getElementById("name").value; | const name = document.getElementById("name").value; | ||
const klasse = document.getElementById("klasse").value; | const klasse = document.getElementById("klasse").value; | ||
const subklasse = document.getElementById("subklasse").value; | |||
const rasse = document.getElementById("rasse").value; | const rasse = document.getElementById("rasse").value; | ||
const subspezies = document.getElementById("subspezies").value; | |||
let werte = {}; | |||
attribute.forEach(attr => werte[attr] = 0); | |||
let bonus = 0; | |||
if (!subklasse) bonus += 15; | |||
if (!subspezies) bonus += 20; | |||
const boniQuellen = [klassenBoni[klasse], subklassenBoni[subklasse], rassenBoni[rasse], subspeziesBoni[subspezies]]; | |||
if ( | boniQuellen.forEach(quell => { | ||
if (quell) { | |||
for (let attr in quell) { | |||
werte[attr] += quell[attr]; | |||
} | |||
} | } | ||
} | }); | ||
let vergeben = Object.values(werte).reduce((a, b) => a + b, 0); | |||
let gesamtPunkte = basispunkte + bonus; | |||
let verbleibend = gesamtPunkte - vergeben; | |||
// Tabelle neu | // Tabelle neu generieren | ||
const attrBody = document.getElementById("attrBody"); | const attrBody = document.getElementById("attrBody"); | ||
attrBody.innerHTML = ""; | attrBody.innerHTML = ""; | ||
attribute.forEach(attr => { | |||
const row = `<tr><td>${attr}</td><td>${werte[attr]}</td></tr>`; | const row = `<tr><td>${attr}</td><td>${werte[attr]}</td></tr>`; | ||
attrBody.insertAdjacentHTML("beforeend", row); | attrBody.insertAdjacentHTML("beforeend", row); | ||
} | }); | ||
document.getElementById("punkteAnzeige").textContent = `Verfügbare Punkte: ${verbleibend}`; | |||
const daten = { | const daten = { | ||
Name: name, | Name: name, | ||
Klasse: klasse, | Klasse: klasse, | ||
Subklasse: subklasse || "Keine", | |||
Rasse: rasse, | Rasse: rasse, | ||
Attribute: werte | Subspezies: subspezies || "Keine", | ||
Attribute: werte, | |||
Verfügbare_Punkte: verbleibend, | |||
Hinweis: "Du kannst zusätzlich 3 Gegenstände wählen, die je 10 Punkte geben würden." | |||
}; | }; | ||
Version vom 26. Juli 2025, 07:58 Uhr
Charakter Creator
Verfügbare Punkte: 160
Hinweis: Du kannst theoretisch bis zu 3 Gegenstände wählen, die je 10 Bonuspunkte geben würden.
| Attribut | Wert |
|---|
