mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge branch 'main' into feature/death-moves
This commit is contained in:
commit
0bf5f4a9d8
177 changed files with 1437 additions and 1082 deletions
|
|
@ -95,6 +95,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
prepareData() {
|
||||
this.name = this.name || game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[this.type].name);
|
||||
this.img = this.img ?? this.parent?.parent?.img;
|
||||
|
||||
/* Fallback to feature description */
|
||||
this.description = this.description || this.parent?.description;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -159,18 +162,16 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
* @returns {object}
|
||||
*/
|
||||
getRollData(data = {}) {
|
||||
if (!this.actor) return null;
|
||||
const actorData = this.actor.getRollData(false);
|
||||
const actorData = this.actor ? this.actor.getRollData(false) : {};
|
||||
|
||||
// Add Roll results to RollDatas
|
||||
actorData.result = data.roll?.total ?? 1;
|
||||
|
||||
actorData.scale = data.costs?.length // Right now only return the first scalable cost.
|
||||
? (data.costs.find(c => c.scalable)?.total ?? 1)
|
||||
: 1;
|
||||
actorData.roll = {};
|
||||
|
||||
return actorData;
|
||||
return {
|
||||
...actorData,
|
||||
result: data.roll?.total ?? 1,
|
||||
scale: data.costs?.length // Right now only return the first scalable cost.
|
||||
? (data.costs.find(c => c.scalable)?.total ?? 1)
|
||||
: 1,
|
||||
roll: {}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,15 +60,13 @@ export default class DhpAdversary extends BaseDataActor {
|
|||
0,
|
||||
0,
|
||||
'DAGGERHEART.GENERAL.HitPoints.plural',
|
||||
true,
|
||||
game.i18n.localize('DAGGERHEART.GENERAL.max')
|
||||
true
|
||||
),
|
||||
stress: resourceField(
|
||||
0,
|
||||
0,
|
||||
'DAGGERHEART.GENERAL.stress',
|
||||
true,
|
||||
game.i18n.localize('DAGGERHEART.GENERAL.max')
|
||||
true
|
||||
)
|
||||
}),
|
||||
rules: new fields.SchemaField({
|
||||
|
|
|
|||
|
|
@ -124,29 +124,21 @@ export default class SaveField extends fields.SchemaField {
|
|||
*/
|
||||
static async updateSaveMessage(result, message, targetId) {
|
||||
if (!result) return;
|
||||
const updateMsg = async function (message, targetId, result) {
|
||||
// setTimeout(async () => {
|
||||
const chatMessage = ui.chat.collection.get(message._id),
|
||||
changes = {
|
||||
flags: {
|
||||
[game.system.id]: {
|
||||
reactionRolls: {
|
||||
[targetId]: {
|
||||
result: result.roll.total,
|
||||
success: result.roll.success
|
||||
}
|
||||
|
||||
const chatMessage = ui.chat.collection.get(message._id),
|
||||
changes = {
|
||||
flags: {
|
||||
[game.system.id]: {
|
||||
reactionRolls: {
|
||||
[targetId]: {
|
||||
result: result.roll.total,
|
||||
success: result.roll.success
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
await chatMessage.update(changes);
|
||||
// }, 100);
|
||||
};
|
||||
if (game.modules.get('dice-so-nice')?.active)
|
||||
game.dice3d
|
||||
.waitFor3DAnimationByMessageID(result.message.id ?? result.message._id)
|
||||
.then(async () => await updateMsg(message, targetId, result));
|
||||
else await updateMsg(message, targetId, result);
|
||||
}
|
||||
};
|
||||
await chatMessage.update(changes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue