mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-08 13:48:11 +02:00
Compare commits
No commits in common. "483caa106249a399733bb55a20b079895369282e" and "94efbeada3e89155d434fc50d09445f9dd221b73" have entirely different histories.
483caa1062
...
94efbeada3
6 changed files with 42 additions and 56 deletions
|
|
@ -165,8 +165,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
name: game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.newDowntimeMove'),
|
||||
img: 'icons/magic/life/cross-worn-green.webp',
|
||||
description: '',
|
||||
actions: [],
|
||||
effects: []
|
||||
actions: []
|
||||
}
|
||||
});
|
||||
} else if (['armorFeatures', 'weaponFeatures'].includes(type)) {
|
||||
|
|
|
|||
|
|
@ -252,8 +252,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
clearStress: {
|
||||
id: 'clearStress',
|
||||
|
|
@ -286,8 +285,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
repairArmor: {
|
||||
id: 'repairArmor',
|
||||
|
|
@ -320,8 +318,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
prepare: {
|
||||
id: 'prepare',
|
||||
|
|
@ -329,8 +326,7 @@ export const defaultRestOptions = {
|
|||
icon: 'fa-solid fa-dumbbell',
|
||||
img: 'icons/skills/trades/academics-merchant-scribe.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.prepare.description'),
|
||||
actions: {},
|
||||
effects: []
|
||||
actions: {}
|
||||
}
|
||||
}),
|
||||
longRest: () => ({
|
||||
|
|
@ -365,8 +361,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
clearStress: {
|
||||
id: 'clearStress',
|
||||
|
|
@ -399,8 +394,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
repairArmor: {
|
||||
id: 'repairArmor',
|
||||
|
|
@ -433,8 +427,7 @@ export const defaultRestOptions = {
|
|||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
effects: []
|
||||
}
|
||||
},
|
||||
prepare: {
|
||||
id: 'prepare',
|
||||
|
|
@ -442,8 +435,7 @@ export const defaultRestOptions = {
|
|||
icon: 'fa-solid fa-dumbbell',
|
||||
img: 'icons/skills/trades/academics-merchant-scribe.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.prepare.description'),
|
||||
actions: {},
|
||||
effects: []
|
||||
actions: {}
|
||||
},
|
||||
workOnAProject: {
|
||||
id: 'workOnAProject',
|
||||
|
|
@ -451,8 +443,7 @@ export const defaultRestOptions = {
|
|||
icon: 'fa-solid fa-diagram-project',
|
||||
img: 'icons/skills/social/thumbsup-approval-like.webp',
|
||||
description: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.longRest.workOnAProject.description'),
|
||||
actions: {},
|
||||
effects: []
|
||||
actions: {}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,24 +114,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
* Return Item the action is attached too.
|
||||
*/
|
||||
get item() {
|
||||
if (!this.parent.parent && this.systemPath)
|
||||
return foundry.utils.getProperty(this.parent, this.systemPath).get(this.id);
|
||||
|
||||
return this.parent.parent;
|
||||
}
|
||||
|
||||
get applyEffects() {
|
||||
if (this.item.systemPath) {
|
||||
const itemEffectIds = this.item.effects.map(x => x._id);
|
||||
const movePathSplit = this.item.systemPath.split('.');
|
||||
movePathSplit.pop();
|
||||
const move = foundry.utils.getProperty(this.parent, movePathSplit.join('.'));
|
||||
return new Collection(itemEffectIds.map(id => [id, move.effects.find(x => x.id === id)]));
|
||||
}
|
||||
|
||||
return this.item.effects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first Actor parent found.
|
||||
*/
|
||||
|
|
@ -140,7 +125,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
? this.item
|
||||
: this.item?.parent instanceof DhpActor
|
||||
? this.item.parent
|
||||
: null;
|
||||
: this.item?.actor;
|
||||
}
|
||||
|
||||
static getRollType(parent) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default class EffectsField extends fields.ArrayField {
|
|||
});
|
||||
|
||||
effects.forEach(async e => {
|
||||
const effect = (this.item.applyEffects ?? this.item.effects).get(e._id);
|
||||
const effect = this.item.effects.get(e._id);
|
||||
if (!token.actor || !effect) return;
|
||||
await EffectsField.applyEffect(effect, token.actor);
|
||||
});
|
||||
|
|
@ -96,7 +96,7 @@ export default class EffectsField extends fields.ArrayField {
|
|||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/effectSummary.hbs',
|
||||
{
|
||||
effects: this.effects.map(e => (this.item.applyEffects ?? this.item.effects).get(e._id)),
|
||||
effects: this.effects.map(e => this.item.effects.get(e._id)),
|
||||
targets: messageTargets
|
||||
}
|
||||
)
|
||||
|
|
@ -123,7 +123,7 @@ export default class EffectsField extends fields.ArrayField {
|
|||
|
||||
// Otherwise, create a new effect on the target
|
||||
const effectData = foundry.utils.mergeObject({
|
||||
...(effect.toObject?.() ?? effect),
|
||||
...effect.toObject(),
|
||||
disabled: false,
|
||||
transfer: false,
|
||||
origin: effect.uuid
|
||||
|
|
|
|||
|
|
@ -152,7 +152,6 @@ export function ActionMixin(Base) {
|
|||
}
|
||||
|
||||
get uuid() {
|
||||
if (!(this.item instanceof game.system.api.documents.DHItem)) return null;
|
||||
return `${this.item.uuid}.${this.documentName}.${this.id}`;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,20 +12,6 @@ const currencyField = (initial, label, icon) =>
|
|||
icon: new foundry.data.fields.StringField({ required: true, nullable: false, blank: true, initial: icon })
|
||||
});
|
||||
|
||||
const restMoveField = () =>
|
||||
new foundry.data.fields.SchemaField({
|
||||
name: new foundry.data.fields.StringField({ required: true }),
|
||||
icon: new foundry.data.fields.StringField({ required: true }),
|
||||
img: new foundry.data.fields.FilePathField({
|
||||
initial: 'icons/magic/life/cross-worn-green.webp',
|
||||
categories: ['IMAGE'],
|
||||
base64: false
|
||||
}),
|
||||
description: new foundry.data.fields.HTMLField(),
|
||||
actions: new ActionsField(),
|
||||
effects: new foundry.data.fields.ArrayField(new foundry.data.fields.ObjectField())
|
||||
});
|
||||
|
||||
export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -119,11 +105,37 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
|||
restMoves: new fields.SchemaField({
|
||||
longRest: new fields.SchemaField({
|
||||
nrChoices: new fields.NumberField({ required: true, integer: true, min: 1, initial: 2 }),
|
||||
moves: new fields.TypedObjectField(restMoveField(), { initial: defaultRestOptions.longRest() })
|
||||
moves: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
name: new fields.StringField({ required: true }),
|
||||
icon: new fields.StringField({ required: true }),
|
||||
img: new fields.FilePathField({
|
||||
initial: 'icons/magic/life/cross-worn-green.webp',
|
||||
categories: ['IMAGE'],
|
||||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.longRest() }
|
||||
)
|
||||
}),
|
||||
shortRest: new fields.SchemaField({
|
||||
nrChoices: new fields.NumberField({ required: true, integer: true, min: 1, initial: 2 }),
|
||||
moves: new fields.TypedObjectField(restMoveField(), { initial: defaultRestOptions.shortRest() })
|
||||
moves: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
name: new fields.StringField({ required: true }),
|
||||
icon: new fields.StringField({ required: true }),
|
||||
img: new fields.FilePathField({
|
||||
initial: 'icons/magic/life/cross-worn-green.webp',
|
||||
categories: ['IMAGE'],
|
||||
base64: false
|
||||
}),
|
||||
description: new fields.HTMLField(),
|
||||
actions: new ActionsField()
|
||||
}),
|
||||
{ initial: defaultRestOptions.shortRest() }
|
||||
)
|
||||
})
|
||||
}),
|
||||
domains: new fields.TypedObjectField(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue