Merge branch 'main' into feature/178-searchbar-logic-to-items-in-character-sheet

This commit is contained in:
Joaquin Pereyra 2025-06-28 19:41:02 -03:00
commit 4db92c2dfc
83 changed files with 3844 additions and 1840 deletions

View file

@ -30,7 +30,6 @@ export default class DHArmor extends BaseDataItem {
})
),
marks: new fields.SchemaField({
max: new fields.NumberField({ initial: 6, integer: true }),
value: new fields.NumberField({ initial: 0, integer: true })
}),
baseThresholds: new fields.SchemaField({

View file

@ -1,3 +1,5 @@
import { actionsTypes } from '../action/_module.mjs';
/**
* Describes metadata about the item data model type
* @typedef {Object} ItemDataModelMetadata
@ -52,4 +54,24 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
const data = { ...actorRollData, item: { ...this } };
return data;
}
async _preCreate(data, options, user) {
if(!this.constructor.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
const actionType = {
weapon: 'attack'
}[this.constructor.metadata.type],
cls = actionsTypes.attack,
action = new cls(
{
_id: foundry.utils.randomID(),
type: actionType,
name: game.i18n.localize(SYSTEM.ACTIONS.actionTypes[actionType].name),
...cls.getSourceConfig(this.parent)
},
{
parent: this.parent
}
);
this.updateSource({actions: [action]});
}
}

View file

@ -1,5 +1,4 @@
import { getTier } from '../../helpers/utils.mjs';
import DHAction from '../action/action.mjs';
import BaseDataItem from './base.mjs';
import ActionField from '../fields/actionField.mjs';

View file

@ -2,7 +2,7 @@ import BaseDataItem from './base.mjs';
import FormulaField from '../fields/formulaField.mjs';
import ActionField from '../fields/actionField.mjs';
import { weaponFeatures } from '../../config/itemConfig.mjs';
import { actionsTypes } from '../../data/_module.mjs';
import { actionsTypes } from '../action/_module.mjs';
export default class DHWeapon extends BaseDataItem {
/** @inheritDoc */
@ -13,6 +13,7 @@ export default class DHWeapon extends BaseDataItem {
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true,
hasInitialAction: true,
});
}