[TheWitcher] add quick strike and wolf school strong strike to weapon template

This commit is contained in:
Stexinator
2023-01-05 15:05:22 +01:00
parent 32ab9a4b37
commit dcf786d67c
3 changed files with 95 additions and 21 deletions
+4
View File
@@ -297,6 +297,10 @@
"show-fastattacks-u": "Show fast attacks",
"show-strongattacks-u": "Show strong attacks",
"show-jointattacks-u": "Show joint attacks",
"profession-u": "PROFESSIONS",
"witcher-u": "WITCHER",
"show-wolfStrike": "Show Wolf School Strong Srike",
"show-quickStrike": "Show Quick Strike (Red Tree)",
"character-u": "CHARACTER",
"show-magic-and-spells": "Show magic and spell tab",
"use-pc-defense-bases": "Show defense bases",
+4
View File
@@ -5913,6 +5913,10 @@ summary.settings-caption {
text-decoration-line: underline;
}
.subsetting {
margin-left: 10px;
}
/* ROLL BUTTONS */
/* stats */
+87 -21
View File
@@ -3486,6 +3486,25 @@
</label>
</div>
</details>
<br>
<details>
<summary class="settings-caption" data-i18n="profession-u">Profession</summary>
<div>
<details class="subsetting">
<summary class="settings-caption" data-i18n="witcher-u">Witcher</summary>
<div>
<label for="showWolfStrike" class="settings-checkbox" title='During character creation, some skills cost extra points.&#10;Checking this will these extra points towards your skill total.'>
<span data-i18n="show-wolfStrike">Show Wolf School Strong Srike</span>
<input id="showWolfStrike" name="attr_showWolfStrike" type="checkbox" value="1"/>
</label>
<label for="showQuickStrike" class="settings-checkbox" title='Show checkboxes so used skills can be tracked'>
<span data-i18n="show-quickStrike">Show Quick Strike (Red Tree)</span>
<input id="showQuickStrike" name="attr_showQuickStrike" type="checkbox"/>
</label>
</div>
</details>
</div>
</details>
</div>
</div>
</div>
@@ -3855,8 +3874,10 @@
<!-- Buttons used for reaction rolls-->
<div class="hidden-section" style="display:none">
<button type="action" name="act_templatesinglestrike"></button>
<button type="action" name="act_templatequickstrike"></button>
<button type="action" name="act_templatefastattack"></button>
<button type="action" name="act_templatestrongattack"></button>
<button type="action" name="act_templatewolfstrike"></button>
<button type="action" name="act_templatejointmeleeattack"></button>
<button type="action" name="act_templatejointrangedattack"></button>
@@ -4845,7 +4866,7 @@ on('clicked:humanlocation', async (ev) => {
//////////////////////////////
on('clicked:primaryweapon clicked:secondaryweapon clicked:thirdweapon clicked:fourthweapon clicked:fifthweapon clicked:sixthweapon clicked:shield clicked:punch clicked:kick', async (event) => {
let rollBase = event.htmlAttributes.value + "{{singlestrike=[[0]]}}{{faststrike=[[0]]}}{{strongstrike=[[0]]}}{{jointmeleeattack=[[0]]}}{{jointrangedattack=[[0]]}}{{passthrough=[[0]]}}";
let rollBase = event.htmlAttributes.value + "{{singlestrike=[[0]]}}{{faststrike=[[0]]}}{{strongstrike=[[0]]}}{{jointmeleeattack=[[0]]}}{{jointrangedattack=[[0]]}}{{wolfstrike=[[0]]}}{{quickstrike=[[0]]}}{{passthrough=[[0]]}}";
let rollResult = await startRoll(rollBase);
let computedValues = await resolveChecks(
@@ -4875,17 +4896,11 @@ const calculateTemplateButtons = async (rollBase) => {
}
var weaponskill = rollBase.substring(rollBase.indexOf("skill="), rollBase.indexOf("weapon_skill")+13).replace("skill=@{", "").replace("}","");
let attrs = await asw.getAttrs([weaponskill, 'showSingleStrike', 'showFastAttacks', 'showStrongAttacks', 'showJointAttacks']);
let attrs = await asw.getAttrs([weaponskill, 'showSingleStrike', 'showFastAttacks', 'showStrongAttacks', 'showJointAttacks', 'showWolfStrike', 'showQuickStrike']);
let skill = attrs[weaponskill];
var singlestrike = 0;
var faststrike = 0;
var strongstrike = 0;
var jointmeleeattack = 0;
var jointrangedattack = 0;
var results = {};
if(
(skill.includes("archery") ||
@@ -4893,13 +4908,13 @@ const calculateTemplateButtons = async (rollBase) => {
skill.includes("athletics"))
&& attrs['showSingleStrike'] != 0
) {
singlestrike = 1
results.singlestrike = 1
}
if(
skill.includes("crossbow") && attrs['showJointAttacks'] != 0
) {
jointrangedattack = 1
results.jointrangedattack = 1
}
if(
@@ -4910,7 +4925,7 @@ const calculateTemplateButtons = async (rollBase) => {
skill.includes("swordsmanship"))
&& attrs['showFastAttacks'] != 0
) {
faststrike = 1
results.faststrike = 1
}
if(
@@ -4922,7 +4937,19 @@ const calculateTemplateButtons = async (rollBase) => {
skill.includes("archery"))
&& attrs['showStrongAttacks'] != 0
) {
strongstrike = 1
results.strongstrike = 1
}
if(
(skill.includes("brawling") ||
skill.includes("melee") ||
skill.includes("small_blades") ||
skill.includes("staff_spear") ||
skill.includes("swordsmanship") ||
skill.includes("archery"))
&& attrs['showWolfStrike'] != 0
) {
results.wolfstrike = 1
}
if(
@@ -4932,16 +4959,15 @@ const calculateTemplateButtons = async (rollBase) => {
skill.includes("swordsmanship"))
&& attrs['showJointAttacks'] != 0
) {
jointmeleeattack = 1
results.jointmeleeattack = 1
}
if(
attrs['showQuickStrike'] != 0
) {
results.quickstrike = 1
}
let results = {
singlestrike: singlestrike,
faststrike: faststrike,
strongstrike: strongstrike,
jointmeleeattack: jointmeleeattack,
jointrangedattack: jointrangedattack
};
return results;
}
@@ -4959,6 +4985,20 @@ on('clicked:templatesinglestrike', async (ev) => {
doTemplateAttack(passin, rollBase);
});
on('clicked:templatequickstrike', async (ev) => {
// The data we passed into the button will be stored in the originalRollId key
let passin = rollEscape.unescape(ev.originalRollId);
let skill_attribute = passin.skill;
let weaponname = passin.weapon_name;
let weaponwa = passin.weapon_wa;
let skill = (await asw.getAttrs([skill_attribute]))[skill_attribute];
let attrs = await asw.getAttrs([weaponname, weaponwa, skill]);
let rollBase = `@{whisper}&{template:weaponattack} {{title=${attrs[weaponname]}}} {{name=@{character_name}}} {{roll=[[1d10!+${attrs[skill]}[SKILLBASE]+0[SINGLE STRIKE]+${attrs[weaponwa]}[WEAP. ACC]?{TARGET LOCATION|Random,+0|Head,-6|Torso,-1|Arm/Limb,-3|Leg/Tail/Wing,-2}[LOCATION]+?{ADDITIONAL MODS? (Bright Light, No Vision, Terrain etc)|0}[MOD]]]}}{{fumble=[[1d10!]]}}`
doTemplateAttack(passin, rollBase);
});
on('clicked:templatefastattack', async (ev) => {
// The data we passed into the button will be stored in the originalRollId key
let passin = rollEscape.unescape(ev.originalRollId);
@@ -4993,6 +5033,22 @@ on('clicked:templatestrongattack', async (ev) => {
doTemplateAttack(passin, rollBase);
});
on('clicked:templatewolfstrike', async (ev) => {
// The data we passed into the button will be stored in the originalRollId key
let passin = rollEscape.unescape(ev.originalRollId);
let skill_attribute = passin.skill;
let weaponname = passin.weapon_name;
let weaponwa = passin.weapon_wa;
let skill = (await asw.getAttrs([skill_attribute]))[skill_attribute];
let attrs = await asw.getAttrs([weaponname, weaponwa, skill]);
passin.attackmultiplier = 2;
let rollBase = `@{whisper}&{template:weaponattack} {{title=${attrs[weaponname]}}} {{name=@{character_name}}} {{roll=[[1d10!+${attrs[skill]}[SKILLBASE]?{EXTRA ACTION|No,+0|Yes,-3}[EXTRA ACTION]-0[WOLF SCHOOL STRONG STRIKE]+${attrs[weaponwa]}[WEAP. ACC]?{TARGET LOCATION|Random,+0|Head,-6|Torso,-1|Arm/Limb,-3|Leg/Tail/Wing,-2}[LOCATION]+?{ADDITIONAL MODS? (Bright Light, No Vision, Terrain etc)|0}[MOD]]]}}{{fumble=[[1d10!]]}}`
doTemplateAttack(passin, rollBase);
});
on('clicked:templatejointmeleeattack', async (ev) => {
// The data we passed into the button will be stored in the originalRollId key
let passin = rollEscape.unescape(ev.originalRollId);
@@ -5469,6 +5525,11 @@ const asw = (() => {
[Single Strike](~{{name}}|templatesinglestrike||{{computed::passthrough}})
</div>
{{/rollTotal() computed::singlestrike 1}}
{{#rollTotal() computed::quickstrike 1}}
<div class="sheet-rolltemplate-button">
[Quick Strike](~{{name}}|templatequickstrike||{{computed::passthrough}})
</div>
{{/rollTotal() computed::quickstrike 1}}
{{#rollTotal() computed::faststrike 1}}
<div class="sheet-rolltemplate-button">
[Fast Strike](~{{name}}|templatefastattack||{{computed::passthrough}})
@@ -5479,6 +5540,11 @@ const asw = (() => {
[Strong Strike](~{{name}}|templatestrongattack||{{computed::passthrough}})
</div>
{{/rollTotal() computed::strongstrike 1}}
{{#rollTotal() computed::wolfstrike 1}}
<div class="sheet-rolltemplate-button">
[Wolf School Strong Strike](~{{name}}|templatewolfstrike||{{computed::passthrough}})
</div>
{{/rollTotal() computed::wolfstrike 1}}
{{#rollTotal() computed::jointmeleeattack 1}}
<div class="sheet-rolltemplate-button">
[Joint Attack](~{{name}}|templatejointmeleeattack||{{computed::passthrough}})