From 40ab57e4d930f43675f027d17b975fa7f65c3e5d Mon Sep 17 00:00:00 2001 From: Stexinator Date: Mon, 23 Jan 2023 13:46:05 +0100 Subject: [PATCH] [TheWitcher] add crit location button --- TheWitcher/witchersheet.css | 9 ++ TheWitcher/witchersheet.html | 255 +++++++++++++++++++++++++---------- 2 files changed, 194 insertions(+), 70 deletions(-) diff --git a/TheWitcher/witchersheet.css b/TheWitcher/witchersheet.css index 2e6c8efbac..b8886fd0f8 100644 --- a/TheWitcher/witchersheet.css +++ b/TheWitcher/witchersheet.css @@ -6803,6 +6803,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-saveroll table, .sheet-rolltemplate-target table, .sheet-rolltemplate-humanlocation table, +.sheet-rolltemplate-critlocation table, .sheet-rolltemplate-monsterlocation table, .sheet-rolltemplate-fumble table, .sheet-rolltemplate-save table, @@ -6833,6 +6834,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-saveroll th, .sheet-rolltemplate-target th, .sheet-rolltemplate-humanlocation th, +.sheet-rolltemplate-critlocation th, .sheet-rolltemplate-monsterlocation th, .sheet-rolltemplate-fumble th, .sheet-rolltemplate-save th, @@ -6864,6 +6866,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-saveroll .userscript-template-title, .sheet-rolltemplate-target .userscript-template-title, .sheet-rolltemplate-humanlocation .userscript-template-title, +.sheet-rolltemplate-critlocation .userscript-template-title, .sheet-rolltemplate-monsterlocation .userscript-template-title, .sheet-rolltemplate-fumble .userscript-template-title, .sheet-rolltemplate-save .userscript-template-title, @@ -6890,6 +6893,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-saveroll td, .sheet-rolltemplate-target td, .sheet-rolltemplate-humanlocation td, +.sheet-rolltemplate-critlocation td, .sheet-rolltemplate-monsterlocation td, .sheet-rolltemplate-fumble td, .sheet-rolltemplate-save td, @@ -6917,6 +6921,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-saveroll .inlinerollresult, .sheet-rolltemplate-target .inlinerollresult, .sheet-rolltemplate-humanlocation .inlinerollresult, +.sheet-rolltemplate-critlocation .inlinerollresult, .sheet-rolltemplate-monsterlocation .inlinerollresult, .sheet-rolltemplate-fumble .inlinerollresult, .sheet-rolltemplate-save .inlinerollresult, @@ -6976,18 +6981,21 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-target th, .sheet-rolltemplate-humanlocation th, +.sheet-rolltemplate-critlocation th, .sheet-rolltemplate-monsterlocation th { background-color: #546696; } .sheet-rolltemplate-target tr:nth-child(odd), .sheet-rolltemplate-humanlocation tr:nth-child(odd), +.sheet-rolltemplate-critlocation tr:nth-child(odd), .sheet-rolltemplate-monsterlocation tr:nth-child(odd) { background-color: #b1b4d8; } .sheet-rolltemplate-target tr:nth-child(even), .sheet-rolltemplate-humanlocation tr:nth-child(even), +.sheet-rolltemplate-critlocation tr:nth-child(even), .sheet-rolltemplate-monsterlocation tr:nth-child(even) { background-color: #e0e0e0; } @@ -7217,6 +7225,7 @@ button[type=action].defense_skill_roll:active { .sheet-rolltemplate-npcdefense .sheet-rolltemplate-calculation .inlinerollresult, .sheet-rolltemplate-humanlocation .sheet-rolltemplate-calculation .inlinerollresult, +.sheet-rolltemplate-critlocation .sheet-rolltemplate-calculation .inlinerollresult, .sheet-rolltemplate-monsterlocation .sheet-rolltemplate-calculation .inlinerollresult { border: none; background-color: inherit; diff --git a/TheWitcher/witchersheet.html b/TheWitcher/witchersheet.html index b5d4694a11..36bc76e9be 100644 --- a/TheWitcher/witchersheet.html +++ b/TheWitcher/witchersheet.html @@ -3905,6 +3905,7 @@ + @@ -4706,7 +4707,7 @@ on('clicked:monsterlocation', async (ev) => { let passin = rollEscape.unescape(ev.originalRollId); console.log(passin); - let rollBase = `@{whisper}&{template:monsterlocation} {{title=TARGET LOCATION}} {{name=@{character_name}}} {{roll=[[1d10]]}}{{attackmultiplier=[[0]]}}{{weapondmg=[[0]]}}{{afterArmor=[[0]]}}{{locationmultiplier=[[0]]}}{{armor=[[0]]}}{{damage=[[0]]}}{{critdmg=[[0]]}}{{weapon_effect=${passin.weapon_effect}}}` + let rollBase = `@{whisper}&{template:monsterlocation} {{title=TARGET LOCATION}} {{name=@{character_name}}} {{roll=[[1d10]]}}{{attackmultiplier=[[0]]}}{{weapondmg=[[0[WEAPON]]]}}{{afterArmor=[[0]]}}{{locationmultiplier=[[0[LOCATION]]]}}{{armor=[[0[ARMOR]]]}}{{damage=[[0[TOTAL]]]}}{{critdmg=[[0[CRIT]]]}}{{weapon_effect=${passin.weapon_effect}}}` let rollResult = await startRoll(rollBase); console.log(rollResult); @@ -4746,7 +4747,7 @@ on('clicked:humanlocation', async (ev) => { let passin = rollEscape.unescape(ev.originalRollId); console.log(passin); - let rollBase = `@{whisper}&{template:humanlocation} {{title=TARGET LOCATION}} {{name=@{character_name}}} {{roll=[[1d10]]}}{{attackmultiplier=[[0]]}}{{weapondmg=[[0]]}}{{afterArmor=[[0]]}}{{locationmultiplier=[[0]]}}{{armor=[[0]]}}{{damage=[[0]]}}{{critdmg=[[0]]}}{{weapon_effect=${passin.weapon_effect}}}` + let rollBase = `@{whisper}&{template:humanlocation} {{title=TARGET LOCATION}} {{name=@{character_name}}} {{roll=[[1d10]]}}{{attackmultiplier=[[0]]}}{{weapondmg=[[0[WEAPON]]]}}{{afterArmor=[[0]]}}{{locationmultiplier=[[0[LOCATION]]]}}{{armor=[[0[ARMOR]]]}}{{damage=[[0[TOTAL]]]}}{{critdmg=[[0[CRIT]]]}}{{weapon_effect=${passin.weapon_effect}}}` let rollResult = await startRoll(rollBase); console.log(rollResult); @@ -4782,6 +4783,46 @@ on('clicked:humanlocation', async (ev) => { }); +on('clicked:critlocation', async (ev) => { + let passin = rollEscape.unescape(ev.originalRollId); + console.log(passin); + + let rollBase = `@{whisper}&{template:critlocation} {{title=TARGET LOCATION}} {{name=@{character_name}}} {{roll=[[2d6]]}}{{attackmultiplier=[[0]]}}{{weapondmg=[[0[WEAPON]]]}}{{afterArmor=[[0]]}}{{locationmultiplier=[[0[LOCATION]]]}}{{armor=[[0[ARMOR]]]}}{{damage=[[0[TOTAL]]]}}{{critdmg=[[0[CRIT]]]}}{{weapon_effect=${passin.weapon_effect}}}` + let rollResult = await startRoll(rollBase); + + console.log(rollResult); + var location = rollResult.results.roll.result; + + let locationmultiplier = 1; + if(location === 12 || location === 11) { + locationmultiplier = 3; + } + else if(location > 5 && location < 11) { + locationmultiplier = 1; + } + else if(location > 6) { + locationmultiplier = 0.5; + } + + + //(attack multiplicator x rolled dmg - SP) * location * resistance + bonus crit damage + let damage = passin.afterArmor * locationmultiplier + passin.critdmg; + + finishRoll( + rollResult.rollId, + { + attackmultiplier: passin.attackmultiplier, + locationmultiplier: locationmultiplier, + weapondmg: passin.weapondmg, + critdmg: passin.critdmg, + armor: passin.armor, + afterArmor: passin.afterArmor, + damage: damage + } + ); + +}); + ////////////////////////////// // Weapon Template Attacks // @@ -5651,86 +5692,29 @@ const asw = (() => { {{/rollGreater() computed::hit 0}} {{#rollGreater() computed::hit 0}} +
{{#^rollTotal() computed::rolllocation 0}} + {{#^rollGreater() computed::critdmg 0}}
[Location(Monster)](~{{name}}|monsterlocation||{{computed::passthrough}})
[Location(Humanoid)](~{{name}}|humanlocation||{{computed::passthrough}})
+ {{/^rollGreater() computed::critdmg 0}} + {{#rollGreater() computed::critdmg 0}} +
+ [Location(Crit)](~{{name}}|critlocation||{{computed::passthrough}}) +
+ {{/rollGreater() computed::critdmg 0}} {{/^rollTotal() computed::rolllocation 0}}
+ + {{/rollGreater() computed::hit 0}} - - - - - - - - - {{#rollTotal() roll 1}}{{/rollTotal() roll 1}} - {{#rollBetween() roll 2 5}}{{/rollBetween() roll 2 5}} - {{#rollBetween() roll 6 7}}{{/rollBetween() roll 6 7}} - {{#rollBetween() roll 8 9}}{{/rollBetween() roll 8 9}} - {{#rollTotal() roll 10}}{{/rollTotal() roll 10}} - - - - {{#computed::damage}} - - - - {{/computed::damage}} - {{#weapon_effect}} - - - - {{/weapon_effect}} -
{{title}}
NAME: {{name}}
HEAD: If successful, your attack will deal x3 damage.
TORSO (MONSTER): If successful, your attack will deal standard damage.
RIGHT LIMB (MONSTER): If successful, your attack will deal half damage.
LEFT LIMB (MONSTER): If successful, your attack will deal half damage.
WING/TAIL (MONSTER): If successful, your attack will deal half damage.
TARGET LOCATION: {{roll}}
- DAMAGE: ({{#^rollTotal() computed::attackmultiplier 1}}{{computed::attackmultiplier}} x {{/^rollTotal() computed::attackmultiplier 1}}{{computed::weapondmg}} - {{computed::armor}}) = {{computed::afterArmor}} x {{computed::locationmultiplier}} + {{computed::critdmg}} ={{computed::damage}} -
- EFFECT: {{weapon_effect}} -
-
- - - - - - - - - - {{#rollTotal() roll 1}}{{/rollTotal() roll 1}} - {{#rollBetween() roll 2 4}}{{/rollBetween() roll 2 4}} - {{#rollTotal() roll 5}}{{/rollTotal() roll 5}} - {{#rollTotal() roll 6}}{{/rollTotal() roll 6}} - {{#rollBetween() roll 7 8}}{{/rollBetween() roll 7 8}} - {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} - - - - {{#computed::damage}} - - - - {{/computed::damage}} - {{#weapon_effect}} - - - - {{/weapon_effect}} -
{{title}}
NAME: {{name}}
HEAD: If successful, your attack will deal x3 damage.
TORSO (HUMANOID): If successful, your attack will deal standard damage.
RIGHT ARM (HUMANOID): If successful, your attack will deal half damage.
LEFT ARM (HUMANOID): If successful, your attack will deal half damage.
RIGHT LEG (HUMANOID): If successful, your attack will deal half damage.
LEFT LEG (HUMANOID): If successful, your attack will deal half damage.
TARGET LOCATION: {{roll}}
- DAMAGE: ({{#^rollTotal() computed::attackmultiplier 1}}{{computed::attackmultiplier}} x {{/^rollTotal() computed::attackmultiplier 1}}{{computed::weapondmg}} - {{computed::armor}}) = {{computed::afterArmor}} x {{computed::locationmultiplier}} + {{computed::critdmg}} ={{computed::damage}} -
- EFFECT: {{weapon_effect}} -
-
- @@ -5797,4 +5781,135 @@ const asw = (() => { {{/^rollWasCrit() roll}} {{/rollWasFumble() roll}} - \ No newline at end of file + + + + + + + + + + + + {{#rollTotal() roll 1}}{{/rollTotal() roll 1}} + {{#rollBetween() roll 2 5}}{{/rollBetween() roll 2 5}} + {{#rollBetween() roll 6 7}}{{/rollBetween() roll 6 7}} + {{#rollBetween() roll 8 9}}{{/rollBetween() roll 8 9}} + {{#rollTotal() roll 10}}{{/rollTotal() roll 10}} + + + + {{#computed::damage}} + + + + {{/computed::damage}} + {{#weapon_effect}} + + + + {{/weapon_effect}} +
{{title}}
NAME: {{name}}
HEAD: If successful, your attack will deal x3 damage.
TORSO (MONSTER): If successful, your attack will deal standard damage.
RIGHT LIMB (MONSTER): If successful, your attack will deal half damage.
LEFT LIMB (MONSTER): If successful, your attack will deal half damage.
WING/TAIL (MONSTER): If successful, your attack will deal half damage.
TARGET LOCATION: {{roll}}
+ DAMAGE: ({{#^rollTotal() computed::attackmultiplier 1}}{{computed::attackmultiplier}} x {{/^rollTotal() computed::attackmultiplier 1}}{{computed::weapondmg}} - {{computed::armor}}) = {{computed::afterArmor}} x {{computed::locationmultiplier}} + {{computed::critdmg}} ={{computed::damage}} +
+ EFFECT: {{weapon_effect}} +
+
+ + + + + + + + + + {{#rollTotal() roll 1}}{{/rollTotal() roll 1}} + {{#rollBetween() roll 2 4}}{{/rollBetween() roll 2 4}} + {{#rollTotal() roll 5}}{{/rollTotal() roll 5}} + {{#rollTotal() roll 6}}{{/rollTotal() roll 6}} + {{#rollBetween() roll 7 8}}{{/rollBetween() roll 7 8}} + {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} + + + + {{#computed::damage}} + + + + {{/computed::damage}} + {{#weapon_effect}} + + + + {{/weapon_effect}} +
{{title}}
NAME: {{name}}
HEAD: If successful, your attack will deal x3 damage.
TORSO (HUMANOID): If successful, your attack will deal standard damage.
RIGHT ARM (HUMANOID): If successful, your attack will deal half damage.
LEFT ARM (HUMANOID): If successful, your attack will deal half damage.
RIGHT LEG (HUMANOID): If successful, your attack will deal half damage.
LEFT LEG (HUMANOID): If successful, your attack will deal half damage.
TARGET LOCATION: {{roll}}
+ DAMAGE: ({{#^rollTotal() computed::attackmultiplier 1}}{{computed::attackmultiplier}} x {{/^rollTotal() computed::attackmultiplier 1}}{{computed::weapondmg}} - {{computed::armor}}) = {{computed::afterArmor}} x {{computed::locationmultiplier}} + {{computed::critdmg}} ={{computed::damage}} +
+ EFFECT: {{weapon_effect}} +
+
+ + + + + + + + + + {{#rollTotal() computed::critdmg 3}} + {{#rollBetween() roll 2 3}}{{/rollBetween() roll 2 3}} + {{#rollBetween() roll 4 5}}{{/rollBetween() roll 4 5}} + {{#rollBetween() roll 6 8}}{{/rollBetween() roll 6 8}} + {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} + {{#rollTotal() roll 11}}{{/rollTotal() roll 11}} + {{#rollTotal() roll 12}}{{/rollTotal() roll 12}} + {{/rollTotal() computed::critdmg 3}} + + {{#rollTotal() computed::critdmg 5}} + {{#rollBetween() roll 2 3}}{{/rollBetween() roll 2 3}} + {{#rollBetween() roll 4 5}}{{/rollBetween() roll 4 5}} + {{#rollBetween() roll 6 8}}{{/rollBetween() roll 6 8}} + {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} + {{#rollTotal() roll 11}}{{/rollTotal() roll 11}} + {{#rollTotal() roll 12}}{{/rollTotal() roll 12}} + {{/rollTotal() computed::critdmg 5}} + + {{#rollTotal() computed::critdmg 8}} + {{#rollBetween() roll 2 3}}{{/rollBetween() roll 2 3}} + {{#rollBetween() roll 4 5}}{{/rollBetween() roll 4 5}} + {{#rollBetween() roll 6 8}}{{/rollBetween() roll 6 8}} + {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} + {{#rollTotal() roll 11}}{{/rollTotal() roll 11}} + {{#rollTotal() roll 12}}{{/rollTotal() roll 12}} + {{/rollTotal() computed::critdmg 8}} + + {{#rollTotal() computed::critdmg 10}} + {{#rollBetween() roll 2 3}}{{/rollBetween() roll 2 3}} + {{#rollBetween() roll 4 5}}{{/rollBetween() roll 4 5}} + {{#rollBetween() roll 6 8}}{{/rollBetween() roll 6 8}} + {{#rollBetween() roll 9 10}}{{/rollBetween() roll 9 10}} + {{#rollTotal() roll 11}}{{/rollTotal() roll 11}} + {{#rollTotal() roll 12}}{{/rollTotal() roll 12}} + {{/rollTotal() computed::critdmg 10}} + + + + {{#computed::damage}} + + + + {{/computed::damage}} + {{#weapon_effect}} + + + + {{/weapon_effect}} +
{{title}}
NAME: {{name}}
SPRAINED LEG: -2 SPD, Dodge, Escape, Athletics
SPRAINED ARM: -2 to actions with this arm
FOREIGN OBJECT (TORSO): Recovery and Critical Healing are quartered
CRACKED RIBS (TORSO): -2 BODY, does not affect Health Points
DISFIGURING SCAR (HEAD): -3 empathic Verbal Combat
CRACKED JAW (HEAD): -2 Magical Skills, Verbal Combat
FRACTURED LEG: -3 SPD, Dodge, Escape, Athletics
FRACTURED ARM: -3 to actions with this arm
BROKEN RIBS (TORSO): -2 BODY; -1 REF/DEX
RUPTURED SPLEEN (TORSO): Stun save every 5 rounds; bleeding
LOST TEETH (HEAD): [[1d10]] teeth; -3 magical skills; verbal combat
MINOR HEAD WOUND (HEAD): -1 to INT, WILL, STUN
COMPOUND LEG FRACTURE: leg useless, quarter SPD Dodge/Escape Atheletics; bleeding
COMPOUND ARM FRACTURE: arm useless; bleeding
SUCKING CHEST WOUND (TORSO): -3 BODY,SPD; suffocating
TORN STOMACH (TORSO): -2 to all action; 4 acid damage per round
CONCUSSION (HEAD): all [[1d6]] rounds stun save; -2 INT/REF/DEX
SKULL FRACTURE (HEAD): bleeding; -1 INT/DEX; 4x head damage
DISMEMBERED LEG: leg useless; quarter SPD Dodge/Escape Atheletics; bleeding
DISMEMBERED ARM: arm useless; bleeding
SEPTIC SHOCK (TORSO): -3 INT, WILL, REF, DEX; poisoned
HEART DAMAGE (TORSO): quarter Stamina, SPD, BODY; bleeding
DAMAGED EYE (HEAD): -5 sight based Awareness; -4 DEX; bleeding
SEPARATED SPINE/DECAPITATED (HEAD): You are dead
TARGET LOCATION: {{roll}}
+ DAMAGE: ({{#^rollTotal() computed::attackmultiplier 1}}{{computed::attackmultiplier}} x {{/^rollTotal() computed::attackmultiplier 1}}{{computed::weapondmg}} - {{computed::armor}}) = {{computed::afterArmor}} x {{computed::locationmultiplier}} + {{computed::critdmg}} ={{computed::damage}} +
+ EFFECT: {{weapon_effect}} +
+