mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
f
This commit is contained in:
parent
1228eb0105
commit
810d74baa5
11 changed files with 220 additions and 17 deletions
31
lang/en.json
31
lang/en.json
|
|
@ -1885,6 +1885,7 @@
|
||||||
"tier4": "tier 4",
|
"tier4": "tier 4",
|
||||||
"domains": "Domains",
|
"domains": "Domains",
|
||||||
"downtime": "Downtime",
|
"downtime": "Downtime",
|
||||||
|
"roll": "Roll",
|
||||||
"rules": "Rules"
|
"rules": "Rules"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
|
|
@ -1934,6 +1935,7 @@
|
||||||
"fear": "Fear",
|
"fear": "Fear",
|
||||||
"features": "Features",
|
"features": "Features",
|
||||||
"formula": "Formula",
|
"formula": "Formula",
|
||||||
|
"gm": "GM",
|
||||||
"healing": "Healing",
|
"healing": "Healing",
|
||||||
"healingRoll": "Healing Roll",
|
"healingRoll": "Healing Roll",
|
||||||
"hit": {
|
"hit": {
|
||||||
|
|
@ -1968,6 +1970,10 @@
|
||||||
"none": "None",
|
"none": "None",
|
||||||
"noTarget": "No current target",
|
"noTarget": "No current target",
|
||||||
"partner": "Partner",
|
"partner": "Partner",
|
||||||
|
"player": {
|
||||||
|
"single": "Player",
|
||||||
|
"plurial": "Players"
|
||||||
|
},
|
||||||
"proficiency": "Proficiency",
|
"proficiency": "Proficiency",
|
||||||
"quantity": "Quantity",
|
"quantity": "Quantity",
|
||||||
"range": "Range",
|
"range": "Range",
|
||||||
|
|
@ -2162,10 +2168,35 @@
|
||||||
"playerCanEditSheet": {
|
"playerCanEditSheet": {
|
||||||
"label": "Players Can Manually Edit Character Settings",
|
"label": "Players Can Manually Edit Character Settings",
|
||||||
"hint": "Players are allowed to access the manual Character Settings and change their statistics beyond the rules."
|
"hint": "Players are allowed to access the manual Character Settings and change their statistics beyond the rules."
|
||||||
|
},
|
||||||
|
"roll": {
|
||||||
|
"roll": {
|
||||||
|
"label": "Roll",
|
||||||
|
"hint": "Roll Hint"
|
||||||
|
},
|
||||||
|
"damage": {
|
||||||
|
"label": "Damage/Healing Roll",
|
||||||
|
"hint": "Damage/Healing Roll Hint"
|
||||||
|
},
|
||||||
|
"save": {
|
||||||
|
"label": "Reaction Roll",
|
||||||
|
"hint": "Reaction Roll Hint"
|
||||||
|
},
|
||||||
|
"damageApply": {
|
||||||
|
"label": "Apply Damage/Healing",
|
||||||
|
"hint": "Apply Damage/Healing Hint"
|
||||||
|
},
|
||||||
|
"effect": {
|
||||||
|
"label": "Apply Effects",
|
||||||
|
"hint": "Apply Effects Hint"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defeated": {
|
"defeated": {
|
||||||
"title": "Defeated Handling"
|
"title": "Defeated Handling"
|
||||||
|
},
|
||||||
|
"roll": {
|
||||||
|
"title": "Roll"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Homebrew": {
|
"Homebrew": {
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,14 @@ export default class DhAutomationSettings extends HandlebarsApplicationMixin(App
|
||||||
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/rules.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' }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
main: {
|
main: {
|
||||||
tabs: [{ id: 'general' }, { id: 'rules' }],
|
tabs: [{ id: 'general' }, { id: 'rules' }, { id: 'roll', cssClass: "with-hint" }],
|
||||||
initial: 'general',
|
initial: 'general',
|
||||||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Consume resources
|
// Consume resources
|
||||||
// await this.consume(config);
|
await this.consume(config);
|
||||||
|
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.postUseAction`, this, config) === false) return;
|
if (Hooks.call(`${CONFIG.DH.id}.postUseAction`, this, config) === false) return;
|
||||||
|
|
||||||
|
|
@ -229,9 +229,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
// return roll;
|
// return roll;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
doFollowUp(config) {
|
// doFollowUp(config) {
|
||||||
return !config.hasRoll;
|
// return !config.hasRoll;
|
||||||
}
|
// }
|
||||||
|
|
||||||
async consume(config, successCost = false) {
|
async consume(config, successCost = false) {
|
||||||
const actor= this.actor.system.partner ?? this.actor,
|
const actor= this.actor.system.partner ?? this.actor,
|
||||||
|
|
@ -301,13 +301,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
get hasDamagePart() {
|
get hasDamagePart() {
|
||||||
return this.damage?.parts?.length;
|
return this.damage?.parts?.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
get modifiers() {
|
|
||||||
if (!this.actor) return [];
|
|
||||||
const modifiers = [];
|
|
||||||
/** Placeholder for specific bonuses **/
|
|
||||||
return modifiers;
|
|
||||||
}
|
|
||||||
/* ROLL */
|
/* ROLL */
|
||||||
|
|
||||||
/* SAVE */
|
/* SAVE */
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import FormulaField from '../formulaField.mjs';
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class DamageField extends fields.SchemaField {
|
export default class DamageField extends fields.SchemaField {
|
||||||
static order = 50;
|
static order = 20;
|
||||||
|
|
||||||
constructor(options, context = {}) {
|
constructor(options, context = {}) {
|
||||||
const damageFields = {
|
const damageFields = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class EffectsField extends fields.ArrayField {
|
export default class EffectsField extends fields.ArrayField {
|
||||||
static order = 100;
|
static order = 60;
|
||||||
|
|
||||||
constructor(options = {}, context = {}) {
|
constructor(options = {}, context = {}) {
|
||||||
const element = new fields.SchemaField({
|
const element = new fields.SchemaField({
|
||||||
|
|
@ -20,4 +20,45 @@ export default class EffectsField extends fields.ArrayField {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async applyEffects(data, targets) {
|
||||||
|
targets ??= data.system.targets;
|
||||||
|
const force = true; /* Where should this come from? */
|
||||||
|
if (!this.effects?.length || !targets.length) return;
|
||||||
|
let effects = this.effects;
|
||||||
|
targets.forEach(async token => {
|
||||||
|
if (!token.hit && !force) return;
|
||||||
|
if (this.hasSave && token.saved.success === true) {
|
||||||
|
effects = this.effects.filter(e => e.onSave === true);
|
||||||
|
}
|
||||||
|
if (!effects.length) return;
|
||||||
|
effects.forEach(async e => {
|
||||||
|
const actor = canvas.tokens.get(token.id)?.actor,
|
||||||
|
effect = this.item.effects.get(e._id);
|
||||||
|
if (!actor || !effect) return;
|
||||||
|
await this.applyEffect(effect, actor);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async applyEffect(effect, actor) {
|
||||||
|
const existingEffect = actor.effects.find(e => e.origin === effect.uuid);
|
||||||
|
if (existingEffect) {
|
||||||
|
return effect.update(
|
||||||
|
foundry.utils.mergeObject({
|
||||||
|
...effect.constructor.getInitialDuration(),
|
||||||
|
disabled: false
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, create a new effect on the target
|
||||||
|
const effectData = foundry.utils.mergeObject({
|
||||||
|
...effect.toObject(),
|
||||||
|
disabled: false,
|
||||||
|
transfer: false,
|
||||||
|
origin: effect.uuid
|
||||||
|
});
|
||||||
|
await ActiveEffect.implementation.create(effectData, { parent: actor });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class MacroField extends fields.DocumentUUIDField {
|
export default class MacroField extends fields.DocumentUUIDField {
|
||||||
static order = 200;
|
static order = 70;
|
||||||
|
|
||||||
constructor(context = {}) {
|
constructor(context = {}) {
|
||||||
super({ type: "Macro" }, context);
|
super({ type: "Macro" }, context);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class SaveField extends fields.SchemaField {
|
export default class SaveField extends fields.SchemaField {
|
||||||
static order = 75;
|
static order = 50;
|
||||||
|
|
||||||
constructor(options = {}, context = {}) {
|
constructor(options = {}, context = {}) {
|
||||||
const saveFields = {
|
const saveFields = {
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,78 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditions.defeated.id,
|
initial: CONFIG.DH.GENERAL.defeatedConditions.defeated.id,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
||||||
})
|
})
|
||||||
|
}),
|
||||||
|
roll: new fields.SchemaField({
|
||||||
|
roll: new fields.SchemaField({
|
||||||
|
// label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.roll.label',
|
||||||
|
// hint: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.roll.hint',
|
||||||
|
gm: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.gm'
|
||||||
|
}),
|
||||||
|
players: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.player.plurial'
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
damage: new fields.SchemaField({
|
||||||
|
// label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.damage.label',
|
||||||
|
// hint: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.damage.hint',
|
||||||
|
gm: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.gm'
|
||||||
|
}),
|
||||||
|
players: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.player.plurial'
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
save: new fields.SchemaField({
|
||||||
|
// label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.save.label',
|
||||||
|
// hint: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.save.hint',
|
||||||
|
gm: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.gm'
|
||||||
|
}),
|
||||||
|
players: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.player.plurial'
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
damageApply: new fields.SchemaField({
|
||||||
|
// label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.damageApply.label',
|
||||||
|
// hint: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.damageApply.hint',
|
||||||
|
gm: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.gm'
|
||||||
|
}),
|
||||||
|
players: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.player.plurial'
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
effect: new fields.SchemaField({
|
||||||
|
// label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.effect.label',
|
||||||
|
// hint: 'DAGGERHEART.SETTINGS.Automation.FIELDS.roll.effect.hint',
|
||||||
|
gm: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.gm'
|
||||||
|
}),
|
||||||
|
players: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.player.plurial'
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -603,8 +603,9 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-size: 16px;
|
font-size: var(--font-size-14);
|
||||||
font-family: @font-body;
|
font-family: @font-body;
|
||||||
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-fields {
|
.form-fields {
|
||||||
|
|
|
||||||
|
|
@ -139,4 +139,45 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab.with-hint {
|
||||||
|
fieldset {
|
||||||
|
gap: .5rem;
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: .25rem;
|
||||||
|
|
||||||
|
label {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
flex: 0 0 100%;
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--font-size-14);
|
||||||
|
color: var(--color-form-hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.hint {
|
||||||
|
color: var(--color-form-hint-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group.setting-two-values {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
templates/settings/automation-settings/roll.hbs
Normal file
23
templates/settings/automation-settings/roll.hbs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<section
|
||||||
|
class="tab {{tabs.roll.cssClass}} {{tabs.roll.id}}"
|
||||||
|
data-tab="{{tabs.roll.id}}"
|
||||||
|
data-group="{{tabs.roll.group}}"
|
||||||
|
>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
{{localize "DAGGERHEART.SETTINGS.Automation.roll.title"}}
|
||||||
|
</legend>
|
||||||
|
{{log @root}}
|
||||||
|
{{#each settingFields.schema.fields.roll.fields as | field |}}
|
||||||
|
{{!-- {{formGroup field value=(lookup @root.settingFields.roll field.name) localize=true rootId="automation-roll"}} --}}
|
||||||
|
<div class="form-group setting-two-values">
|
||||||
|
<label>{{localize (concat "DAGGERHEART.SETTINGS.Automation.FIELDS.roll." field.name ".label")}}</label>
|
||||||
|
{{#with (lookup @root.settingFields.roll field.name) as | values |}}
|
||||||
|
{{formGroup field.fields.gm value=values.gm rootId=(concat "automation-roll-" field.name "-gm") localize=true}}
|
||||||
|
{{formGroup field.fields.players value=values.players rootId=(concat "automation-roll-" field.name "-players") localize=true}}
|
||||||
|
{{/with}}
|
||||||
|
<p class="hint">{{localize (concat "DAGGERHEART.SETTINGS.Automation.FIELDS.roll." field.name ".hint")}}</p>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue