diff --git a/sheet.css b/sheet.css index 3c52982..4c775dc 100644 --- a/sheet.css +++ b/sheet.css @@ -9,6 +9,10 @@ box-sizing: border-box; } +p { + margin: 0px; +} + div.flex { display: flex; flex-direction: row; @@ -23,6 +27,16 @@ div.grid { gap: 10px; } +div.nowrap { + flex-wrap: nowrap; +} + +@media (max-width: 600px) { + div.mobile { + display: block; + } +} + body { min-height: 100vh; background-color: var(--background-color); @@ -34,30 +48,44 @@ main { margin-right: auto; background-color: var(--page-color); color: var(--text-color); - padding: 10px; - border: 1px solid var(--text-color); border-radius: 10px; - box-shadow: 5px 5px 5px var(--shadow-color); - width: fit-content; - max-width: max(50%, 720px); } main > form > * { - margin-top: 10px; + border-bottom: 1px solid var(--text-color); + padding-top: 10px; + padding-bottom: 10px; +} + +main > form > *:last-child { + border-bottom: none; } input, select { - width: fit-content; + border: none; + border-bottom: 1px dashed var(--text-color); + background-color: var(--page-color); + width: 100%; } input[type="number"] { - min-width: 6ch; + min-width: 4ch; } -input[type="text"] { - min-width: 20ch; +input[type="checkbox"] { + width: min-content; +} + +label { + display: flex; + align-items: center; + gap: 10px; } h1 { text-align: center; +} + +.none { + display: none; } \ No newline at end of file diff --git a/sheet.js b/sheet.js index e69de29..966a250 100644 --- a/sheet.js +++ b/sheet.js @@ -0,0 +1,274 @@ +window.addEventListener("DOMContentLoaded", init); + +let combatModifiers = [ + { + category: "Saves", + items: [ + { + name: "Resilience", + type: "full", + value: function (e) { return Math.max(e.STR, e.END) + e.training + (e.mb * e.mastery); } + + }, + { + name: "Reflex", + type: "full", + value: function (e) { return Math.max(e.AGI, e.WIT) + e.training + (e.mb * e.mastery); } + }, + { + name: "Resolve", + type: "full", + value: function (e) { return Math.max(e.INT, e.CHA) + e.training + (e.mb * e.mastery); } + } + ] + }, + { + category: "Weapon", + items: [ + { + name: "Simple", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Brawl", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Bludgeon", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Axe", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Polearm", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Sword", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Archery", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + }, + { + name: "Firearm", + type: "full", + value: function (e) { return Math.max(e.STR, e.AGI) + e.training + (e.mb * e.mastery); } + } + ] + }, + { + category: "Armor", + items: [ + { + name: "Unarmored", + type: "training-only", + value: function (e) { return } + }, + { + name: "Light", + type: "training-only", + value: function (e) { return } + }, + { + name: "Medium", + type: "training-only", + value: function (e) { return } + }, + { + name: "Heavy", + type: "training-only", + value: function (e) { return } + } + ] + } +] + +let rpModifiers = [ + { + category: "Skills", + items: [ + { + name: "Athletics", + type: "full", + value: function (e) { return e.STR + e.training + (e.mb * e.mastery); } + }, + { + name: "Fortitude", + type: "full", + value: function (e) { return e.END + e.training + (e.mb * e.mastery); } + }, + { + name: "Acrobatics", + type: "full", + value: function (e) { return e.AGI + e.training + (e.mb * e.mastery); } + }, + { + name: "Stealth", + type: "full", + value: function (e) { return e.AGI + e.training + (e.mb * e.mastery); } + }, + { + name: "Thievery", + type: "full", + value: function (e) { return e.AGI + e.training + (e.mb * e.mastery); } + }, + { + name: "Animal_Handling", + type: "full", + value: function (e) { return e.WIT + e.training + (e.mb * e.mastery); } + }, + { + name: "Intuition", + type: "full", + value: function (e) { return e.WIT + e.training + (e.mb * e.mastery); } + }, + { + name: "Perception", + type: "full", + value: function (e) { return e.WIT + e.training + (e.mb * e.mastery); } + }, + { + name: "Streetwise", + type: "full", + value: function (e) { return e.WIT + e.training + (e.mb * e.mastery); } + }, + { + name: "Survival", + type: "full", + value: function (e) { return e.WIT + e.training + (e.mb * e.mastery); } + }, + { + name: "Arcana", + type: "full", + value: function (e) { return e.INT + e.training + (e.mb * e.mastery); } + }, + { + name: "Crafting", + type: "full", + value: function (e) { return e.INT + e.training + (e.mb * e.mastery); } + }, + { + name: "Investigation", + type: "full", + value: function (e) { return e.INT + e.training + (e.mb * e.mastery); } + }, + { + name: "Medicine", + type: "full", + value: function (e) { return e.INT + e.training + (e.mb * e.mastery); } + }, + { + name: "Lore", + type: "textarea", + value: function (e) { return e.INT + e.training + (e.mb * e.mastery); } + }, + { + name: "Deception", + type: "full", + value: function (e) { return e.CHA + e.training + (e.mb * e.mastery); } + }, + { + name: "Intimidation", + type: "full", + value: function (e) { return e.CHA + e.training + (e.mb * e.mastery); } + }, + { + name: "Performance", + type: "full", + value: function (e) { return e.CHA + e.training + (e.mb * e.mastery); } + }, + { + name: "Persuasion", + type: "full", + value: function (e) { return e.CHA + e.training + (e.mb * e.mastery); } + } + ] + } +] + +function init () { + populateModifiers("#combat-modifiers", combatModifiers); + window.setInterval(() => { setAllValues(combatModifiers) }, 250); + populateModifiers("#rp-modifiers", rpModifiers); + setAllValues(rpModifiers); + window.setInterval(() => { setAllValues(rpModifiers) }, 250); +} + +function populateModifiers(container, data) { + let area = document.querySelector(container); + for (let i in data) { + let category = data[i]; + let categoryDiv = document.createElement("div"); + area.append(categoryDiv); + categoryDiv.style = "display: contents;"; + categoryDiv.innerHTML = `

${category.category}

`; + for (let j in data[i].items) { + let item = data[i].items[j]; + if (item.type === "full") { + categoryDiv.innerHTML += ` +
+

${item.name}

+ + + +
+ `; + } + else if (item.type === "training-only"){ + categoryDiv.innerHTML += ` +
+

${item.name}

+ + + +
+ `; + } + else if (item.type === "textarea") { + categoryDiv.innerHTML += ` +
+ + + + +
+ `; + } + } + } +} + +function setAllValues (data) { + for (let i in data) { + let category = data[i]; + for (let j in data[i].items) { + let item = data[i].items[j]; + setModifierVal(category.category, item.name, item.value); + } + } +} + +function setModifierVal (category, name, value) { + let e = {}; + e.STR = Number(document.querySelector("#str").value); + e.END = Number(document.querySelector("#end").value); + e.AGI = Number(document.querySelector("#agi").value); + e.WIT = Number(document.querySelector("#wit").value); + e.INT = Number(document.querySelector("#int").value); + e.CHA = Number(document.querySelector("#cha").value); + e.training = Number(document.querySelector(`#${category}-${name}-training`).value); + e.mb = Number(document.querySelector(`#${category}-${name}-mb`).checked); + e.mastery = Number(document.querySelector("#mastery").value); + document.querySelector(`#${category}-${name}-result`).innerText = value(e); +} \ No newline at end of file diff --git a/songs.html b/songs.html index cab19e1..9d4200a 100644 --- a/songs.html +++ b/songs.html @@ -1,6 +1,7 @@ - + + Character Sheet - SotSA @@ -11,58 +12,51 @@

Songs of the Second Age: Character Sheet

-
- - - - - - +
+ + + + + +
-
- - +
+ + +
+ + + + + +
-
- -
- - - - -
+
+ + + + + +
-
- - - - - - - - - - - - +
+ + + + + +
-
- - - - - - - - - - - -
- -

/

- -
+
+
+