mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Merged with main
This commit is contained in:
commit
f0e9dd75d9
17 changed files with 542 additions and 507 deletions
|
|
@ -39,7 +39,6 @@ export class DHRoll extends Roll {
|
|||
if (config.dialog.configure !== false) {
|
||||
// Open Roll Dialog
|
||||
const DialogClass = config.dialog?.class ?? this.DefaultDialog;
|
||||
console.log(roll, config);
|
||||
const configDialog = await DialogClass.configure(roll, config, message);
|
||||
if (!configDialog) return;
|
||||
}
|
||||
|
|
@ -124,6 +123,18 @@ export class DHRoll extends Roll {
|
|||
}
|
||||
return (this._formula = this.constructor.getFormula(this.terms));
|
||||
}
|
||||
|
||||
static calculateTotalModifiers(roll, config) {
|
||||
config.roll.modifierTotal = 0;
|
||||
for (let i = 0; i < roll.terms.length; i++) {
|
||||
if (
|
||||
roll.terms[i] instanceof foundry.dice.terms.NumericTerm &&
|
||||
!!roll.terms[i - 1] &&
|
||||
roll.terms[i - 1] instanceof foundry.dice.terms.OperatorTerm
|
||||
)
|
||||
config.roll.modifierTotal += Number(`${roll.terms[i - 1].operator}${roll.terms[i].total}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class DualityDie extends foundry.dice.terms.Die {
|
||||
|
|
@ -299,15 +310,8 @@ export class D20Roll extends DHRoll {
|
|||
value: d.total
|
||||
};
|
||||
});
|
||||
config.roll.modifierTotal = 0;
|
||||
for (let i = 0; i < roll.terms.length; i++) {
|
||||
if (
|
||||
roll.terms[i] instanceof foundry.dice.terms.NumericTerm &&
|
||||
!!roll.terms[i - 1] &&
|
||||
roll.terms[i - 1] instanceof foundry.dice.terms.OperatorTerm
|
||||
)
|
||||
config.roll.modifierTotal += Number(`${roll.terms[i - 1].operator}${roll.terms[i].total}`);
|
||||
}
|
||||
|
||||
this.calculateTotalModifiers(roll, config);
|
||||
}
|
||||
|
||||
resetFormula() {
|
||||
|
|
@ -468,6 +472,7 @@ export class DamageRoll extends DHRoll {
|
|||
static async postEvaluate(roll, config = {}) {
|
||||
super.postEvaluate(roll, config);
|
||||
config.roll.type = config.type;
|
||||
this.calculateTotalModifiers(roll, config);
|
||||
if (config.source?.message) {
|
||||
const chatMessage = ui.chat.collection.get(config.source.message);
|
||||
chatMessage.update({ 'system.damage': config });
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
if (this.hasRoll) {
|
||||
console.log(config);
|
||||
const rollConfig = this.prepareRoll(config);
|
||||
config.roll = rollConfig;
|
||||
config = await this.actor.diceRoll(config);
|
||||
|
|
@ -248,7 +249,6 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
if(t.hit) {
|
||||
const target = game.canvas.tokens.get(t.id),
|
||||
actor = target?.actor;
|
||||
console.log(actor)
|
||||
if(!actor) return;
|
||||
actor.saveRoll({
|
||||
event,
|
||||
|
|
@ -635,7 +635,7 @@ export class DHAttackAction extends DHDamageAction {
|
|||
return {
|
||||
value: {
|
||||
multiplier: 'prof',
|
||||
dice: this.item?.system?.damage.value,
|
||||
dice: this.item?.system?.damage.dice,
|
||||
bonus: this.item?.system?.damage.bonus ?? 0
|
||||
},
|
||||
type: this.item?.system?.damage.type,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ export default class DHWeapon extends BaseDataItem {
|
|||
burden: new fields.StringField({ required: true, choices: SYSTEM.GENERAL.burden, initial: 'oneHanded' }),
|
||||
//DAMAGE
|
||||
damage: new fields.SchemaField({
|
||||
value: new FormulaField({ initial: 'd6' }),
|
||||
dice: new fields.StringField({ choices: SYSTEM.GENERAL.diceTypes, initial: 'd6' }),
|
||||
bonus: new fields.NumberField({ nullable: true, initial: null }),
|
||||
type: new fields.StringField({
|
||||
required: true,
|
||||
choices: SYSTEM.GENERAL.damageTypes,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
this.config.experiences = [];
|
||||
|
||||
if (config.source?.action) {
|
||||
console.log(config);
|
||||
this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent;
|
||||
this.action =
|
||||
config.data.attack?._id == config.source.action
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue