113 - Character Data Model (#114)

* Improved Character datamodel

* Removed additional unneccessary getters

* Preliminary cleanup in the class sheet

* Cleanup of 'pc' references

* Corrected Duality rolling from Character

* Fix to damage roll
This commit is contained in:
WBHarry 2025-06-09 13:36:48 +02:00 committed by GitHub
parent 02f16f7363
commit 70382df63c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 1135 additions and 2001 deletions

View file

@ -33,7 +33,7 @@ export default class DHSubclass extends BaseDataItem {
const allowed = await super._preCreate(data, options, user);
if (allowed === false) return;
if (this.actor?.type === 'pc') {
if (this.actor?.type === 'character') {
const path = data.system.isMulticlass ? 'system.multiclass' : 'system.class';
const classData = foundry.utils.getProperty(this.actor, path);
if (!classData.value) {
@ -52,7 +52,7 @@ export default class DHSubclass extends BaseDataItem {
_onCreate(data, options, userId) {
super._onCreate(data, options, userId);
if (options.parent?.type === 'pc') {
if (options.parent?.type === 'character') {
const path = `system.${data.system.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
}
@ -61,7 +61,7 @@ export default class DHSubclass extends BaseDataItem {
_onDelete(options, userId) {
super._onDelete(options, userId);
if (options.parent?.type === 'pc') {
if (options.parent?.type === 'character') {
const path = `system.${this.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
options.parent.update({ [path]: null });
}