From dc80e7b8e691622d35d1887db696a69bcf3a249b Mon Sep 17 00:00:00 2001 From: Nick Eimers Date: Sat, 20 Jun 2020 11:38:30 -0700 Subject: [PATCH] san checks working better, begun work on skills --- css/deltagreen.css | 2 + module/actor/actor-sheet.js | 29 +++++------- module/deltagreen.js | 4 ++ system.json | 4 +- template.json | 20 ++++---- templates/actor/actor-sheet.html | 81 +++++++++----------------------- 6 files changed, 51 insertions(+), 89 deletions(-) diff --git a/css/deltagreen.css b/css/deltagreen.css index 5665435..1e5c14e 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -1,8 +1,10 @@ @import url("https://fonts.googleapis.com/css2?family=Martel:wght@400;800&family=Roboto:wght@300;400;500&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Didact+Gothic"); + /* Global styles */ .window-app { font-family: "Didact Gothic", "Roboto", sans-serif; + height: auto; } .rollable:hover, .rollable:focus { diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index e6e6d49..3dfab3f 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -10,7 +10,7 @@ export class DeltaGreenActorSheet extends ActorSheet { classes: ["deltagreen", "sheet", "actor"], template: "systems/deltagreen/templates/actor/actor-sheet.html", width: 600, - height: 600, + height: 800, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }] }); } @@ -20,11 +20,6 @@ export class DeltaGreenActorSheet extends ActorSheet { /** @override */ getData() { const data = super.getData(); - - //data.dtypes = ["String", "Number", "Boolean"]; - //for (let attr of Object.values(data.data.attributes)) { - // attr.isCheckbox = attr.dtype === "Boolean"; - //} // Prepare items. if (this.actor.data.type == 'character') { @@ -66,15 +61,15 @@ export class DeltaGreenActorSheet extends ActorSheet { let item = i.data; i.img = i.img || DEFAULT_TOKEN; // Append to gear. - if (i.type === 'item') { + if (i.type === 'gear') { gear.push(i); } // Append to features. - else if (i.type === 'feature') { + else if (i.type === 'weapon') { features.push(i); } // Append to spells. - else if (i.type === 'spell') { + else if (i.type === 'ritual') { if (i.data.spellLevel != undefined) { spells[i.data.spellLevel].push(i); } @@ -113,9 +108,9 @@ export class DeltaGreenActorSheet extends ActorSheet { li.slideUp(200, () => this.render(false)); }); - // Rollable abilities. + // Rollable abilities - bind to everything with the 'Rollable' class html.find('.rollable').click(this._onRoll.bind(this)); - + // Drag events for macros. if (this.actor.owner) { let handler = ev => this._onDragItemStart(ev); @@ -128,6 +123,7 @@ export class DeltaGreenActorSheet extends ActorSheet { // Custom Sheet Macros html.find('#btnResetBreakingPoint').click(this._resetBreakingPoint.bind(this)); + //html.find('.sanity-test-btn').click(this._onSanityTest.bind(this)); } /** @@ -174,7 +170,11 @@ export class DeltaGreenActorSheet extends ActorSheet { let targetVal = ""; // check the 'data-target="something" property to determine how to grab the target for the roll - if(dataset.target === "statistic.x5"){ + if(! Number.isNaN(dataset.target)){ + targetVal = dataset.target; + label += `, Target: ${targetVal}`; + } + else if(dataset.target === "statistic.x5"){ let stat = this.actor.data.data.statistics[key]; targetVal = stat.x5; label += `, Target: ${targetVal}`; @@ -192,11 +192,8 @@ export class DeltaGreenActorSheet extends ActorSheet { } _resetBreakingPoint(event){ - //let actorData = this.actor.data; let currentBreakingPoint = 0; - console.log('Resetting breaking point...'); - //console.log(actorData); - + currentBreakingPoint = this.actor.data.data.sanity.value - this.actor.data.data.statistics.pow.value; let updatedData = duplicate(this.actor.data.data); diff --git a/module/deltagreen.js b/module/deltagreen.js index 9241e77..9b002c9 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -45,6 +45,10 @@ Hooks.once('init', async function() { Handlebars.registerHelper('toLowerCase', function(str) { return str.toLowerCase(); }); + + Handlebars.registerHelper('toUpperCase', function(str) { + return str.toUpperCase(); + }); }); Hooks.once("ready", async function() { diff --git a/system.json b/system.json index 2f7e6b3..ceda844 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "name": "deltagreen", "title": "Delta Green", - "description": "Delta Green RPG system for FoundryVTT!", - "version": "1.0.3", + "description": "Delta Green RPG system for FoundryVTT.", + "version": "1.0.0", "minimumCoreVersion": "0.6.2", "compatibleCoreVersion": "0.6.2", "templateVersion": 2, diff --git a/template.json b/template.json index 206d0e5..9a9445d 100644 --- a/template.json +++ b/template.json @@ -12,7 +12,9 @@ "max": 10 }, "wp": { - "value": 10 + "value": 10, + "min": 0, + "max": 10 }, "statistics": { "str": { @@ -76,7 +78,7 @@ "failure": false }, "athletics": { - "label": "Artillery", + "label": "Athletics", "proficiency": 30, "failure": false }, @@ -289,6 +291,7 @@ "base", "human_skills" ], + "schemaVersion": 1.0, "sanity": { "value": 100, "currentBreakingPoint": 101, @@ -309,7 +312,8 @@ "motivations":[ { "description":"", - "disorder":"" + "disorder":"", + "crossedOut": false } ] } @@ -317,8 +321,7 @@ "Item": { "types": [ "weapon", - "equipment", - "ability", + "gear", "ritual" ], "templates": { @@ -331,12 +334,7 @@ "base" ] }, - "equipment": { - "templates": [ - "base" - ] - }, - "ability": { + "gear": { "templates": [ "base" ] diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index dec4029..c6657ae 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -25,7 +25,7 @@
/ - {{numberFormat data.wp.max decimals=0 sign=false}} + {{numberFormat data.wp.max decimals=0 sign=false}}
@@ -36,16 +36,17 @@
+ SAN / {{numberFormat data.sanity.max decimals=0 sign=false}} - + Breaking Point: - - + +
@@ -55,9 +56,9 @@
{{#each data.statistics as |statistic key|}}
- + - {{numberFormat statistic.x5 decimals=0 sign=false}} + ({{numberFormat statistic.x5 decimals=0 sign=false}}%)
{{/each}}
@@ -75,13 +76,20 @@ {{!-- Sheet Body --}}
- {{!-- Biography Tab --}} -
- {{editor content=data.physicalDescription target="data.physicalDescription" button=true owner=owner editable=editable}} + {{!-- Skills Tab --}} +
+
+ {{#each data.skills as |skill key|}} +
+ + +
+ {{/each}} +
{{!-- Owned Items Tab --}} -
+
  1. @@ -103,56 +111,9 @@
- {{!-- Owned Features Tab --}} -
-
    -
  1. -
    -
    Name
    - -
  2. - {{#each actor.features as |item id|}} -
  3. -
    -

    {{item.name}}

    -
    - - -
    -
  4. - {{/each}} -
-
- - {{!-- Owned Spells Tab --}} -
-
    -
  1. -
    -
    Name
    -
    -
  2. - {{#each actor.spells as |spells spellLevel|}} -
  3. -
    Level {{spellLevel}} Spells
    - -
  4. - {{#each spells as |item id|}} -
  5. -
    -

    {{item.name}}

    -
    - - -
    -
  6. - {{/each}} - {{/each}} -
+ {{!-- Description Tab --}} +
+ {{editor content=data.physicalDescription target="data.physicalDescription" button=true owner=owner editable=editable}}