Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear or restore default Group Test skill #160 #166

Merged
merged 1 commit into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format

## Unreleased
See [Issue Backlog](../../issues) and [Roadmap](../../milestones).
- *Changed* Group Test setup form to clear or restore custom skill field if a skill is chosen from the skill list dropdown. [#160](https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/issues/160)

## [Version 0.9.5](https://github.com/Jagusti/fvtt-wfrp4e-gmtoolkit/releases/tag/v0.9.5) (2022-08-24)
- *Added* compatibility for Foundry VTT v10. This is a **breaking change**:
Expand Down
21 changes: 18 additions & 3 deletions apps/group-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export class GroupTest extends FormApplication {
quickTest4: game.settings.get("wfrp4e-gm-toolkit", "quicktest4GroupTest")
}

data.skills.custom = data.skills.list.map(m => m.name).includes(data.skills.target, name) ? "" : data.skills.target
data.skills.target
= (game.settings.get("wfrp4e-gm-toolkit", "defaultSkillGroupTest") === "null")
? ""
: game.settings.get("wfrp4e-gm-toolkit", "defaultSkillGroupTest")
data.skills.custom = data.skills.list.map(m => m.name).includes(data.skills.target) ? "" : data.skills.target

data.testParameters = {
testModifier: this.object.testParameters?.testModifier || game.settings.get("wfrp4e-gm-toolkit", "defaultTestModifierGroupTest"),
Expand Down Expand Up @@ -135,24 +139,35 @@ export class GroupTest extends FormApplication {

/**
* Toggle form label to reflect whether a skill or specialisation is needed
* @param {Event} event : The originating change event
* @param {Event} event : The originating event: change in skill-list dropdown
* @private
**/
_toggleGroupedSkill (event) {
const label = document.getElementById("skill-name-label")
const field = document.getElementById("skill-name")
// Set text field label
if (event.target.value.slice(-2) === "()" || event.target.value.slice(-3) === "( )") {
label.innerHTML = game.i18n.localize("GMTOOLKIT.Dialog.MakeSecretGroupTest.SetSpecialisation")
field.placeholder = game.i18n.localize("GMTOOLKIT.Dialog.MakeSecretGroupTest.SetSpecialisationPlaceholder")
} else {
label.innerHTML = game.i18n.localize("GMTOOLKIT.Dialog.MakeSecretGroupTest.SpecifySkill")
field.placeholder = game.i18n.localize("GMTOOLKIT.Dialog.MakeSecretGroupTest.SpecifySkillPlaceholder")
}
// Set text field value
if (event.target.value !== "") {
field.value = ""
}
if (event.target.value === "") {
field.value
= (game.settings.get("wfrp4e-gm-toolkit", "defaultSkillGroupTest") === "null")
? ""
: game.settings.get("wfrp4e-gm-toolkit", "defaultSkillGroupTest")
}
}

/**
* Toggle modifiers, disabling if not bypassing roll dialog, as they are ignored in interactive tests
* @param {Event} event : The originating change event
* @param {Event} event : The originating event: change in bypass checkbox
* @private
**/
_toggleBypassTestDialog (event) {
Expand Down