From 1b13080d28ce6773cd3b6e81bd294533b3f5c14d Mon Sep 17 00:00:00 2001 From: Antho Date: Wed, 10 Nov 2021 00:34:56 -0500 Subject: [PATCH] Add silver and oil dmg. --- lang/en.json | 8 +++++- module/sheets/WitcherActorSheet.js | 2 +- scripts/actions.js | 42 ++++++++++++++++++++++++++---- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/lang/en.json b/lang/en.json index 785f48d0..b96dfab4 100644 --- a/lang/en.json +++ b/lang/en.json @@ -749,9 +749,15 @@ "WITCHER.Damage.totalSP": "Total Stopping Power", "WITCHER.Damage.afterSPReduct": "Damage after sp reducttion", "WITCHER.Damage.afterLocationModifier": "Damage after location modifier", - "WITCHER.Damage.afterResistances": "Damage after resistances", + "WITCHER.Damage.afterResistances": "Damage after resistances/vulnerabilities", "WITCHER.Damage.totalApplied": "Total Damage Applied", "WITCHER.Damage.NotEnough": "Not enough damage to pierce the armor", + "WITCHER.Damage.isVulnerable": "Vulnerable to the attack", + "WITCHER.Damage.oilDmg": "Add Oil Damages (+5)", + "WITCHER.Damage.silverDmg": "Add Silver Damages", + "WITCHER.Damage.silver": "Silver", + "WITCHER.Damage.oil": "Oil", + "WITCHER.Context.applyDmg": "Apply Damage", "WITCHER.Context.Defense": "Defense", diff --git a/module/sheets/WitcherActorSheet.js b/module/sheets/WitcherActorSheet.js index 53b304f0..2e5b5770 100644 --- a/module/sheets/WitcherActorSheet.js +++ b/module/sheets/WitcherActorSheet.js @@ -1172,7 +1172,7 @@ export default class WitcherActorSheet extends ActorSheet {
${game.i18n.localize("WITCHER.Heal.resting")}
-
${game.i18n.localize("WITCHER.Heal.sterilized")}
+
${game.i18n.localize("WITCHER.Heal.sterilized")}
${game.i18n.localize("WITCHER.Heal.healinghand")}
diff --git a/scripts/actions.js b/scripts/actions.js index 354028ff..f3cea4e8 100644 --- a/scripts/actions.js +++ b/scripts/actions.js @@ -26,6 +26,14 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ + `; + const silverOptions = ` + + + + + + `; let content = `
@@ -33,14 +41,22 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ if (actor.type == "monster"){ content += `
- ` +
` } + content += `
+
+
` let cancel = true let damageType = 0 let resistSilver = false; let resistMeteorite = false; let newLocation = false; + let isVulnerable = false; + let addOilDmg = false; + let silverDmg; + + let infoTotalDmg = totalDamage let dialogData = { buttons : [ @@ -50,16 +66,31 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ newLocation = html.find("[name=changeLocation]")[0].value; resistSilver = html.find("[name=resistNonSilver]").prop("checked"); resistMeteorite = html.find("[name=resistNonMeteorite]").prop("checked"); + isVulnerable = html.find("[name=vulnerable]").prop("checked"); + addOilDmg = html.find("[name=oilDmg]").prop("checked"); + silverDmg = html.find("[name=silverDmg]")[0].value; cancel = false } ]], - title : game.i18n.localize("WITCHER.Items.transferTitle"), + title : game.i18n.localize("WITCHER.Context.applyDmg"), content : content } await buttonDialog(dialogData) + if (silverDmg){ + let silverRoll = new Roll(silverDmg).roll() + totalDamage = Number(totalDamage) + silverRoll.total + infoTotalDmg += `+${silverRoll.total}[${game.i18n.localize("WITCHER.Damage.silver")}]` + } + if (newLocation != "Empty"){ location = newLocation } + if (addOilDmg){ + totalDamage = Number(totalDamage) + 5 + infoTotalDmg += `+5[${game.i18n.localize("WITCHER.Damage.oil")}]` + } + + infoTotalDmg = totalDamage +": " +infoTotalDmg; let armorSet = {}; let totalSP = 0 @@ -72,7 +103,6 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ values = getArmorSp(armorSet["lightArmor"]?.data.data.headStopping, armorSet["mediumArmor"]?.data.data.headStopping, armorSet["heavyArmor"]?.data.data.headStopping) displaySP = values[0] totalSP = values[1] - console.log(values) break; case "Torso": armorSet = getArmors(torsoAmors) @@ -141,7 +171,6 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ return } - let infoTotalDmg = totalDamage totalDamage -= totalSP < 0 ? 0: totalSP; let infoAfterSPReduction = totalDamage < 0 ? 0: totalDamage @@ -149,6 +178,7 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ if (cancel) { return } + if (totalDamage <=0){ let messageContent = `${game.i18n.localize("WITCHER.Damage.initial")}: ${infoTotalDmg}
${game.i18n.localize("WITCHER.Damage.totalSP")}: ${displaySP}
@@ -193,7 +223,9 @@ async function ApplyDamage(actor, dmgType, location, totalDamage){ if (resistSilver || resistMeteorite) { totalDamage *= 0.5 } - + if (isVulnerable) { + totalDamage *= 2 + } let infoAfterResistance = totalDamage switch(location){