mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
[Fix] 1582 - Automation Additions (#1592)
* Added an automation setting for chat command resources * Added automation settings for wether to have deathmove automation * . * Flattened automation structure
This commit is contained in:
parent
0baed9234b
commit
bb43cb57dc
8 changed files with 57 additions and 19 deletions
|
|
@ -309,7 +309,7 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
? CONFIG.DH.ACTIONS.advantageState.disadvantage.value
|
? CONFIG.DH.ACTIONS.advantageState.disadvantage.value
|
||||||
: undefined;
|
: undefined;
|
||||||
const difficulty = rollCommand.difficulty;
|
const difficulty = rollCommand.difficulty;
|
||||||
const grantResources = Boolean(rollCommand.grantResources);
|
const grantResources = rollCommand.grantResources;
|
||||||
|
|
||||||
const target = getCommandTarget({ allowNull: true });
|
const target = getCommandTarget({ allowNull: true });
|
||||||
const title =
|
const title =
|
||||||
|
|
|
||||||
|
|
@ -2111,7 +2111,6 @@
|
||||||
"tier4": "tier 4",
|
"tier4": "tier 4",
|
||||||
"domains": "Domains",
|
"domains": "Domains",
|
||||||
"downtime": "Downtime",
|
"downtime": "Downtime",
|
||||||
"itemFeatures": "Item Features",
|
|
||||||
"roll": "Roll",
|
"roll": "Roll",
|
||||||
"rules": "Rules",
|
"rules": "Rules",
|
||||||
"partyMembers": "Party Members",
|
"partyMembers": "Party Members",
|
||||||
|
|
@ -2120,7 +2119,8 @@
|
||||||
"questions": "Questions",
|
"questions": "Questions",
|
||||||
"configuration": "Configuration",
|
"configuration": "Configuration",
|
||||||
"base": "Base",
|
"base": "Base",
|
||||||
"triggers": "Triggers"
|
"triggers": "Triggers",
|
||||||
|
"deathMoves": "Deathmoves"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
"singular": "Tier",
|
"singular": "Tier",
|
||||||
|
|
@ -2144,6 +2144,7 @@
|
||||||
"armorSlots": "Armor Slots",
|
"armorSlots": "Armor Slots",
|
||||||
"artistAttribution": "Artwork By: {artist}",
|
"artistAttribution": "Artwork By: {artist}",
|
||||||
"attack": "Attack",
|
"attack": "Attack",
|
||||||
|
"automation": "Automation",
|
||||||
"basics": "Basics",
|
"basics": "Basics",
|
||||||
"bonus": "Bonus",
|
"bonus": "Bonus",
|
||||||
"burden": "Burden",
|
"burden": "Burden",
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleAvoidDeath() {
|
async handleAvoidDeath(useAutomation) {
|
||||||
const target = this.actor.uuid;
|
const target = this.actor.uuid;
|
||||||
const config = await enrichedFateRoll({
|
const config = await enrichedFateRoll({
|
||||||
target,
|
target,
|
||||||
|
|
@ -53,6 +53,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!config.roll.fate) return;
|
if (!config.roll.fate) return;
|
||||||
|
if (!useAutomation) return '';
|
||||||
|
|
||||||
let returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
|
let returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
|
||||||
if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
|
if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
|
||||||
|
|
@ -75,7 +76,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
return returnMessage;
|
return returnMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleRiskItAll() {
|
async handleRiskItAll(useAutomation) {
|
||||||
const config = await enrichedDualityRoll({
|
const config = await enrichedDualityRoll({
|
||||||
reaction: true,
|
reaction: true,
|
||||||
traitValue: null,
|
traitValue: null,
|
||||||
|
|
@ -90,6 +91,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!config.roll.result) return;
|
if (!config.roll.result) return;
|
||||||
|
if (!useAutomation) return '';
|
||||||
|
|
||||||
const clearAllStressAndHitpointsUpdates = [
|
const clearAllStressAndHitpointsUpdates = [
|
||||||
{ key: 'hitPoints', clear: true },
|
{ key: 'hitPoints', clear: true },
|
||||||
|
|
@ -128,7 +130,9 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
return chatMessage;
|
return chatMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleBlazeOfGlory() {
|
async handleBlazeOfGlory(useAutomation) {
|
||||||
|
if (!useAutomation) return '';
|
||||||
|
|
||||||
this.actor.createEmbeddedDocuments('ActiveEffect', [
|
this.actor.createEmbeddedDocuments('ActiveEffect', [
|
||||||
{
|
{
|
||||||
name: game.i18n.localize('DAGGERHEART.CONFIG.DeathMoves.blazeOfGlory.name'),
|
name: game.i18n.localize('DAGGERHEART.CONFIG.DeathMoves.blazeOfGlory.name'),
|
||||||
|
|
@ -160,19 +164,23 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
|
|
||||||
let result = '';
|
let result = '';
|
||||||
|
|
||||||
|
const deathMoveAutomation = game.settings.get(
|
||||||
|
CONFIG.DH.id,
|
||||||
|
CONFIG.DH.SETTINGS.gameSettings.Automation
|
||||||
|
).deathMoveAutomation;
|
||||||
if (CONFIG.DH.GENERAL.deathMoves.blazeOfGlory === this.selectedMove) {
|
if (CONFIG.DH.GENERAL.deathMoves.blazeOfGlory === this.selectedMove) {
|
||||||
result = await this.handleBlazeOfGlory();
|
result = await this.handleBlazeOfGlory(deathMoveAutomation.blazeOfGlory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG.DH.GENERAL.deathMoves.avoidDeath === this.selectedMove) {
|
if (CONFIG.DH.GENERAL.deathMoves.avoidDeath === this.selectedMove) {
|
||||||
result = await this.handleAvoidDeath();
|
result = await this.handleAvoidDeath(deathMoveAutomation.avoidDeath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG.DH.GENERAL.deathMoves.riskItAll === this.selectedMove) {
|
if (CONFIG.DH.GENERAL.deathMoves.riskItAll === this.selectedMove) {
|
||||||
result = await this.handleRiskItAll();
|
result = await this.handleRiskItAll(deathMoveAutomation.riskItAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result) return;
|
if (result === undefined) return;
|
||||||
|
|
||||||
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
||||||
.expandRollMessage?.desc;
|
.expandRollMessage?.desc;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
header: { template: 'systems/daggerheart/templates/settings/automation-settings/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/settings/automation-settings/header.hbs' },
|
||||||
general: { template: 'systems/daggerheart/templates/settings/automation-settings/general.hbs' },
|
general: { template: 'systems/daggerheart/templates/settings/automation-settings/general.hbs' },
|
||||||
rules: { template: 'systems/daggerheart/templates/settings/automation-settings/rules.hbs' },
|
rules: { template: 'systems/daggerheart/templates/settings/automation-settings/deathMoves.hbs' },
|
||||||
roll: { template: 'systems/daggerheart/templates/settings/automation-settings/roll.hbs' },
|
roll: { template: 'systems/daggerheart/templates/settings/automation-settings/roll.hbs' },
|
||||||
footer: { template: 'systems/daggerheart/templates/settings/automation-settings/footer.hbs' }
|
footer: { template: 'systems/daggerheart/templates/settings/automation-settings/footer.hbs' }
|
||||||
};
|
};
|
||||||
|
|
@ -42,7 +42,7 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
main: {
|
main: {
|
||||||
tabs: [{ id: 'general' }, { id: 'rules' }, { id: 'roll' }],
|
tabs: [{ id: 'general' }, { id: 'deathMoves' }, { id: 'roll' }],
|
||||||
initial: 'general',
|
initial: 'general',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,23 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
initial: true,
|
initial: true,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.resourceScrollTexts.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.resourceScrollTexts.label'
|
||||||
}),
|
}),
|
||||||
|
deathMoveAutomation: new fields.SchemaField({
|
||||||
|
avoidDeath: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.CONFIG.DeathMoves.avoidDeath.name'
|
||||||
|
}),
|
||||||
|
riskItAll: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.CONFIG.DeathMoves.riskItAll.name'
|
||||||
|
}),
|
||||||
|
blazeOfGlory: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.CONFIG.DeathMoves.blazeOfGlory.name'
|
||||||
|
})
|
||||||
|
}),
|
||||||
defeated: new fields.SchemaField({
|
defeated: new fields.SchemaField({
|
||||||
enabled: new fields.BooleanField({
|
enabled: new fields.BooleanField({
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ export const enrichedDualityRoll = async (
|
||||||
{ reaction, traitValue, target, difficulty, title, label, advantage, grantResources, customConfig },
|
{ reaction, traitValue, target, difficulty, title, label, advantage, grantResources, customConfig },
|
||||||
event
|
event
|
||||||
) => {
|
) => {
|
||||||
|
const shouldGrantResources = grantResources === undefined ? true : grantResources;
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
event: event ?? {},
|
event: event ?? {},
|
||||||
title: title,
|
title: title,
|
||||||
|
|
@ -94,12 +96,12 @@ export const enrichedDualityRoll = async (
|
||||||
roll: {
|
roll: {
|
||||||
trait: traitValue && target ? traitValue : null,
|
trait: traitValue && target ? traitValue : null,
|
||||||
difficulty: difficulty,
|
difficulty: difficulty,
|
||||||
advantage,
|
advantage
|
||||||
// type: reaction ? 'reaction' : null //not needed really but keeping it for troubleshooting
|
// type: reaction ? 'reaction' : null //not needed really but keeping it for troubleshooting
|
||||||
},
|
},
|
||||||
skips: {
|
skips: {
|
||||||
resources: !grantResources,
|
resources: !shouldGrantResources,
|
||||||
triggers: !grantResources
|
triggers: !shouldGrantResources
|
||||||
},
|
},
|
||||||
type: 'trait',
|
type: 'trait',
|
||||||
hasRoll: true,
|
hasRoll: true,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,17 @@
|
||||||
<section
|
<section
|
||||||
class="tab {{tabs.rules.cssClass}} {{tabs.rules.id}}"
|
class="tab {{tabs.deathMoves.cssClass}} {{tabs.deathMoves.id}}"
|
||||||
data-tab="{{tabs.rules.id}}"
|
data-tab="{{tabs.deathMoves.id}}"
|
||||||
data-group="{{tabs.rules.group}}"
|
data-group="{{tabs.deathMoves.group}}"
|
||||||
>
|
>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
{{localize "DAGGERHEART.GENERAL.automation"}}
|
||||||
|
</legend>
|
||||||
|
|
||||||
|
{{formGroup settingFields.schema.fields.deathMoveAutomation.fields.avoidDeath value=settingFields._source.deathMoveAutomation.avoidDeath localize=true}}
|
||||||
|
{{formGroup settingFields.schema.fields.deathMoveAutomation.fields.riskItAll value=settingFields._source.deathMoveAutomation.riskItAll localize=true}}
|
||||||
|
{{formGroup settingFields.schema.fields.deathMoveAutomation.fields.blazeOfGlory value=settingFields._source.deathMoveAutomation.blazeOfGlory localize=true}}
|
||||||
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
{{localize "DAGGERHEART.SETTINGS.Automation.defeated.title"}}
|
{{localize "DAGGERHEART.SETTINGS.Automation.defeated.title"}}
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
{{formGroup settingFields.schema.fields.summaryMessages.fields.damage value=settingFields._source.summaryMessages.damage localize=true}}
|
{{formGroup settingFields.schema.fields.summaryMessages.fields.damage value=settingFields._source.summaryMessages.damage localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.summaryMessages.fields.effects value=settingFields._source.summaryMessages.effects localize=true}}
|
{{formGroup settingFields.schema.fields.summaryMessages.fields.effects value=settingFields._source.summaryMessages.effects localize=true}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{formGroup settingFields.schema.fields.countdownAutomation value=settingFields._source.countdownAutomation localize=true}}
|
{{formGroup settingFields.schema.fields.countdownAutomation value=settingFields._source.countdownAutomation localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}}
|
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.hordeDamage value=settingFields._source.hordeDamage localize=true}}
|
{{formGroup settingFields.schema.fields.hordeDamage value=settingFields._source.hordeDamage localize=true}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue