From 6f2cedc395e2047ab07c12a89ef818b52323ed26 Mon Sep 17 00:00:00 2001 From: Antho Date: Sun, 13 Jun 2021 14:20:06 -0400 Subject: [PATCH] Misc correction, difficult skills and add Focus --- lang/en.json | 28 ++++---- module/chat.js | 54 ++++++++------ module/sheets/WitcherActorSheet.js | 92 ++++++++++-------------- module/witcher.js | 5 +- styles/system-styles.css | 30 ++++++++ system.json | 2 +- templates/partials/character-header.html | 13 +++- templates/partials/chat/stat-chat.html | 2 +- templates/partials/tab-background.html | 14 +++- 9 files changed, 138 insertions(+), 102 deletions(-) diff --git a/lang/en.json b/lang/en.json index 1093c5c2..fe322ce4 100644 --- a/lang/en.json +++ b/lang/en.json @@ -84,7 +84,7 @@ "WITCHER.Actor.DerStat.HP": "Max HP", "WITCHER.Actor.DerStat.Sta": "STA", "WITCHER.Actor.DerStat.Resolve": "Resolve", - "WITCHER.Actor.DerStat.Focus": "FOCUS", + "WITCHER.Actor.DerStat.Focus": "Focus", "WITCHER.Actor.DerStat.Punch": "Punch", "WITCHER.Actor.DerStat.Kick": "Kick", @@ -92,13 +92,13 @@ "WITCHER.SkIntBusiness": "Business", "WITCHER.SkIntDeduction": "Deduction", "WITCHER.SkIntEducation": "Education", - "WITCHER.SkIntCommon": "Common Speech", - "WITCHER.SkIntElder": "Elder Speech", - "WITCHER.SkIntDwarven": "Dwarven", - "WITCHER.SkIntMonster": "Monster Lore", + "WITCHER.SkIntCommon": "Common Speech (2)", + "WITCHER.SkIntElder": "Elder Speech (2)", + "WITCHER.SkIntDwarven": "Dwarven (2)", + "WITCHER.SkIntMonster": "Monster Lore (2)", "WITCHER.SkIntSocialEt": "Social Etiquette", "WITCHER.SkIntStreet": "Streetwise", - "WITCHER.SkIntTactics": "Tactics", + "WITCHER.SkIntTactics": "Tactics (2)", "WITCHER.SkIntTeaching": "Teaching", "WITCHER.SkIntWilderness": "Wilderness Survival", @@ -131,21 +131,21 @@ "WITCHER.SkEmpPerformance": "Performance", "WITCHER.SkEmpSeduction": "Seduction", - "WITCHER.SkCraAlchemy": "Alchemy", - "WITCHER.SkCraCrafting": "Crafting", + "WITCHER.SkCraAlchemy": "Alchemy (2)", + "WITCHER.SkCraCrafting": "Crafting (2)", "WITCHER.SkCraDisguise": "Disguise", "WITCHER.SkCraAid": "First Aid", "WITCHER.SkCraForge": "Forgery", "WITCHER.SkCraPick": "Pick Lock", - "WITCHER.SkCraTrapCraft": "Trap Crafting", + "WITCHER.SkCraTrapCraft": "Trap Crafting (2)", "WITCHER.SkWillCourage": "Courage", - "WITCHER.SkWillHex": "Hex Weaving", + "WITCHER.SkWillHex": "Hex Weaving (2)", "WITCHER.SkWillIntim": "Intimidation", - "WITCHER.SkWillSpellcast": "Spell Casting", - "WITCHER.SkWillResistMag": "Resist Magic", + "WITCHER.SkWillSpellcast": "Spell Casting (2)", + "WITCHER.SkWillResistMag": "Resist Magic (2)", "WITCHER.SkWillResistCoer": "Resist Coercion", - "WITCHER.SkWillRitCraft": "Ritual Crafting", + "WITCHER.SkWillRitCraft": "Ritual Crafting (2)", "WITCHER.SocialStanding": "Social Standing", @@ -162,5 +162,5 @@ "WITCHER.LifeEvents": "Life Events", "WITCHER.Decade": "Decade", "WITCHER.Event": "Event", - "WITCHER.DeathSave": "Stun/Death" + "WITCHER.DeathSave": "Stun/Death Save" } \ No newline at end of file diff --git a/module/chat.js b/module/chat.js index 56c34c03..7da6417b 100644 --- a/module/chat.js +++ b/module/chat.js @@ -1,3 +1,5 @@ +import { getRandomInt } from "./witcher.js"; + export async function RollCustomMessage(rollResult, template, actor, extraData) { let templateContext = { ...extraData, @@ -23,29 +25,35 @@ export function addChatListeners(html){ function onDamage(event) { let messageData = {} console.log(event.currentTarget) + let img = event.currentTarget.getAttribute("data-img") + let name = event.currentTarget.getAttribute("data-name") + let damageFormula = event.currentTarget.getAttribute("data-dmg") + let location = event.currentTarget.getAttribute("data-location") + let strike = event.currentTarget.getAttribute("data-strike") + let effects = JSON.parse(event.currentTarget.getAttribute("data-effects")) - messageData.flavor = `

Damage: ${item.name}

`; + messageData.flavor = `

Damage: ${name}

`; - new Roll("1d10").roll().toMessage(messageData) - // if (strike == "strong") { - // damageFormula = `(${damageFormula})*2`; - // messageData.flavor += `
Strong Attack
`; - // } - // else if(strike == "fast"){ - // messageData.flavor += `
Fast Attack ${i + 1}
`; - // } - // messageData.flavor += `
Location: ${touchedLocation}
`; - // if (item.data.data.effects) { - // messageData.flavor += `Effects:`; - // item.data.data.effects.forEach(element => { - // messageData.flavor += `
${element.name}`; - // if (element.percentage) { - // let rollPercentage = getRandomInt(100); - // messageData.flavor += `
(${element.percentage}%) Rolled: ${rollPercentage}
`; - // } - // messageData.flavor += `
`; - // }); - // } - // console.log(damageFormula) - // new Roll(damageFormula).roll().toMessage(messageData) + if (strike == "strong") { + damageFormula = `(${damageFormula})*2`; + messageData.flavor += `
Strong Attack
`; + } + else if(strike == "fast"){ + messageData.flavor += `
Fast Attack ${i + 1}
`; + } + messageData.flavor += `
Location: ${location}
`; + console.log(effects) + if (effects) { + messageData.flavor += `Effects:`; + effects.forEach(element => { + messageData.flavor += `
${element.name}`; + if (element.percentage) { + let rollPercentage = getRandomInt(100); + messageData.flavor += `
(${element.percentage}%) Rolled: ${rollPercentage}
`; + } + messageData.flavor += `
`; + }); + } + console.log(damageFormula) + new Roll(damageFormula).roll().toMessage(messageData) } \ No newline at end of file diff --git a/module/sheets/WitcherActorSheet.js b/module/sheets/WitcherActorSheet.js index d7cc67a6..add16e3e 100644 --- a/module/sheets/WitcherActorSheet.js +++ b/module/sheets/WitcherActorSheet.js @@ -743,43 +743,41 @@ export default class WitcherActorSheet extends ActorSheet { if (item.data.data.isMelee){ attFormula += `+${this.actor.data.data.stats.ref.current}`; - switch(item.data.data.attackSkill){ - case "Brawling": - attFormula += `+${this.actor.data.data.skills.ref.brawling.value}`; - break; - case "Melee": - attFormula += `+${this.actor.data.data.skills.ref.melee.value}`; - break; - case "Small Blades": - attFormula += `+${this.actor.data.data.skills.ref.smallblades.value}`; - break; - case "Staff/Spear": - attFormula += `+${this.actor.data.data.skills.ref.staffspear.value}`; - break; - case "Swordsmanship": - attFormula += `+${this.actor.data.data.skills.ref.swordsmanship.value}`; - break; - } } else { attFormula += `+${this.actor.data.data.stats.dex.current}`; - switch(item.data.data.attackSkill){ - case "Archery": - attFormula += `+${this.actor.data.data.skills.dex.archery.value}`; - break; - case "Athletics": - attFormula += `+${this.actor.data.data.skills.dex.athletics.value}`; - break; - case "Crossbow": - attFormula += `+${this.actor.data.data.skills.dex.crossbow.value}`; - break; - } + } + + switch(item.data.data.attackSkill){ + case "Brawling": + attFormula += `+${this.actor.data.data.skills.ref.brawling.value}`; + break; + case "Melee": + attFormula += `+${this.actor.data.data.skills.ref.melee.value}`; + break; + case "Small Blades": + attFormula += `+${this.actor.data.data.skills.ref.smallblades.value}`; + break; + case "Staff/Spear": + attFormula += `+${this.actor.data.data.skills.ref.staffspear.value}`; + break; + case "Swordsmanship": + attFormula += `+${this.actor.data.data.skills.ref.swordsmanship.value}`; + break; + case "Archery": + attFormula += `+${this.actor.data.data.skills.dex.archery.value}`; + break; + case "Athletics": + attFormula += `+${this.actor.data.data.skills.dex.athletics.value}`; + break; + case "Crossbow": + attFormula += `+${this.actor.data.data.skills.dex.crossbow.value}`; + break; } if (customAtt != "0") { attFormula += "+"+customAtt; } - console.log(range) switch(range){ case "pointBlank": attFormula = `${attFormula}+5`; @@ -933,34 +931,10 @@ export default class WitcherActorSheet extends ActorSheet { break; } + let effects = JSON.stringify(item.data.data.effects) messageData.flavor = `

Attack: ${item.name}

`; - // messageData.flavor += ``; + messageData.flavor += ``; new Roll(attFormula).roll().toMessage(messageData) - - - messageData.flavor = `

Damage:${item.name}

`; - - if (strike == "strong") { - damageFormula = `(${damageFormula})*2`; - messageData.flavor += `
Strong Attack
`; - } - else if(strike == "fast"){ - messageData.flavor += `
Fast Attack ${i + 1}
`; - } - messageData.flavor += `
Location: ${touchedLocation}
`; - if (item.data.data.effects) { - messageData.flavor += `Effects:`; - item.data.data.effects.forEach(element => { - messageData.flavor += `
${element.name}`; - if (element.percentage) { - let rollPercentage = getRandomInt(100); - messageData.flavor += `
(${element.percentage}%) Rolled: ${rollPercentage}
`; - } - messageData.flavor += `
`; - }); - } - console.log(damageFormula) - new Roll(damageFormula).roll().toMessage(messageData) } } } @@ -1059,7 +1033,13 @@ export default class WitcherActorSheet extends ActorSheet { let totalSkills = 0; for (let element in data.data.skills) { for (let skill in data.data.skills[element]) { - totalSkills += data.data.skills[element][skill].value; + let skillLabel = game.i18n.localize(data.data.skills[element][skill].label) + if (skillLabel.includes("(2)")){ + totalSkills += data.data.skills[element][skill].value * 2; + } + else{ + totalSkills += data.data.skills[element][skill].value; + } } } return totalSkills; diff --git a/module/witcher.js b/module/witcher.js index bdf919cc..f0f74410 100644 --- a/module/witcher.js +++ b/module/witcher.js @@ -11,7 +11,7 @@ with the Hand to Hand Table, page 48 of Witcher TRPG Handbook. @param {Actor} actor - The actor passed in from actor-sheet.js to have its properties updated */ function updateDerived(actor){ - if (actor.data.data.customStats){ + if (actor.data.data.customStat === true){ return null; } let thisActor = actor; @@ -101,10 +101,12 @@ function updateDerived(actor){ } let newResolve = Math.floor((thisActor.data.data.stats.will.current + thisActor.data.data.stats.int.current)/2*5); + let newFocus = Math.floor((thisActor.data.data.stats.will.current + thisActor.data.data.stats.int.current)/2*3); thisActor.update({ 'data.derivedStats.hp.max': newHP, 'data.derivedStats.sta.max': newSta, 'data.derivedStats.resolve.max': newResolve, + 'data.derivedStats.focus.max': newFocus, 'data.coreStats.rec.value': newRec, 'data.coreStats.stun.value': newStun, 'data.coreStats.enc.value': newEnc, @@ -114,7 +116,6 @@ function updateDerived(actor){ 'data.attackStats.punch.value': `1d6+${pBonus}`, 'data.attackStats.kick.value': `1d6+${kBonus}`, }); - } function removeWoundTreshold(actor){ diff --git a/styles/system-styles.css b/styles/system-styles.css index 95551c8f..b3c87296 100644 --- a/styles/system-styles.css +++ b/styles/system-styles.css @@ -577,6 +577,32 @@ input.resolve-value:focus { } +.stat-focus{ + margin-left: 5px; + height: 50px; + width: 50px; + background-color: lightgray; + border-radius: 100%; + border:white solid 5px; +} + +input.stat-focus-value { + top: 5px; + position: relative; + border: none; + width: 40px; + background: none; + font-size: 25px; +} +input.stat-focus-value:focus { + border: none; +} +.stat-focus-max{ + position: relative; + left: 40px; +} + + .perk { margin:5px } @@ -660,4 +686,8 @@ input.luck-value { background-color: red; border-radius: 100%; border:white solid 5px; +} + +.spacer { + height: 55px; } \ No newline at end of file diff --git a/system.json b/system.json index 53691083..d16fe72b 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "TheWitcherTRPG", "title": "TheWitcherTRPG - fvtt", "description": "Many details here.", - "version": 0.15, + "version": 0.16, "author": "TechAntho", "scripts": [ ], diff --git a/templates/partials/character-header.html b/templates/partials/character-header.html index 1a752fc7..f334cc64 100644 --- a/templates/partials/character-header.html +++ b/templates/partials/character-header.html @@ -25,7 +25,7 @@ {{#each data.coreStats as |details coreStat|}}
- +
{{/each}}
@@ -109,7 +109,7 @@
- +
@@ -117,6 +117,15 @@ +
+ +
+ +
+ / + {{data.derivedStats.focus.max}} +
+
diff --git a/templates/partials/chat/stat-chat.html b/templates/partials/chat/stat-chat.html index 76ab6266..0f550567 100644 --- a/templates/partials/chat/stat-chat.html +++ b/templates/partials/chat/stat-chat.html @@ -1,4 +1,4 @@ -

{{localize statName}} Save

+

{{localize statName}}

To succeed you need to roll below {{difficulty}}
diff --git a/templates/partials/tab-background.html b/templates/partials/tab-background.html index 00d5fc86..c578f730 100644 --- a/templates/partials/tab-background.html +++ b/templates/partials/tab-background.html @@ -24,10 +24,18 @@

Crit Wounds

- WIP - {{#each data.critWounds as |crit value|}} + + Work In Progress +