mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 12:54:16 +02:00
Merge branch 'main' into group-roll-dialog
This commit is contained in:
commit
0574a1d75a
46 changed files with 717 additions and 313 deletions
|
|
@ -72,8 +72,8 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
|
|||
|
||||
static async #onChooseAction(event, button) {
|
||||
const { actionId } = button.dataset;
|
||||
this.action = this.item.system.actionsList.find(a => a._id === actionId);
|
||||
Object.defineProperty(this.event, 'shiftKey', {
|
||||
this.#action = this.item.system.actionsList.find(a => a._id === actionId);
|
||||
Object.defineProperty(this.#event, 'shiftKey', {
|
||||
get() {
|
||||
return event.shiftKey;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
context.openSection = this.openSection;
|
||||
context.tabs = this._getTabs(this.constructor.TABS);
|
||||
context.config = CONFIG.DH;
|
||||
if (this.action.hasDamage) {
|
||||
if (this.action.damage) {
|
||||
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
||||
|
||||
if (this.action.damage.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
|
|
@ -302,7 +302,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
static addDamage(_event) {
|
||||
if (!this.action.damage.parts) return;
|
||||
|
||||
const choices = getUnusedDamageTypes(this.action.damage.parts);
|
||||
const choices = getUnusedDamageTypes(this.action._source.damage.parts);
|
||||
const content = new foundry.data.fields.StringField({
|
||||
label: game.i18n.localize('Damage Type'),
|
||||
choices,
|
||||
|
|
|
|||
|
|
@ -188,8 +188,9 @@ export default class SettingFeatureConfig extends HandlebarsApplicationMixin(App
|
|||
if (type === 'effect') {
|
||||
const move = foundry.utils.getProperty(this.settings, this.movePath);
|
||||
for (const action of move.actions) {
|
||||
const remainingEffects = action.effects.filter(x => x._id !== id);
|
||||
if (action.effects.length !== remainingEffects.length) {
|
||||
const actionEffects = action.effects ?? [];
|
||||
const remainingEffects = actionEffects.filter(x => x._id !== id);
|
||||
if (actionEffects.length !== remainingEffects.length) {
|
||||
await action.update({
|
||||
effects: remainingEffects.map(x => {
|
||||
const { _id, ...rest } = x;
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ export const allArmorFeatures = () => {
|
|||
const feature = homebrewFeatures[key];
|
||||
const actions = feature.actions.map(action => ({
|
||||
...action,
|
||||
effects: action.effects.map(effect => feature.effects.find(x => x.id === effect._id)),
|
||||
effects: action.effects?.map(effect => feature.effects.find(x => x.id === effect._id)) ?? [],
|
||||
type: action.type
|
||||
}));
|
||||
const actionEffects = actions.flatMap(a => a.effects);
|
||||
|
|
@ -1407,7 +1407,7 @@ export const allWeaponFeatures = () => {
|
|||
|
||||
const actions = feature.actions.map(action => ({
|
||||
...action,
|
||||
effects: action.effects.map(effect => feature.effects.find(x => x.id === effect._id)),
|
||||
effects: action.effects?.map(effect => feature.effects.find(x => x.id === effect._id)) ?? [],
|
||||
type: action.type
|
||||
}));
|
||||
const actionEffects = actions.flatMap(a => a.effects);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { DHDamageData } from '../fields/action/damageField.mjs';
|
||||
import DHDamageAction from './damageAction.mjs';
|
||||
|
||||
export default class DHAttackAction extends DHDamageAction {
|
||||
|
|
@ -12,8 +11,19 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
super.prepareData();
|
||||
if (!!this.item?.system?.attack) {
|
||||
if (this.damage.includeBase) {
|
||||
const baseDamage = this.getParentDamage();
|
||||
this.damage.parts.hitPoints = new DHDamageData(baseDamage);
|
||||
const baseDamage = this.getParentHitPointDamage();
|
||||
if (baseDamage) {
|
||||
if (!this.damage.parts.hitPoints) {
|
||||
this.damage.parts.hitPoints = baseDamage;
|
||||
} else {
|
||||
for (const type of baseDamage.type) this.damage.parts.hitPoints.type.add(type);
|
||||
|
||||
this.damage.parts.hitPoints.value.custom = {
|
||||
enabled: true,
|
||||
formula: `${baseDamage.value.getFormula()} + ${this.damage.parts.hitPoints.value.getFormula()}`
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.roll.useDefault) {
|
||||
this.roll.trait = this.item.system.attack.roll.trait;
|
||||
|
|
@ -22,16 +32,8 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
}
|
||||
}
|
||||
|
||||
getParentDamage() {
|
||||
return {
|
||||
value: {
|
||||
multiplier: 'prof',
|
||||
dice: this.item?.system?.attack.damage.parts.hitPoints.value.dice,
|
||||
bonus: this.item?.system?.attack.damage.parts.hitPoints.value.bonus ?? 0
|
||||
},
|
||||
type: this.item?.system?.attack.damage.parts.hitPoints.type,
|
||||
base: true
|
||||
};
|
||||
getParentHitPointDamage() {
|
||||
return this.item?.system?.attack.damage.parts.hitPoints;
|
||||
}
|
||||
|
||||
get damageFormula() {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
// Configure prototype token settings
|
||||
if (['character', 'companion', 'party'].includes(this.type))
|
||||
if (['character', 'companion', 'party'].includes(this.type)) {
|
||||
Object.assign(update, {
|
||||
prototypeToken: {
|
||||
sight: { enabled: true },
|
||||
|
|
@ -107,6 +107,8 @@ export default class DhpActor extends Actor {
|
|||
disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.updateSource(update);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue