mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge from main, with conflict fixes
This commit is contained in:
commit
a11a2d4e30
1252 changed files with 2537 additions and 22178 deletions
|
|
@ -2,4 +2,17 @@ import DHBaseAction from './baseAction.mjs';
|
|||
|
||||
export default class DHDamageAction extends DHBaseAction {
|
||||
static extraSchemas = [...super.extraSchemas, 'damage', 'target', 'effects'];
|
||||
|
||||
/**
|
||||
* Return a display ready damage formula string
|
||||
* @returns Formula string
|
||||
*/
|
||||
getDamageFormula() {
|
||||
const strings = [];
|
||||
for (const { value } of this.damage.parts) {
|
||||
strings.push(Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {}));
|
||||
}
|
||||
|
||||
return strings.join(' + ');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ export default class BeastformEffect extends BaseEffect {
|
|||
base64: false
|
||||
}),
|
||||
tokenSize: new fields.SchemaField({
|
||||
height: new fields.NumberField({ integer: true, nullable: true }),
|
||||
width: new fields.NumberField({ integer: true, nullable: true })
|
||||
height: new fields.NumberField({ integer: false, nullable: true }),
|
||||
width: new fields.NumberField({ integer: false, nullable: true })
|
||||
})
|
||||
}),
|
||||
advantageOn: new fields.ArrayField(new fields.StringField()),
|
||||
|
|
@ -29,6 +29,14 @@ export default class BeastformEffect extends BaseEffect {
|
|||
};
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
static migrateData(source) {
|
||||
if (!source.characterTokenData.tokenSize.height) source.characterTokenData.tokenSize.height = 1;
|
||||
if (!source.characterTokenData.tokenSize.width) source.characterTokenData.tokenSize.width = 1;
|
||||
|
||||
return super.migrateData(source);
|
||||
}
|
||||
|
||||
async _onCreate(_data, _options, userId) {
|
||||
if (userId !== game.user.id) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,6 +141,10 @@ export default class DhpAdversary extends BaseDataActor {
|
|||
return this.parent.items.filter(x => x.type === 'feature');
|
||||
}
|
||||
|
||||
isItemValid(source) {
|
||||
return source.type === "feature";
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, user) {
|
||||
const allowed = await super._preUpdate(changes, options, user);
|
||||
if (allowed === false) return false;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import BaseDataActor from './base.mjs';
|
||||
import DhLevelData from '../levelData.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import { ActionField, ActionsField } from '../fields/actionField.mjs';
|
||||
import { ActionField } 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';
|
||||
|
|
@ -108,6 +108,10 @@ export default class DhCompanion extends BaseDataActor {
|
|||
get proficiency() {
|
||||
return this.partner?.system?.proficiency ?? 1;
|
||||
}
|
||||
|
||||
isItemValid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
prepareBaseData() {
|
||||
this.attack.roll.bonus = this.partner?.system?.spellcastModifier ?? 0;
|
||||
|
|
|
|||
|
|
@ -51,4 +51,8 @@ export default class DhEnvironment extends BaseDataActor {
|
|||
get features() {
|
||||
return this.parent.items.filter(x => x.type === 'feature');
|
||||
}
|
||||
|
||||
isItemValid(source) {
|
||||
return source.type === "feature";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ export default class DhParty extends BaseDataActor {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
isItemValid(source) {
|
||||
return ["weapon", "armor", "consumable", "loot"].includes(source.type);
|
||||
}
|
||||
|
||||
prepareBaseData() {
|
||||
super.prepareBaseData();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,39 @@
|
|||
export default class DhCombat extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {};
|
||||
return {
|
||||
battleToggles: new fields.ArrayField(
|
||||
new fields.SchemaField({
|
||||
category: new fields.NumberField({ required: true, integer: true }),
|
||||
grouping: new fields.StringField({ required: true })
|
||||
})
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/** Includes automatic BPModifiers */
|
||||
get extendedBattleToggles() {
|
||||
const modifiers = CONFIG.DH.ENCOUNTER.BPModifiers;
|
||||
const adversaries =
|
||||
this.parent.turns?.filter(x => x.isNPC)?.map(x => ({ ...x.actor, type: x.actor.system.type })) ?? [];
|
||||
const characters = this.parent.turns?.filter(x => !x.isNPC) ?? [];
|
||||
|
||||
const activeAutomatic = Object.keys(modifiers).reduce((acc, categoryKey) => {
|
||||
const category = modifiers[categoryKey];
|
||||
acc.push(
|
||||
...Object.keys(category).reduce((acc, groupingKey) => {
|
||||
const grouping = category[groupingKey];
|
||||
if (grouping.automatic && grouping.conditional?.(this.parent, adversaries, characters)) {
|
||||
acc.push({ category: Number(categoryKey), grouping: groupingKey });
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, [])
|
||||
);
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
return [...this.battleToggles, ...activeAutomatic];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateDomainCard'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.actor.system.loadoutSlot.available) {
|
||||
data.system.inVault = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue