mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Merged with main
This commit is contained in:
commit
a5b656f533
51 changed files with 650 additions and 1032 deletions
|
|
@ -117,6 +117,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
async use(event, ...args) {
|
||||
if (!this.actor) throw new Error("An Action can't be used outside of an Actor context.");
|
||||
|
||||
if (this.chatDisplay) this.toChat();
|
||||
|
||||
let config = this.prepareConfig(event);
|
||||
for (let i = 0; i < this.constructor.extraSchemas.length; i++) {
|
||||
let clsField = this.constructor.getActionField(this.constructor.extraSchemas[i]);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export default class DHHealingAction extends DHBaseAction {
|
|||
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.applyTo].label)
|
||||
}),
|
||||
roll: formulas,
|
||||
targets: (data.system?.targets ?? data.targets).filter(t => t.hit),
|
||||
targets: systemData.targets?.filter(t => t.hit),
|
||||
messageType: 'healing',
|
||||
source: systemData.source,
|
||||
data: this.getRollData(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import DHBaseAction from '../../data/action/baseAction.mjs';
|
||||
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||
|
|
@ -44,7 +42,9 @@ export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
|||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||
this.currentTargets =
|
||||
this.targetSelection !== true
|
||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
||||
? Array.from(game.user.targets).map(t =>
|
||||
game.system.api.fields.ActionFields.TargetField.formatTarget(t)
|
||||
)
|
||||
: this.targets;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import DHBaseAction from "../action/baseAction.mjs";
|
||||
|
||||
export default class DHApplyEffect extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -27,7 +25,9 @@ export default class DHApplyEffect extends foundry.abstract.TypeDataModel {
|
|||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||
this.currentTargets =
|
||||
this.targetSelection !== true
|
||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
||||
? Array.from(game.user.targets).map(t =>
|
||||
game.system.api.fields.ActionFields.TargetField.formatTarget(t)
|
||||
)
|
||||
: this.targets;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ export default class DHDamageRoll extends foundry.abstract.TypeDataModel {
|
|||
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||
this.currentTargets =
|
||||
this.targetSelection !== true
|
||||
? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t))
|
||||
? Array.from(game.user.targets).map(t =>
|
||||
game.system.api.fields.ActionFields.TargetField.formatTarget(t)
|
||||
)
|
||||
: this.targets;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,9 @@ export function ActionMixin(Base) {
|
|||
if (!type || !game.system.api.models.actions.actionsTypes[type]) {
|
||||
({ type } =
|
||||
(await foundry.applications.api.DialogV2.input({
|
||||
window: { title: 'Select Action Type' },
|
||||
window: { title: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType') },
|
||||
position: { width: 300 },
|
||||
classes: ['daggerheart', 'dh-style'],
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||
|
|
@ -202,11 +204,20 @@ export function ActionMixin(Base) {
|
|||
}
|
||||
|
||||
async update(updates, options = {}) {
|
||||
const path = this.inCollection ? `system.${this.systemPath}.${this.id}` : `system.${this.systemPath}`,
|
||||
const isSetting = !this.parent.parent;
|
||||
const basePath = isSetting ? this.systemPath : `system.${this.systemPath}`;
|
||||
const path = this.inCollection ? `${basePath}.${this.id}` : basePath;
|
||||
let result = null;
|
||||
if (isSetting) {
|
||||
await this.parent.updateSource({ [path]: updates }, options);
|
||||
result = this.parent;
|
||||
} else {
|
||||
result = await this.item.update({ [path]: updates }, options);
|
||||
}
|
||||
|
||||
return this.inCollection
|
||||
? foundry.utils.getProperty(result, `system.${this.systemPath}`).get(this.id)
|
||||
: foundry.utils.getProperty(result, `system.${this.systemPath}`);
|
||||
? foundry.utils.getProperty(result, basePath).get(this.id)
|
||||
: foundry.utils.getProperty(result, basePath);
|
||||
}
|
||||
|
||||
delete() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const attributeField = label =>
|
|||
|
||||
const resourceField = (max = 0, label, reverse = false) =>
|
||||
new fields.SchemaField({
|
||||
value: new fields.NumberField({ initial: 0, integer: true, label }),
|
||||
value: new fields.NumberField({ initial: 0, min: 0, integer: true, label }),
|
||||
max: new fields.NumberField({ initial: max, integer: true }),
|
||||
isReversed: new fields.BooleanField({ initial: reverse })
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ export default class DhAppearance extends foundry.abstract.DataModel {
|
|||
dualityColorScheme: new fields.StringField({
|
||||
required: true,
|
||||
choices: DualityRollColor,
|
||||
initial: DualityRollColor.normal.value
|
||||
initial: DualityRollColor.normal.value,
|
||||
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.dualityColorScheme.label'
|
||||
}),
|
||||
diceSoNice: new fields.SchemaField({
|
||||
hope: new fields.SchemaField({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { defaultRestOptions } from '../../config/generalConfig.mjs';
|
||||
import { ActionsField } from '../fields/actionField.mjs';
|
||||
|
||||
export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Homebrew']; // Doesn't work for some reason
|
||||
|
|
@ -61,7 +62,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new fields.ArrayField(new fields.ObjectField())
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.longRest() }
|
||||
)
|
||||
|
|
@ -78,7 +79,7 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new fields.ArrayField(new fields.ObjectField())
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.shortRest() }
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue