diff --git a/Heart-the-City-Beneath-mk2/Heart.css b/Heart-the-City-Beneath-mk2/Heart.css index d9ad3bd50e..b79a2c3f83 100644 --- a/Heart-the-City-Beneath-mk2/Heart.css +++ b/Heart-the-City-Beneath-mk2/Heart.css @@ -16,12 +16,12 @@ .sheet-container { display: grid; grid-template-areas: - "top stress" - "beats abilities-fallout" - "equipment abilities-fallout" - "resources abilities-fallout" + "top stress" + "beats abilities-fallout" + "equipment abilities-fallout" + "resources abilities-fallout" "skills-domains abilities-fallout" - "notes notes"; + "notes notes"; grid-template-columns: 1fr 1fr; grid-gap: var(--large-gap) calc(2 * var(--large-gap)); align-items: start; @@ -323,9 +323,9 @@ input[type="text"].sheet-redtext { align-items: start; grid-column: span 2; grid-template-areas: - "skill text text text" - "domain text text text" - "mastery extradice difficulty button"; + "skill text text text" + "domain text text text" + "mastery extradice difficulty button"; grid-gap: var(--tiny-gap) var(--large-gap); } .sheet-rollbutton .sheet-mastery { @@ -462,7 +462,6 @@ label.sheet-extradice input[type="number"] { padding: 5px; overflow: hidden; user-select: none; - display:grid; cursor: default; overflow: hidden; font-family: "Times New Roman", serif; @@ -470,6 +469,14 @@ label.sheet-extradice input[type="number"] { background-repeat: no-repeat; background-size: 100% auto; background-image: url("https://raw.githubusercontent.com/roll20/roll20-character-sheets/master/Heart-the-City-Beneath-mk2/Heart-bg.png"); + display: grid; + grid-template-areas: + "title roll" + "name roll" + "details roll"; + grid-template-columns: 1fr auto; + grid-template-rows: auto auto 1fr; + grid-column-gap: 3px; } .withoutavatars .sheet-rolltemplate-heart { margin-left: -12px; @@ -477,13 +484,6 @@ label.sheet-extradice input[type="number"] { .sheet-rolltemplate-heart div { box-sizing: border-box; } -.sheet-rolltemplate-heart .inlinerollresult { - border: none !important; - background-color: transparent; - font-weight: bold; - padding: 0 3px 0 0; - font-size: 1.4em; -} .sheet-rolltemplate-heart .sheet-title { color: #a00a03; font-size: 1.2em; @@ -493,3 +493,32 @@ label.sheet-extradice input[type="number"] { font-size: 1.1em; letter-spacing: 0.5px; } +.sheet-rolltemplate-heart .sheet-roll { + grid-area: roll; + align-self: center; + justify-self: center; + border: 2px solid black; + border-radius: 10px; + min-width: 40px; + min-height: 40px; + max-width: 80px; + text-align: center; + padding: 5px; + font-size: 0.9em; +} +.sheet-rolltemplate-heart .sheet-main-roll { + font-size: 1.1em; +} +.sheet-rolltemplate-heart .inlinerollresult { + border: none !important; + background-color: transparent; + font-weight: bold; + padding: 0 3px 0 0; + font-size: 1.2em; +} +.sheet-rolltemplate-heart .sheet-main-roll .inlinerollresult { + font-size: 1.6em; +} +.sheet-rolltemplate-heart .sheet-details { + grid-column: span 2; +} diff --git a/Heart-the-City-Beneath-mk2/Heart.html b/Heart-the-City-Beneath-mk2/Heart.html index 0c77100b0c..b182db1893 100644 --- a/Heart-the-City-Beneath-mk2/Heart.html +++ b/Heart-the-City-Beneath-mk2/Heart.html @@ -77,7 +77,7 @@ + value="&{template:heart} {{title=^{fallout-label}}} {{name=@{character_name}}} {{fallout_against=[[@{total_stress}]]}} {{roll=[[1d12cs0cf0]] vs [[@{total_stress}]]}}">Fallout
+ value="&{template:heart} {{title=@{roll_title}}} {{name=@{character_name}}} {{roll=@{roll_formula}}} {{roll_details=@{roll_formula_single}}} {{details=@{roll_message}}} {{showresult=1}} @{roll_zerodice}">Roll + +
Standard: use highest result @@ -440,9 +442,41 @@
{{name}}
- {{roll}} - {{#fallout_against}} - — +
{{roll}}
+
{{roll_details}}
+
+ {{#showresult}}
+ {{^zerodice}} + {{#rollTotal() roll 1}} + + {{/rollTotal() roll 1}} + {{#rollBetween() roll 2 5}} + + {{/rollBetween() roll 2 5}} + {{#rollBetween() roll 6 7}} + + {{/rollBetween() roll 6 7}} + {{#rollBetween() roll 8 9}} + + {{/rollBetween() roll 8 9}} + {{#rollTotal() roll 10}} + + {{/rollTotal() roll 10}} + {{/zerodice}} + {{#zerodice}} + {{#rollTotal() roll 1}} + + {{/rollTotal() roll 1}} + {{#rollBetween() roll 2 9}} + + {{/rollBetween() roll 2 9}} + {{#rollTotal() roll 10}} + + {{/rollTotal() roll 10}} + {{/zerodice}} +
{{/showresult}} + {{#details}}
{{details}}
{{/details}} + {{#fallout_against}}
{{#rollGreater() roll fallout_against}} . {{/rollGreater() roll fallout_against}} @@ -450,9 +484,7 @@ {{#rollGreater() roll 6}}.{{/rollGreater() roll 6}} {{#^rollGreater() roll 6}}.{{/^rollGreater() roll 6}} {{/^rollGreater() roll fallout_against}} - {{/fallout_against}} -
- {{#details}}
{{details}}
{{/details}} +
{{/fallout_against}} @@ -482,6 +514,11 @@ const kDomains = [ "warren", "wild", ]; +const Difficulty = { + Standard: 0, + Risky: 1, + Dangerous: 2, +}; const kRollAffectingAttributes = [ ...kSkills.map((skill) => `skill_${skill}`), @@ -494,7 +531,7 @@ const kRollAffectingAttributes = [ ]; function getTranslation(key) { - return getTranslationByKey(key) || ""; + return key ? (getTranslationByKey(key) || "") : ""; } // This is not very efficient, but it only runs at most once. @@ -583,27 +620,33 @@ function calculateTotalStress() { }); } -function getDifficultyMessage(difficulty) { +function getDifficultyMessage(difficulty, is_zero) { + let difficulty_str = ""; switch (difficulty) { - case 0: - return `**${getTranslation("standard")}:** ${getTranslation( - "standard-pool-label" - )}.`; - case 1: - return `**${getTranslation("risky")}:** ${getTranslation( - "risky-pool-label" - )}.`; - case 2: - return `**${getTranslation("dangerous")}:** ${getTranslation( - "dangerous-pool-label" - )}.`; - default: - return "Error retrieving difficulty. This should never happen."; + case Difficulty.Standard: + difficulty_str = getTranslation("standard"); + break; + case Difficulty.Risky: + difficulty_str = getTranslation("risky"); + break; + case Difficulty.Dangerous: + difficulty_str = getTranslation("dangerous"); } + return ( + `**${getTranslation("difficulty")}:** ${difficulty_str}.` + + (is_zero ? ` **${getTranslation("zero-effective-dice")}**.` : "") + ); } -function computeFormula(number) { - return [...Array(number)].map(() => "[[d10]]").join(", "); +function computeFormula(num_dice, difficulty) { + const rolls = [...Array(num_dice)].map(() => "[[d10]]").join(", "); + return `[[{${rolls}}dh${difficulty}kh${difficulty + 1}]]`; +} + +function computeSingleDice(num_dice) { + return num_dice <= 1 + ? "" + : [...Array(num_dice)].map((_, i) => `$[[${i}]]`).join(""); } function buildDicePool() { @@ -619,19 +662,24 @@ function buildDicePool() { parseInt(v["roll_mastery"], 10) + parseInt(v["roll_extra_dice"], 10); const is_zero = roll_dice - difficulty <= 0; + const number_of_dice = is_zero ? 1 : roll_dice; - const roll_formula = computeFormula(is_zero ? 1 : roll_dice); - const roll_message = is_zero - ? `**${getTranslation("zero-effective-dice")}:** ${ - getTranslation("zero-dice-label") - }` - : getDifficultyMessage(difficulty); + const roll_formula = computeFormula(number_of_dice, difficulty); + const roll_formula_single = computeSingleDice(number_of_dice); + const roll_message = getDifficultyMessage(difficulty, is_zero); const roll_title = roll_skill && roll_domain ? `${getTranslation(roll_skill)} + ${getTranslation(roll_domain)}` : `${getTranslation(roll_skill)}${getTranslation(roll_domain)}`; + const roll_zerodice = is_zero ? "{{zerodice=1}}" : ""; - setAttrs({ roll_formula, roll_message, roll_title }); + setAttrs({ + roll_formula, + roll_formula_single, + roll_zerodice, + roll_message, + roll_title, + }); }); } diff --git a/Heart-the-City-Beneath-mk2/translation.json b/Heart-the-City-Beneath-mk2/translation.json index f455d0f5a6..23f4b8eb14 100644 --- a/Heart-the-City-Beneath-mk2/translation.json +++ b/Heart-the-City-Beneath-mk2/translation.json @@ -11,7 +11,9 @@ "clear-label": "Clear", "clearstress-label": "Clear Stress", "compel": "Compel", + "critical-failure-msg": "Critical failure (take double stress)", "critical-label": "Critical", + "critical-success-msg": "Critical success (increase outgoing stress die size)", "cursed": "Cursed", "dangerous": "Dangerous", "dangerous-pool-label": "drop 2 highest results, use third-highest result", @@ -19,12 +21,14 @@ "description-label": "Domains/Tags", "desolate": "Desolate", "die-label": "Die", + "difficulty": "Difficulty", "discern": "Discern", "domains-label": "Domains", "echo-label": "Echo", "endure": "Endure", "equipment-label": "Equipment", "evade": "Evade", + "failure-msg": "Failure (take stress)", "fallout-label": "Fallout", "fallout-test-label": "Fallout Test", "fallout_name": "Fallout name", @@ -39,7 +43,7 @@ "mind-label": "Mind", "minor-label": "Minor", "name-label": "Name", - "no-fallout": "no fallout", + "no-fallout": "No fallout", "none": "None", "notes-label": "Notes", "occult": "Occult", @@ -50,13 +54,15 @@ "risky-pool-label": "drop highest result, use second-highest result", "roll-label": "Roll", "skills-label": "Skills", + "success-at-a-cost-msg": "Success at a cost (take stress)", + "success-msg": "Success (take no stress)", "sneak": "Sneak", "standard": "Standard", "standard-pool-label": "use highest result", "stress-label": "Stress", "supplies-label": "Supplies", - "take-major-fallout": "take major fallout", - "take-minor-fallout": "take minor fallout", + "take-major-fallout": "Take major fallout", + "take-minor-fallout": "Take minor fallout", "technology": "Technology", "total-label": "Total", "warren": "Warren",