mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fixes
This commit is contained in:
parent
9da6a13009
commit
192c739a58
13 changed files with 35 additions and 29 deletions
|
|
@ -171,7 +171,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
hasEffect: !!this.effects?.length,
|
||||
hasSave: this.hasSave,
|
||||
selectedRollMode: game.settings.get('core', 'rollMode'),
|
||||
isFastForward: event.shiftKey || (!this.hasRoll && !this.hasSave),
|
||||
isFastForward: event.shiftKey,
|
||||
data: this.getRollData()
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export default class DHDamageAction extends DHBaseAction {
|
|||
const config = {
|
||||
title: game.i18n.format('DAGGERHEART.UI.Chat.damageRoll.title', { damage: game.i18n.localize(this.name) }),
|
||||
roll: formulas,
|
||||
targets: systemData.targets.filter(t => t.hit) ?? data.targets,
|
||||
targets: systemData.targets?.filter(t => t.hit) ?? data.targets,
|
||||
hasSave: this.hasSave,
|
||||
isCritical: systemData.roll?.isCritical ?? false,
|
||||
source: systemData.source,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import BaseDataActor from './base.mjs';
|
||||
import DhLevelData from '../levelData.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import { ActionField } from '../fields/actionField.mjs';
|
||||
import { ActionField, ActionsField } from '../fields/actionField.mjs';
|
||||
import { adjustDice, adjustRange } from '../../helpers/utils.mjs';
|
||||
import DHCompanionSettings from '../../applications/sheets-configs/companion-settings.mjs';
|
||||
import { resourceField, bonusField } from '../fields/actorField.mjs';
|
||||
|
|
@ -76,7 +76,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
}),
|
||||
actions: new fields.ArrayField(new ActionField()),
|
||||
actions: new ActionsField(),
|
||||
levelData: new fields.EmbeddedDataField(DhLevelData),
|
||||
bonuses: new fields.SchemaField({
|
||||
damage: new fields.SchemaField({
|
||||
|
|
|
|||
|
|
@ -10,5 +10,7 @@ export default class RangeField extends fields.StringField {
|
|||
super(options, context);
|
||||
}
|
||||
|
||||
static prepareConfig(config) {}
|
||||
static prepareConfig(config) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,8 @@ export default class TargetField extends fields.SchemaField {
|
|||
}
|
||||
|
||||
static checkTargets(amount, targets) {
|
||||
return !amount || (targets.length > amount);
|
||||
return true
|
||||
// return !amount || (targets.length > amount);
|
||||
}
|
||||
|
||||
static isTargetFriendly(target) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ export default class DHArmor extends AttachableItem {
|
|||
label: 'TYPES.Item.armor',
|
||||
type: 'armor',
|
||||
hasDescription: true,
|
||||
isInventoryItem: true
|
||||
isInventoryItem: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +39,7 @@ export default class DHArmor extends AttachableItem {
|
|||
baseThresholds: new fields.SchemaField({
|
||||
major: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
severe: new fields.NumberField({ integer: true, initial: 0 })
|
||||
}),
|
||||
actions: new ActionsField()
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
* @property {boolean} isInventoryItem- Indicates whether items of this type is a Inventory Item
|
||||
*/
|
||||
|
||||
import { ActionsField } from "../fields/actionField.mjs";
|
||||
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||
|
|
@ -69,6 +71,9 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
if (this.metadata.isQuantifiable)
|
||||
schema.quantity = new fields.NumberField({ integer: true, initial: 1, min: 0, required: true });
|
||||
|
||||
if (this.metadata.hasActions)
|
||||
schema.actions = new ActionsField()
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ export default class DHConsumable extends BaseDataItem {
|
|||
type: 'consumable',
|
||||
hasDescription: true,
|
||||
isQuantifiable: true,
|
||||
isInventoryItem: true
|
||||
isInventoryItem: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -18,8 +19,7 @@ export default class DHConsumable extends BaseDataItem {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
consumeOnUse: new fields.BooleanField({ initial: false }),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
consumeOnUse: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
label: 'TYPES.Item.domainCard',
|
||||
type: 'domainCard',
|
||||
hasDescription: true,
|
||||
hasResource: true
|
||||
hasResource: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -29,8 +30,7 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
required: true,
|
||||
initial: CONFIG.DH.DOMAIN.cardTypes.ability.id
|
||||
}),
|
||||
inVault: new fields.BooleanField({ initial: false }),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
inVault: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ export default class DHFeature extends BaseDataItem {
|
|||
label: 'TYPES.Item.feature',
|
||||
type: 'feature',
|
||||
hasDescription: true,
|
||||
hasResource: true
|
||||
hasResource: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -24,8 +25,7 @@ export default class DHFeature extends BaseDataItem {
|
|||
}),
|
||||
subType: new fields.StringField({ choices: CONFIG.DH.ITEM.featureSubTypes, nullable: true, initial: null }),
|
||||
originId: new fields.StringField({ nullable: true, initial: null }),
|
||||
identifier: new fields.StringField(),
|
||||
actions: new ActionsField()
|
||||
identifier: new fields.StringField()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,15 @@ export default class DHMiscellaneous extends BaseDataItem {
|
|||
type: 'miscellaneous',
|
||||
hasDescription: true,
|
||||
isQuantifiable: true,
|
||||
isInventoryItem: true
|
||||
isInventoryItem: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
...super.defineSchema()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ export default class DHWeapon extends AttachableItem {
|
|||
label: 'TYPES.Item.weapon',
|
||||
type: 'weapon',
|
||||
hasDescription: true,
|
||||
isInventoryItem: true
|
||||
// hasInitialAction: true
|
||||
isInventoryItem: true,
|
||||
hasActions: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -63,13 +63,12 @@ export default class DHWeapon extends AttachableItem {
|
|||
]
|
||||
}
|
||||
}
|
||||
}),
|
||||
actions: new ActionsField()
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
get actionsList() {
|
||||
return new Set([this.attack, ...this.actions]);
|
||||
return [this.attack, ...this.actions];
|
||||
}
|
||||
|
||||
get customActions() {
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ export default class DHItem extends foundry.documents.Item {
|
|||
}
|
||||
|
||||
async use(event) {
|
||||
const actions = this.system.actionsList;
|
||||
const actions = new Set(this.system.actionsList);
|
||||
if (actions?.size) {
|
||||
let action = actions.first(0);
|
||||
let action = actions.first();
|
||||
if (actions.size > 1 && !event?.shiftKey) {
|
||||
// Actions Choice Dialog
|
||||
action = await this.selectActionDialog(event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue