From d18a690177bc7e2a571dbbcdde298e15c2488b3b Mon Sep 17 00:00:00 2001 From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com> Date: Sun, 4 Sep 2022 11:44:49 -0700 Subject: [PATCH] start work on v10 --- css/deltagreen.css | 2 +- module/actor/actor-sheet.js | 11 +- module/actor/actor.js | 30 +++- module/templates.js | 3 +- template.json | 16 +- templates/actor/vehicle-sheet.html | 274 +++++++++++++++++++++++++++++ 6 files changed, 326 insertions(+), 10 deletions(-) create mode 100644 templates/actor/vehicle-sheet.html diff --git a/css/deltagreen.css b/css/deltagreen.css index 2f581bb..f6e0f69 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -621,7 +621,7 @@ div.motivation-editor-container div.editor{ } .deltagreen .editor-host .editor { - min-height: 35px; + min-height: 50px; } .deltagreen .editor-host .tox { diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 4f195a5..71085ae 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -22,7 +22,7 @@ export class DeltaGreenActorSheet extends ActorSheet { get template() { if(this.actor !== null){ - if(this.actor.data.type === 'agent'){ + if(this.actor.type === 'agent'){ if ( !game.user.isGM && this.actor.limited ) { return "systems/deltagreen/templates/actor/limited-sheet.html"; } @@ -31,12 +31,15 @@ export class DeltaGreenActorSheet extends ActorSheet { return `systems/deltagreen/templates/actor/actor-sheet.html`; } } - else if(this.actor.data.type === 'unnatural'){ + else if(this.actor.type === 'unnatural'){ return `systems/deltagreen/templates/actor/unnatural-sheet.html`; } - else if(this.actor.data.type === 'npc'){ + else if(this.actor.type === 'npc'){ return `systems/deltagreen/templates/actor/npc-sheet.html`; } + else if(this.actor.type === 'vehicle'){ + return `systems/deltagreen/templates/actor/vehicle-sheet.html`; + } else{ return "systems/deltagreen/templates/actor/limited-sheet.html"; } @@ -51,7 +54,7 @@ export class DeltaGreenActorSheet extends ActorSheet { const data = super.getData(); // Prepare items. - if (this.actor.data.type == 'agent') { + if (this.actor.type == 'agent') { this._prepareCharacterItems(data); } diff --git a/module/actor/actor.js b/module/actor/actor.js index 4f240ff..66da155 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -10,9 +10,10 @@ export class DeltaGreenActor extends Actor { prepareData() { super.prepareData(); - const actorData = this.data; - const data = actorData.data; - const flags = actorData.flags; + const actorData = this; + //const actorData = this.data; + //const data = actorData.data; + //const flags = actorData.flags; //console.log('actor.js prepareData'); //console.log(this); @@ -28,12 +29,35 @@ export class DeltaGreenActor extends Actor { else if(actorData.type === 'npc'){ this._prepareNpcData(this); } + else if(actorData.type === 'vehicle'){ + this._prepareVehicleData(this); + } } /** * * @param {*} agent */ + + _prepareVehicleData(actor){ + let actorData = actor; + //const data = actorData.data; + + // calculate total armor rating + let protection = 0; + for (let i of actor.items) { + if (i.type === 'armor') { + if(i.data.data.equipped === true){ + protection += i.data.data.protection; + } + } + } + + actorData.system.health.protection = protection; + + console.log(actor); + } + _prepareNpcData(actor){ let actorData = actor.data; const data = actorData.data; diff --git a/module/templates.js b/module/templates.js index daa5c0b..41eedf4 100644 --- a/module/templates.js +++ b/module/templates.js @@ -11,6 +11,7 @@ export const preloadHandlebarsTemplates = async function() { "systems/deltagreen/templates/actor/unnatural-sheet.html", "systems/deltagreen/templates/actor/npc-sheet.html", "systems/deltagreen/templates/actor/cv-partial.html", - "systems/deltagreen/templates/dialog/modify-percentile-roll.html" + "systems/deltagreen/templates/dialog/modify-percentile-roll.html", + "systems/deltagreen/templates/actor/vehicle-sheet.html" ]); }; \ No newline at end of file diff --git a/template.json b/template.json index 4ef4c83..41dc998 100644 --- a/template.json +++ b/template.json @@ -3,7 +3,8 @@ "types": [ "agent", "unnatural", - "npc" + "npc", + "vehicle" ], "templates": { "base": { @@ -461,6 +462,19 @@ "shortDescription": "", "showUntrainedSkills": true }, + "vehicle":{ + "name": "", + "description": "", + "shortDescription": "", + "health": { + "value": 10, + "min": 0, + "max": 10 + }, + "speed": "", + "expense": "Standard", + "passengers": [] + }, "agent": { "templates": [ "base", diff --git a/templates/actor/vehicle-sheet.html b/templates/actor/vehicle-sheet.html new file mode 100644 index 0000000..aea7e65 --- /dev/null +++ b/templates/actor/vehicle-sheet.html @@ -0,0 +1,274 @@ +
+ + {{!-- Sheet Header --}} +
+ +
+ + {{!-- Name, Portrait --}} +
+ +
+
+

+
+
+

+
+
+
+ +
+ + {{!-- HP --}} +
+ +
+ + / + +
+
+
+ +
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ + {{!-- Descriptions --}} +
+
+ {{localize 'DG.UnnaturalSheet.NotesLabel'}} +
+
+
+ {{editor actor.system.notes target="system.notes" button=true owner=owner editable=editable}} +
+
+ +
+ + {{!-- GEAR --}} +
+
+ +
+ {{localize 'DG.Gear.Weapons'}} +
+ +
    + +
  1. +
    + {{localize 'DG.Gear.Name'}} + {{localize 'DG.Gear.DamageOrLethality'}} + {{localize 'DG.Gear.ArmorPiercing'}} + +
  2. + + {{#each actor.items as |item id|}} + {{#if_eq item.type 'weapon'}} + +
  3. +
    + +

    + {{item.name}} +

    + + {{#unless item.data.data.isLethal}} + + {{toUpperCase item.data.data.damage}} + {{/unless}} + + {{#if item.data.data.isLethal}} + {{formatLethality item.data.data.lethality}} + {{/if}} + + {{item.data.data.armorPiercing}} + +
    + + +
    + +
  4. + + {{/if_eq}} + {{/each}} +
+
+
+ +
+ {{localize 'DG.Gear.Armor'}} +
+ +
    +
  1. +
    +
    {{localize 'DG.Gear.Name'}}
    + {{localize 'DG.Gear.ArmorRating'}} + {{localize 'DG.Gear.Equipped'}} + +
  2. + + {{#each actor.items as |item id|}} + {{#if_eq item.type 'armor'}} + +
  3. +
    +

    {{item.name}}

    + {{item.data.data.protection}} + + + {{#if item.data.data.equipped}} + + {{else}} + + {{/if}} + + +
    + + +
    +
  4. + + {{/if_eq}} + {{/each}} + +
+
+
+ +
+ {{localize 'DG.Gear.OtherGear'}} +
+ +
    +
  1. +
    +
    {{localize 'DG.Gear.Name'}}
    +
    + {{localize 'DG.Gear.Equipped'}} + +
  2. + + {{#each actor.items as |item id|}} + {{#if_eq item.type 'gear'}} + +
  3. +
    + +

    {{item.name}}

    + + + + + + {{#if item.data.data.equipped}} + + {{else}} + + {{/if}} + + + +
    + + +
    +
  4. + + {{/if_eq}} + {{/each}} + +
+
+
+ + {{!-- About Tab --}} +
+
+ +
+
+
+ + {{localize 'DG.About.OnlineHelp'}} + +
+
+ + {{localize 'DG.About.OnlineBugTracker'}} + +
+
+ + CHANGELOG (ONLINE) + +
+
+
+ This is an unofficial fan work, it is not affiliated with or endorsed by Shaney Ivey or Arc Dream Publishing. +
+
+
+ Delta Green Community License (NONCOMMERCIAL) +

+ Published by arrangement with the Delta Green Partnership. + The intellectual property known as Delta Green is a trademark and copyright owned by the Delta Green Partnership, who has licensed its use here. +

+

+ The contents of this system are licensed per the terms of the included license file, excepting those elements that are components of the Delta Green intellectual property. +

+

+ Some content may additionally also be covered under the terms of the Open Game License (Copyright 2000 Wizards of the Coast, Inc.). +

+
+
+
+ +
+
+ + \ No newline at end of file