Skip to content

Commit adbc2c0

Browse files
authored
feat: Added layouts for Daggerheart Adversaries, Cards and Environments (#490)
* feat: Adds new Daggerheart layouts for adversaries, cards, and environments * chore: added documentation, layouts, screenshots for Daggerheart * feat: updated daggerheart card layout * feat: improved readability for daggerheart adversary layout css * docs: added example codeblocks for daggerheart cards and environments * chore: fixed two linting errors in daggerheart.ts * feat: added qty property and added checkbox health/stress tracking
1 parent 0e78807 commit adbc2c0

16 files changed

Lines changed: 1643 additions & 2 deletions

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ Fantasy Statblocks uses trademarks and/or copyrights owned by Paizo Inc., used u
4646
We are expressly prohibited from charging you to use or access this content.
4747
Fantasy Statblocks is not published, endorsed, or specifically approved by Paizo.
4848
For more information about Paizo Inc. and Paizo products, visit paizo.com.
49+
50+
### Daggerheart and Darrington Press License Disclosure
51+
Fantasy Statblocks uses materials from the Daggerheart System Reference Document 1.0, © Critical Role, LLC. under the terms of the Darrington Press Community Gaming (DPCGL) License. More information can be found at https://www.daggerheart.com/. There are minor modifications to format and structure. No previous modifications by others.
52+
53+
Daggerheart and all related marks are trademarks of Critical Role, LLC and used with permission. This project is not affiliated with, endorsed, or sponsored by Critical Role or Darrington Press.
54+
55+
For full license terms, see: https://www.daggerheart.com/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const ribbonBlock = document.createElement("div");
2+
ribbonBlock.classList.add("daggerheart-card-ribbon");
3+
4+
const levelBlock = document.createElement("div");
5+
levelBlock.classList.add("card-level");
6+
7+
const levelText = document.createElement("span");
8+
levelText.innerHTML = monster.level;
9+
10+
levelBlock.append(levelText);
11+
12+
const domainBlock = document.createElement("div");
13+
domainBlock.classList.add("card-domain");
14+
domainBlock.classList.add(monster.domain);
15+
16+
const domainText = document.createElement("span");
17+
domainText.innerText = monster.domain;
18+
domainBlock.append(domainText)
19+
20+
ribbonBlock.append(levelBlock);
21+
ribbonBlock.append(domainBlock);
22+
23+
return ribbonBlock;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const headingBlock = document.createElement("div");
2+
headingBlock.classList.add("daggerheart-heading");
3+
4+
const typeBlock = document.createElement("div");
5+
typeBlock.classList.add("card-type");
6+
typeBlock.classList.add(monster.domain);
7+
8+
const typeText = document.createElement("span");
9+
typeText.innerText = monster.type;
10+
typeBlock.append(typeText)
11+
12+
headingBlock.append(typeBlock);
13+
14+
return headingBlock;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const getStatLine = () => {
2+
const statLine = document.createElement("div");
3+
const statClass = `${monster.name.replace(/[^a-zA-Z0-9]/g,'-').toLowerCase()}-block`;
4+
statLine.classList.add("adversary-block");
5+
statLine.classList.add(statClass);
6+
7+
let numBlocks = monster.qty ? monster.qty : 1;
8+
9+
for (let i = 1; i <= numBlocks; i++) {
10+
let adversaryBlock = document.createElement("div");
11+
let adversaryClass = `${monster.name.replace(/[^a-zA-Z0-9]/g,'-').toLowerCase()}-block`;
12+
adversaryBlock.classList.add("stat-line");
13+
adversaryBlock.classList.add(adversaryClass);
14+
15+
// add adversary name/number
16+
adversaryBlock.append(getAdversaryNameBlock(monster.name, i));
17+
18+
// add hp title
19+
adversaryBlock.append(document.createElement("br"));
20+
adversaryBlock.append(getStatNameBlock("HP"));
21+
22+
// for each hp make checkbox
23+
for (let h = 0; h < monster.hp; h++) {
24+
adversaryBlock.append(getCheckboxValueBlock("hp", h));
25+
}
26+
27+
// add stress title
28+
adversaryBlock.append(document.createElement("br"));
29+
adversaryBlock.append(getStatNameBlock("stress"));
30+
31+
// for each stress make checkbox
32+
for (let s = 0; s < monster.stress; s++) {
33+
adversaryBlock.append(getCheckboxValueBlock("stress", s));
34+
}
35+
36+
statLine.append(adversaryBlock);
37+
}
38+
39+
return statLine;
40+
}
41+
42+
const getCheckboxValueBlock = (type, val) => {
43+
const checkbox = document.createElement("input");
44+
checkbox.type = "checkbox";
45+
checkbox.classList.add(`${type}-${val}`);
46+
checkbox.classList.add("stat-value");
47+
checkbox.onclick = () => {
48+
console.log(tp);
49+
};
50+
return checkbox;
51+
}
52+
53+
const getStatNameBlock = (statName) => {
54+
const statNameBlock = document.createElement("span");
55+
statNameBlock.classList.add("stat-name");
56+
statNameBlock.innerText = `${statName.toUpperCase()}: `;
57+
return statNameBlock;
58+
}
59+
60+
const getAdversaryNameBlock = (adversaryName, num) => {
61+
const adversaryNameBlock = document.createElement("span");
62+
adversaryNameBlock.classList.add("adversary-name");
63+
adversaryNameBlock.innerText = `${adversaryName.toUpperCase()} #${num}: `;
64+
return adversaryNameBlock;
65+
}
66+
67+
const statFullBlock = document.createElement("div");
68+
statFullBlock.classList.add("stat-block");
69+
statFullBlock.append(getStatLine());
70+
71+
return statFullBlock;

0 commit comments

Comments
 (0)