From 4b34057ca7ec2a62e7bb1a2802aa987966bedd10 Mon Sep 17 00:00:00 2001 From: TheLastScrub <67403321+TheLastScrub@users.noreply.github.com> Date: Sun, 17 Sep 2023 17:01:25 -0700 Subject: [PATCH] changes to allow a 'custom' skill for item attacks --- css/deltagreen.css | 3 +- lang/ca.json | 6 +++- lang/en.json | 8 +++-- lang/es.json | 6 +++- lang/ja.json | 6 +++- lang/pt-BR.json | 4 ++- module/actor/actor-sheet.js | 49 ++++++++++++++++++++++++-- module/actor/actor.js | 4 +++ module/deltagreen.js | 3 ++ module/item/item-sheet.js | 2 +- template.json | 4 ++- templates/actor/actor-sheet.html | 14 ++++++-- templates/actor/npc-sheet.html | 17 +++++++-- templates/actor/unnatural-sheet.html | 12 ++++++- templates/item/item-weapon-sheet.html | 50 ++++++++++++++++++--------- 15 files changed, 152 insertions(+), 36 deletions(-) diff --git a/css/deltagreen.css b/css/deltagreen.css index dfef3ab..179d35a 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -752,7 +752,6 @@ div.motivation-editor-container div.editor{ background: none !important; } - .deltagreen .tox-editor-header { background: none !important; } @@ -945,7 +944,7 @@ input.item-sheet-short-input{ .weapon-sheet-horizontal-grid-left-2col{ display: grid; - grid-template-columns: 40% 60%; + grid-template-columns: 50% 50%; align-items: center; text-align: left; padding-bottom: 10px; diff --git a/lang/ca.json b/lang/ca.json index a45cc49..21d7753 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -249,5 +249,9 @@ "DG.Generic.CheckDamagedBondsBoxUntilNextHomeScene": "Check a damaged Bond's box until the next Home Scene ends.", "DG.Generic.ClearAll": "Clear All", - "DG.Generic.SanDamage": "SAN Damage" + "DG.Generic.SanDamage": "SAN Damage", + + "DG.ItemWindow.Weapons.CustomSkillTarget": "Target", + "DG.ItemWindow.Weapons.SkillModifier": "Skill Modifier", + "DG.ItemWindow.Custom": "Custom" } diff --git a/lang/en.json b/lang/en.json index c965e46..f657e95 100644 --- a/lang/en.json +++ b/lang/en.json @@ -253,7 +253,11 @@ "DG.VehicleSheet.DescriptionPlaceHolder": "Vehicle Description", "DG.Generic.CheckDamagedBondsBoxUntilNextHomeScene": "Check a damaged Bond's box until the next Home Scene ends.", - "DG.Generic.ClearAll": "Clear All", + "DG.Generic.ClearAll": "Clear Checks", - "DG.Generic.SanDamage": "SAN Damage" + "DG.Generic.SanDamage": "SAN Damage", + + "DG.ItemWindow.Weapons.CustomSkillTarget": "Target", + "DG.ItemWindow.Weapons.SkillModifier": "Skill Modifier", + "DG.ItemWindow.Custom": "Custom" } \ No newline at end of file diff --git a/lang/es.json b/lang/es.json index 7058442..c08d630 100644 --- a/lang/es.json +++ b/lang/es.json @@ -260,5 +260,9 @@ "DG.Generic.CheckDamagedBondsBoxUntilNextHomeScene": "Check a damaged Bond's box until the next Home Scene ends.", "DG.Generic.ClearAll": "Clear All", - "DG.Generic.SanDamage": "SAN Damage" + "DG.Generic.SanDamage": "SAN Damage", + + "DG.ItemWindow.Weapons.CustomSkillTarget": "Target", + "DG.ItemWindow.Weapons.SkillModifier": "Skill Modifier", + "DG.ItemWindow.Custom": "Custom" } \ No newline at end of file diff --git a/lang/ja.json b/lang/ja.json index 734f44e..126850d 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -249,5 +249,9 @@ "DG.Generic.CheckDamagedBondsBoxUntilNextHomeScene": "すぎのホーム・シーヌまで、傷つけた絆のボックスにチェクを", "DG.Generic.ClearAll": "全てのチェックを消す", - "DG.Generic.SanDamage": "SAN ダメージ" + "DG.Generic.SanDamage": "SAN ダメージ", + + "DG.ItemWindow.Weapons.CustomSkillTarget": "ターゲット", + "DG.ItemWindow.Weapons.SkillModifier": "ターゲットに加えて", + "DG.ItemWindow.Custom": "カスタム" } \ No newline at end of file diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 9bc9f38..70c1c77 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -215,5 +215,7 @@ "DG.Generic.CheckDamagedBondsBoxUntilNextHomeScene": "Check a damaged Bond's box until the next Home Scene ends.", "DG.Generic.ClearAll": "Clear All", - "DG.Generic.SanDamage": "SAN Damage" + "DG.Generic.SanDamage": "SAN Damage", + + "DG.Generic.Custom": "Custom" } \ No newline at end of file diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index bc1272d..b2dc931 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -577,6 +577,18 @@ export class DeltaGreenActorSheet extends ActorSheet { return this.actor.createEmbeddedDocuments("Item", [itemData]); } + _formatStringWithLeadingPlus(number){ + let s = ""; + + if(number > 0){ + s += "+" + } + + s += number.toString(); + + return s; + } + /** * Handle clickable rolls. * @param {Event} event The originating click event @@ -598,10 +610,22 @@ export class DeltaGreenActorSheet extends ActorSheet { let label = dataset.label ? `${dataset.label}` : ''; let targetVal = ""; let rollType = dataset.rolltype ? dataset.rolltype : ''; - + + //let customTarget = dataset.customtarget ? parseInt(dataset.customtarget, 10) : 50; + //let skillModifier = dataset.skillmodifier ? parseInt(dataset.skillmodifier, 10) : 0; // allow adding a fixed modifier, for example if a weapon has a scope + //let itemName = dataset.itemname ? `${dataset.itemname}` : ''; + + let itemId = dataset.iid; + let isDamageRoll = false; let isLethalityRoll = false; let isSanityDamageRoll = false; + + let item = this.actor.items.get(itemId); + + let customTarget = item.system.customSkillTarget; + let skillModifier = item.system.skillModifier; + let itemName = item.name; // if shift-click or right click, bring up roll editor dialog let requestedModifyRoll = (event && event.shiftKey || event.which === 3); //(event && (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)); @@ -609,14 +633,23 @@ export class DeltaGreenActorSheet extends ActorSheet { // check the 'data-target="something" property to determine how to grab the target for the roll if(rollType === "skill" || rollType === "typeskill"){ targetVal = dataset.target; + targetVal += skillModifier; label = game.i18n.localize(label).toUpperCase(); + + if(skillModifier !== 0){ + label += " (" + skillModifier.toString() + ")" + } } else if(rollType === "weaponskill"){ targetVal = dataset.target; + if(targetVal === "custom"){ + label = itemName.toUpperCase(); + targetVal = customTarget; + } // some weapons randomly can just use dexterity x5, so try to trap on that // otherwise roll a regular skill test - if(targetVal === "dex"){ + else if(targetVal === "dex"){ label = game.i18n.localize("DG.Attributes.dex").toUpperCase() + "x5"; targetVal = this.actor.system.statistics.dex.x5; } @@ -644,11 +677,21 @@ export class DeltaGreenActorSheet extends ActorSheet { label = game.i18n.localize("DG.Skills." + targetVal).toUpperCase(); targetVal = this.actor.system.skills[targetVal].proficiency; } + + targetVal += skillModifier; + if(skillModifier !== 0){ + label += " (" + this._formatStringWithLeadingPlus(skillModifier) + ")"; + } } else if(dataset.target === "statistic.x5"){ let stat = this.actor.system.statistics[key]; targetVal = stat.x5; label = game.i18n.localize("DG.Attributes." + key).toUpperCase() + "x5"; + + targetVal += skillModifier; + if(skillModifier !== 0){ + label += " (" + this._formatStringWithLeadingPlus(skillModifier) + ")"; + } } else if(rollType === "sanity"){ targetVal = this.actor.system.sanity.value; @@ -657,7 +700,7 @@ export class DeltaGreenActorSheet extends ActorSheet { else if(rollType === "damage"){ // damage roll, not a skill check isDamageRoll = true; - label = dataset.label ? dataset.label : ''; + label += " (" + this._formatStringWithLeadingPlus(skillModifier) + ")"; } else if(rollType === "lethality"){ // a lethality roll diff --git a/module/actor/actor.js b/module/actor/actor.js index 72dacd6..2efe8f9 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -73,6 +73,10 @@ export class DeltaGreenActor extends Actor { system.sanity.max = 99 - system.skills.unnatural.proficiency; + system.wp.max = system.statistics.pow.value; + + system.health.max = Math.ceil((system.statistics.con.value + system.statistics.str.value) / 2); + system.skills.ritual = { label: "Ritual", proficiency: 99 - system.sanity.value, diff --git a/module/deltagreen.js b/module/deltagreen.js index 7934099..9c90d1f 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -179,6 +179,9 @@ Hooks.once('init', async function() { if(skill === 'dex'){ label = game.i18n.localize("DG.Attributes.dex"); } + if(skill === 'DG.Skills.custom'){ + label = game.i18n.localize('DG.ItemWindow.Custom'); + } else{ label = game.i18n.localize("DG.Skills." + skill); } diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js index 277eb31..9cab3bd 100644 --- a/module/item/item-sheet.js +++ b/module/item/item-sheet.js @@ -9,7 +9,7 @@ export class DeltaGreenItemSheet extends ItemSheet { return mergeObject(super.defaultOptions, { classes: ["deltagreen", "sheet", "item"], width: 520, - height: 480, + height: 600, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "attributes" }] }); } diff --git a/template.json b/template.json index 9d14d92..a5af475 100644 --- a/template.json +++ b/template.json @@ -537,10 +537,12 @@ "base" ], "skill": "", + "skillModifier": 0, + "customSkillTarget": 50, "range": "10M", "damage": "1D8", "armorPiercing": 0, - "lethality": 0, + "lethality": 10, "isLethal": false, "killRadius": "N/A", "ammo": "", diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index cdf6078..60a25a4 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -321,11 +321,17 @@