From a83531d282656c657cdcecdb6d804c045d6fa54e Mon Sep 17 00:00:00 2001 From: Ian Merryweather Date: Thu, 18 Feb 2021 00:19:26 +0000 Subject: [PATCH 1/2] feature: Adds capture roll modifiers - refactors the capture pokemon skill section to allow for more information and more extensive modifiers - adds two new options to the configuration page to further modify the capture pokemon skill --- PokemonTabletopAdventures_v3/PTA3.css | 24 ++++++- PokemonTabletopAdventures_v3/PTA3.html | 86 +++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 13 deletions(-) diff --git a/PokemonTabletopAdventures_v3/PTA3.css b/PokemonTabletopAdventures_v3/PTA3.css index e3c3619444..1d6bb13161 100644 --- a/PokemonTabletopAdventures_v3/PTA3.css +++ b/PokemonTabletopAdventures_v3/PTA3.css @@ -287,6 +287,7 @@ div.sheet-character-stat-grid p { .sheet-configuration-grid { align-items: start; + column-gap: 10px; display: grid; grid-template-columns: 1fr 1fr; padding: 6px; @@ -454,9 +455,21 @@ div.sheet-skill-selection .sheet-no-dropdown { } .sheet-capture-pokemon-skill { - display: grid; - grid-template-columns: 2fr 10fr 4fr; align-items: center; + display: grid; + grid-template-columns: 2fr 3fr 7fr 2fr 2fr; +} + +div.sheet-capture-pokemon-skill input[type="text"] { + margin-left: -1px; +} + +div.sheet-capture-pokemon-skill .sheet-skill-roller { + grid-column: 2 / end; +} + +div.sheet-capture-pokemon-skill select.sheet-ball-picker { + grid-column: 1 / span 2; } select.sheet-ball-picker { @@ -668,10 +681,15 @@ input.sheet-skill-color-setting[value="SPD"] + .sheet-skill-total + button[type= background-color: var(--stat-ro-spd); } -input[type="number"].sheet-skill-total { +input.sheet-skill-total { border: none; font-style: italic; font-weight: bold; + width: 3.5em; +} + +input[type="text"].sheet-skill-total { + text-align: center; } .sheet-stat-ball-color[type="number"] { diff --git a/PokemonTabletopAdventures_v3/PTA3.html b/PokemonTabletopAdventures_v3/PTA3.html index 86220d4510..bb1228f33c 100644 --- a/PokemonTabletopAdventures_v3/PTA3.html +++ b/PokemonTabletopAdventures_v3/PTA3.html @@ -580,12 +580,13 @@ - + + + + + @@ -933,12 +938,12 @@ - + - +

@@ -984,6 +989,22 @@ selector, and then assign the stat you want to use with the right selector.

+
+ Custom Ball Default: + +
+

+ This setting allows you to specify a default modifier to be used for the Custom Ball when capturing pokémon. You can use an attribute for this value. +

+
+
+ Feature Bonus to Capture: + +
+

+ This setting allows you to define a numerical bonus to your capture rolls. This value will be subtracted from your capture rolls. +

+
@@ -2299,7 +2320,7 @@ }); // Capture - on("change:SPDMOD change:capture sheet:opened", function () { + on("change:SPDMOD sheet:opened", function () { getAttrs([`SPDMOD`, `capture_total`], function (values) { const stat = parseInt(values.SPDMOD) || 0; const total = parseInt(values.capture_total) || -1; @@ -2308,6 +2329,51 @@ }); }); + on("change:ball_capture_modifier change:capture_roll_bonus change:capture_roll_feature_bonus sheet:opened", function () { + getAttrs(["ball_capture_modifier", "capture_default_custom_modifier", "capture_roll_bonus", "capture_roll_feature_bonus"], function (values) { + + const ball = values.ball_capture_modifier; + const bonus = parseInt(values.capture_roll_bonus) || 0; + + var display; + var showAsterisk = false; + if (ball.includes("Custom")) { + display = values.capture_default_custom_modifier; + showAsterisk = true; + } else { + display = ball; + } + + + const feature = values.capture_roll_feature_bonus; + if (feature.includes("@{")) { + const stripped = feature.replace('@{', '').replace('}', ''); + + getAttrs([stripped], function (innerValue) { + const value = innerValue[`${stripped}`]; + assignCaptureAttributesWith(bonus, value, display, showAsterisk); + }); + } else { + const intFeature = parseInt(feature) || 0; + assignCaptureAttributesWith(bonus, intFeature, display, showAsterisk); + } + }); + }) + + function assignCaptureAttributesWith(bonus, feature, display, isCustomPokeball) { + var total = bonus - feature; + if (isCustomPokeball) { + total = `${total}*`; + } else { + total += parseInt(display) || 0; + } + + setAttrs({ + "capture_display" : display, + "capture_roll_total": total + }); + } + function getSkillAttributes(statLabel, talent1Label, talent2Label, userBonusLabel, totalLabel) { getAttrs([statLabel, talent1Label, talent2Label, totalLabel, userBonusLabel], function (attributes) { const stat = parseInt(attributes[statLabel]) || 0; From ad623d62766486dff054626c0b2e00676f41014f Mon Sep 17 00:00:00 2001 From: Ian Merryweather Date: Thu, 18 Feb 2021 13:04:19 +0000 Subject: [PATCH 2/2] feature: Improved capture pokemon appearance - removes the feature bonus configuration option as it was unnecessary and made the sheet worker bloated - updated the styling of various capture pokemon skill sub-elements - added more descriptive titles to the capture pokemon skill sub-elements - updated the README --- PokemonTabletopAdventures_v3/PTA3.css | 6 ++- PokemonTabletopAdventures_v3/PTA3.html | 73 ++++++++++---------------- PokemonTabletopAdventures_v3/README.md | 7 +++ 3 files changed, 40 insertions(+), 46 deletions(-) diff --git a/PokemonTabletopAdventures_v3/PTA3.css b/PokemonTabletopAdventures_v3/PTA3.css index 1d6bb13161..dcdc880397 100644 --- a/PokemonTabletopAdventures_v3/PTA3.css +++ b/PokemonTabletopAdventures_v3/PTA3.css @@ -462,6 +462,7 @@ div.sheet-skill-selection .sheet-no-dropdown { div.sheet-capture-pokemon-skill input[type="text"] { margin-left: -1px; + width: 65% !important; } div.sheet-capture-pokemon-skill .sheet-skill-roller { @@ -472,8 +473,11 @@ div.sheet-capture-pokemon-skill select.sheet-ball-picker { grid-column: 1 / span 2; } +div.sheet-capture-pokemon-skill > span { + padding-left: 10px; +} + select.sheet-ball-picker { - border: none; width: auto; } diff --git a/PokemonTabletopAdventures_v3/PTA3.html b/PokemonTabletopAdventures_v3/PTA3.html index bb1228f33c..30b5e981a0 100644 --- a/PokemonTabletopAdventures_v3/PTA3.html +++ b/PokemonTabletopAdventures_v3/PTA3.html @@ -578,13 +578,15 @@
- + - @@ -616,10 +618,15 @@ - - - - + + Ball Mod: + + + +
@@ -997,14 +1004,6 @@ This setting allows you to specify a default modifier to be used for the Custom Ball when capturing pokémon. You can use an attribute for this value.

-
- Feature Bonus to Capture: - -
-

- This setting allows you to define a numerical bonus to your capture rolls. This value will be subtracted from your capture rolls. -

-
@@ -2329,50 +2328,34 @@ }); }); - on("change:ball_capture_modifier change:capture_roll_bonus change:capture_roll_feature_bonus sheet:opened", function () { - getAttrs(["ball_capture_modifier", "capture_default_custom_modifier", "capture_roll_bonus", "capture_roll_feature_bonus"], function (values) { + on("change:ball_capture_modifier change:capture_roll_bonus sheet:opened", function () { + getAttrs(["ball_capture_modifier", "capture_default_custom_modifier", "capture_roll_bonus"], function (values) { const ball = values.ball_capture_modifier; const bonus = parseInt(values.capture_roll_bonus) || 0; var display; - var showAsterisk = false; + var isCustomPokeball = false; if (ball.includes("Custom")) { display = values.capture_default_custom_modifier; - showAsterisk = true; + isCustomPokeball = true; } else { display = ball; } - - const feature = values.capture_roll_feature_bonus; - if (feature.includes("@{")) { - const stripped = feature.replace('@{', '').replace('}', ''); - - getAttrs([stripped], function (innerValue) { - const value = innerValue[`${stripped}`]; - assignCaptureAttributesWith(bonus, value, display, showAsterisk); - }); + var total = bonus; + if (isCustomPokeball) { + total = `${total}*`; } else { - const intFeature = parseInt(feature) || 0; - assignCaptureAttributesWith(bonus, intFeature, display, showAsterisk); + total += parseInt(display) || 0; } + + setAttrs({ + "capture_display": display, + "capture_roll_total": total + }); }); - }) - - function assignCaptureAttributesWith(bonus, feature, display, isCustomPokeball) { - var total = bonus - feature; - if (isCustomPokeball) { - total = `${total}*`; - } else { - total += parseInt(display) || 0; - } - - setAttrs({ - "capture_display" : display, - "capture_roll_total": total - }); - } + }); function getSkillAttributes(statLabel, talent1Label, talent2Label, userBonusLabel, totalLabel) { getAttrs([statLabel, talent1Label, talent2Label, totalLabel, userBonusLabel], function (attributes) { diff --git a/PokemonTabletopAdventures_v3/README.md b/PokemonTabletopAdventures_v3/README.md index 4c3c71be17..86d6f2fda8 100644 --- a/PokemonTabletopAdventures_v3/README.md +++ b/PokemonTabletopAdventures_v3/README.md @@ -23,6 +23,13 @@ Things we want to add to the character sheet, presented in no particular order o ## Changelog +### Feb 18th, 2021 + +- Expanded the Capture Pokémon skill, allowing modifiers such as Capture Point to be applied +- Improved the display of the Pokéball selection, and added a display of the effect that each has on the capture roll +- Added a display of the total modifier to capture rolls +- Added the option of configuring the default value for Custom Pokéballs + ### Feb 11th, 2021 - Resolved a small issue with the move repeating section where the button to collapse the fields would show a `+` instead of a `-`