mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fix
This commit is contained in:
parent
f9377ec409
commit
f92ee042e6
3 changed files with 19 additions and 17 deletions
|
|
@ -29,16 +29,15 @@ export class DHRoll extends Roll {
|
|||
for (const hook of config.hooks) {
|
||||
if (Hooks.call(`${SYSTEM.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;
|
||||
}
|
||||
|
||||
console.log(config)
|
||||
this.applyKeybindings(config);
|
||||
|
||||
let roll = new this(config.roll.formula, config.data, config);
|
||||
if (config.dialog.configure !== false) {
|
||||
// Open Roll Dialog
|
||||
const DialogClass = config.dialog?.class ?? this.DefaultDialog;
|
||||
config = await DialogClass.configure(roll, config, message);
|
||||
if (!config) return;
|
||||
roll.terms = Roll.parse(roll._formula);
|
||||
const configDialog = await DialogClass.configure(roll, config, message);
|
||||
if (!configDialog) return;
|
||||
}
|
||||
|
||||
for (const hook of config.hooks) {
|
||||
|
|
@ -66,7 +65,7 @@ export class DHRoll extends Roll {
|
|||
}
|
||||
}
|
||||
|
||||
static async postEvaluate(roll, config = {}) {
|
||||
static postEvaluate(roll, config = {}) {
|
||||
if(!config.roll) config.roll = {};
|
||||
config.roll.total = roll.total;
|
||||
config.roll.formula = roll.formula;
|
||||
|
|
@ -94,11 +93,13 @@ export class DHRoll extends Roll {
|
|||
}
|
||||
|
||||
static applyKeybindings(config) {
|
||||
config.dialog.configure ??= true;
|
||||
config.dialog.configure ??= !(config.event.shiftKey || config.event.altKey || config.event.ctrlKey);
|
||||
}
|
||||
|
||||
constructFormula(config) {
|
||||
return (this._formula = Roll.replaceFormulaData(this.options.roll.formula, config.data));
|
||||
// const formula = Roll.replaceFormulaData(this.options.roll.formula, config.data);
|
||||
this.terms = Roll.parse(this.options.roll.formula, config.data)
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +231,7 @@ export class D20Roll extends DHRoll {
|
|||
}];
|
||||
}
|
||||
|
||||
static async postEvaluate(roll, config = {}) {
|
||||
static postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
if (config.targets?.length) {
|
||||
config.targets.forEach(target => {
|
||||
|
|
@ -372,7 +373,7 @@ export class DualityRoll extends D20Roll {
|
|||
}];
|
||||
}
|
||||
|
||||
static async postEvaluate(roll, config = {}) {
|
||||
static postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
config.roll.hope = {
|
||||
dice: roll.dHope.denomination,
|
||||
|
|
@ -387,6 +388,7 @@ export class DualityRoll extends D20Roll {
|
|||
total: roll.dHope.total + roll.dFear.total,
|
||||
label: roll.totalLabel
|
||||
};
|
||||
console.log(roll, config)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
if ( Hooks.call(`${SYSTEM.id}.preUseAction`, this, config) === false ) return;
|
||||
|
||||
// Display configuration window if necessary
|
||||
if ( config.dialog.configure && this.requireConfigurationDialog(config) ) {
|
||||
if ( config.dialog?.configure && this.requireConfigurationDialog(config) ) {
|
||||
config = await D20RollDialog.configure(config);
|
||||
if (!config) return;
|
||||
}
|
||||
|
|
@ -280,11 +280,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
source: {
|
||||
item: this.item._id,
|
||||
action: this._id
|
||||
// action: this
|
||||
},
|
||||
dialog: {
|
||||
configure: true
|
||||
},
|
||||
dialog: {},
|
||||
type: this.type,
|
||||
hasDamage: !!this.damage?.parts?.length,
|
||||
hasHealing: !!this.healing,
|
||||
|
|
@ -294,7 +291,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
requireConfigurationDialog(config) {
|
||||
return !config.event.shiftkey && !this.hasRoll && (config.costs?.length || config.uses);
|
||||
return !config.event.shiftKey && !this.hasRoll && (config.costs?.length || config.uses);
|
||||
}
|
||||
|
||||
prepareCost() {
|
||||
|
|
@ -348,8 +345,9 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
|
||||
async consume(config) {
|
||||
const resources = config.costs.filter(c => c.enabled !== false).map(c => {
|
||||
return { type: c.type, value: c.total * -1 };
|
||||
return { type: c.type, value: (c.total ?? c.value) * -1 };
|
||||
});
|
||||
|
||||
await this.actor.modifyResource(resources);
|
||||
if(config.uses?.enabled) {
|
||||
const newActions = foundry.utils.getProperty(this.item.system, this.systemPath).map(x => x.toObject());
|
||||
|
|
|
|||
|
|
@ -2570,7 +2570,6 @@ div.daggerheart.views.multiclass {
|
|||
opacity: 1;
|
||||
}
|
||||
.theme-light .daggerheart.dh-style.dialog.character-creation .tab-navigation nav a .descriptor {
|
||||
background: red;
|
||||
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
||||
}
|
||||
.theme-light .daggerheart.dh-style.dialog.character-creation .main-selections-container .traits-container .suggested-traits-container .suggested-trait-container,
|
||||
|
|
@ -2581,6 +2580,9 @@ div.daggerheart.views.multiclass {
|
|||
.daggerheart.dh-style.dialog.character-creation .window-content {
|
||||
gap: 16px;
|
||||
}
|
||||
.daggerheart.dh-style.dialog.character-creation .window-content .tab {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.daggerheart.dh-style.dialog.character-creation .tab-navigation nav {
|
||||
flex: 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue