mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fix conflict
This commit is contained in:
commit
dbb07008f0
677 changed files with 67498 additions and 579 deletions
|
|
@ -181,13 +181,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
|
||||
prepareRoll() {
|
||||
const roll = {
|
||||
modifiers: this.modifiers,
|
||||
trait: this.roll?.trait,
|
||||
baseModifiers: this.roll.getModifier(),
|
||||
label: 'Attack',
|
||||
type: this.actionType,
|
||||
difficulty: this.roll?.difficulty,
|
||||
formula: this.roll.getFormula(),
|
||||
bonus: this.roll.bonus,
|
||||
advantage: CONFIG.DH.ACTIONS.advantageState[this.roll.advState].value
|
||||
};
|
||||
if (this.roll?.type === 'diceSet') roll.lite = true;
|
||||
|
|
@ -201,6 +199,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
|
||||
async consume(config) {
|
||||
const usefulResources = foundry.utils.deepClone(this.actor.system.resources);
|
||||
|
||||
for (var cost of config.costs) {
|
||||
if (cost.keyIsID) {
|
||||
usefulResources[cost.key] = {
|
||||
|
|
@ -223,17 +222,13 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
});
|
||||
|
||||
await this.actor.modifyResource(resources);
|
||||
if (config.uses?.enabled) {
|
||||
const newActions = foundry.utils.getProperty(this.item.system, this.systemPath).map(x => x.toObject());
|
||||
newActions[this.index].uses.value++;
|
||||
await this.item.update({ [`system.${this.systemPath}`]: newActions });
|
||||
}
|
||||
if (config.uses?.enabled) this.update({ 'uses.value': this.uses.value + 1 });
|
||||
}
|
||||
/* */
|
||||
|
||||
/* ROLL */
|
||||
get hasRoll() {
|
||||
return !!this.roll?.type || !!this.roll?.bonus;
|
||||
return !!this.roll?.type;
|
||||
}
|
||||
|
||||
get modifiers() {
|
||||
|
|
@ -297,17 +292,16 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
/* SAVE */
|
||||
async rollSave(actor, event, message) {
|
||||
if (!actor) return;
|
||||
return actor
|
||||
.diceRoll({
|
||||
event,
|
||||
title: 'Roll Save',
|
||||
roll: {
|
||||
trait: this.save.trait,
|
||||
difficulty: this.save.difficulty ?? this.actor?.baseSaveDifficulty,
|
||||
type: 'reaction'
|
||||
},
|
||||
data: actor.getRollData()
|
||||
});
|
||||
return actor.diceRoll({
|
||||
event,
|
||||
title: 'Roll Save',
|
||||
roll: {
|
||||
trait: this.save.trait,
|
||||
difficulty: this.save.difficulty ?? this.actor?.baseSaveDifficulty,
|
||||
type: 'reaction'
|
||||
},
|
||||
data: actor.getRollData()
|
||||
});
|
||||
}
|
||||
|
||||
updateSaveMessage(result, message, targetId) {
|
||||
|
|
@ -320,7 +314,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
else updateMsg();
|
||||
}
|
||||
|
||||
static rollSaveQuery({ actionId, actorId, event, message }) {
|
||||
static rollSaveQuery({ actionId, actorId, event, message }) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const actor = await fromUuid(actorId),
|
||||
action = await fromUuid(actionId);
|
||||
|
|
|
|||
|
|
@ -4,15 +4,25 @@ import DHBaseAction from './baseAction.mjs';
|
|||
export default class DhBeastformAction extends DHBaseAction {
|
||||
static extraSchemas = [...super.extraSchemas, 'beastform'];
|
||||
|
||||
async use(_event, ...args) {
|
||||
async use(event, ...args) {
|
||||
const beastformConfig = this.prepareBeastformConfig();
|
||||
|
||||
const abort = await this.handleActiveTransformations();
|
||||
if (abort) return;
|
||||
|
||||
const calcCosts = game.system.api.fields.ActionFields.CostField.calcCosts.call(this, this.cost);
|
||||
const hasCost = game.system.api.fields.ActionFields.CostField.hasCost.call(this, calcCosts);
|
||||
if (!hasCost) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.insufficientResources'));
|
||||
return;
|
||||
}
|
||||
|
||||
const { selected, evolved, hybrid } = await BeastformDialog.configure(beastformConfig, this.item);
|
||||
if (!selected) return;
|
||||
|
||||
const result = await super.use(event, args);
|
||||
if (!result) return;
|
||||
|
||||
await this.transform(selected, evolved, hybrid);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue