mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
Merged with main
This commit is contained in:
commit
58f96a36c9
44 changed files with 564 additions and 165 deletions
13
lang/en.json
13
lang/en.json
|
|
@ -393,6 +393,7 @@
|
||||||
"rerollDice": "Reroll Dice"
|
"rerollDice": "Reroll Dice"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"CONFIG": {
|
"CONFIG": {
|
||||||
"ActionType": {
|
"ActionType": {
|
||||||
"passive": "Passive",
|
"passive": "Passive",
|
||||||
|
|
@ -966,6 +967,10 @@
|
||||||
"stress": {
|
"stress": {
|
||||||
"name": "Stress"
|
"name": "Stress"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Attachments": {
|
||||||
|
"attachHint": "Drop items here to attach them",
|
||||||
|
"transferHint": "If checked, this effect will be applied to any actor that owns this Effect's parent Item. The effect is always applied if this Item is attached to another one."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"GENERAL": {
|
"GENERAL": {
|
||||||
|
|
@ -995,6 +1000,11 @@
|
||||||
"minor": "Minor",
|
"minor": "Minor",
|
||||||
"none": "None"
|
"none": "None"
|
||||||
},
|
},
|
||||||
|
"DamageResistance": {
|
||||||
|
"none": "None",
|
||||||
|
"resistance": "Resistance",
|
||||||
|
"immunity": "Immunity"
|
||||||
|
},
|
||||||
"DamageThresholds": {
|
"DamageThresholds": {
|
||||||
"title": "Damage Thresholds",
|
"title": "Damage Thresholds",
|
||||||
"minor": "Minor",
|
"minor": "Minor",
|
||||||
|
|
@ -1100,7 +1110,8 @@
|
||||||
"optional": "Optional",
|
"optional": "Optional",
|
||||||
"recovery": "Recovery",
|
"recovery": "Recovery",
|
||||||
"setup": "Setup",
|
"setup": "Setup",
|
||||||
"equipment": "Equipment"
|
"equipment": "Equipment",
|
||||||
|
"attachments": "Attachments"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
"singular": "Tier",
|
"singular": "Tier",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
|
|
||||||
const canApplyArmor = actor.system.armorApplicableDamageTypes[damageType];
|
const canApplyArmor = damageType.every(t => actor.system.armorApplicableDamageTypes[t] === true);
|
||||||
const maxArmorMarks = canApplyArmor
|
const maxArmorMarks = canApplyArmor
|
||||||
? Math.min(
|
? Math.min(
|
||||||
actor.system.armorScore - actor.system.armor.system.marks.value,
|
actor.system.armorScore - actor.system.armor.system.marks.value,
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,6 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
||||||
id: 'effect',
|
id: 'effect',
|
||||||
template: 'systems/daggerheart/templates/sheets-settings/action-settings/effect.hbs'
|
template: 'systems/daggerheart/templates/sheets-settings/action-settings/effect.hbs'
|
||||||
}
|
}
|
||||||
/* form: {
|
|
||||||
id: 'action',
|
|
||||||
template: 'systems/daggerheart/templates/config/action.hbs'
|
|
||||||
} */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static TABS = {
|
static TABS = {
|
||||||
|
|
@ -183,7 +179,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
||||||
container = foundry.utils.getProperty(this.action.parent, this.action.systemPath);
|
container = foundry.utils.getProperty(this.action.parent, this.action.systemPath);
|
||||||
let newActions;
|
let newActions;
|
||||||
if (Array.isArray(container)) {
|
if (Array.isArray(container)) {
|
||||||
newActions = foundry.utils.getProperty(this.action.parent, this.action.systemPath).map(x => x.toObject()); // Find better way
|
newActions = foundry.utils.getProperty(this.action.parent, this.action.systemPath).map(x => x.toObject());
|
||||||
if (!newActions.findSplice(x => x._id === data._id, data)) newActions.push(data);
|
if (!newActions.findSplice(x => x._id === data._id, data)) newActions.push(data);
|
||||||
} else newActions = data;
|
} else newActions = data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true
|
||||||
},
|
},
|
||||||
dragDrop: [],
|
dragDrop: [
|
||||||
|
{
|
||||||
|
dragSelector: '[data-item-id][draggable="true"]',
|
||||||
|
dropSelector: null
|
||||||
|
}
|
||||||
|
],
|
||||||
contextMenus: [
|
contextMenus: [
|
||||||
{
|
{
|
||||||
handler: CharacterSheet._getContextMenuOptions,
|
handler: CharacterSheet._getContextMenuOptions,
|
||||||
|
|
@ -739,11 +744,24 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onDragStart(_, event) {
|
async _onDragStart(event) {
|
||||||
|
const item = this.getItem(event);
|
||||||
|
|
||||||
|
const dragData = {
|
||||||
|
type: item.documentName,
|
||||||
|
uuid: item.uuid
|
||||||
|
};
|
||||||
|
|
||||||
|
event.dataTransfer.setData('text/plain', JSON.stringify(dragData));
|
||||||
|
|
||||||
super._onDragStart(event);
|
super._onDragStart(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onDrop(event) {
|
async _onDrop(event) {
|
||||||
|
// Prevent event bubbling to avoid duplicate handling
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
super._onDrop(event);
|
super._onDrop(event);
|
||||||
this._onDropItem(event, TextEditor.getDragEventData(event));
|
this._onDropItem(event, TextEditor.getDragEventData(event));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
export { default as DHApplicationMixin } from './application-mixin.mjs';
|
export { default as DHApplicationMixin } from './application-mixin.mjs';
|
||||||
export { default as DHBaseItemSheet } from './base-item.mjs';
|
export { default as DHBaseItemSheet } from './base-item.mjs';
|
||||||
export { default as DHHeritageSheet } from './heritage-sheet.mjs';
|
export { default as DHHeritageSheet } from './heritage-sheet.mjs';
|
||||||
|
export { default as DHItemAttachmentSheet } from './item-attachment-sheet.mjs';
|
||||||
export { default as DHBaseActorSheet } from './base-actor.mjs';
|
export { default as DHBaseActorSheet } from './base-actor.mjs';
|
||||||
export { default as DHBaseActorSettings } from './actor-setting.mjs';
|
export { default as DHBaseActorSettings } from './actor-setting.mjs';
|
||||||
|
|
|
||||||
85
module/applications/sheets/api/item-attachment-sheet.mjs
Normal file
85
module/applications/sheets/api/item-attachment-sheet.mjs
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
export default function ItemAttachmentSheet(Base) {
|
||||||
|
return class extends Base {
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
...super.DEFAULT_OPTIONS,
|
||||||
|
dragDrop: [
|
||||||
|
...(super.DEFAULT_OPTIONS.dragDrop || []),
|
||||||
|
{ dragSelector: null, dropSelector: '.attachments-section' }
|
||||||
|
],
|
||||||
|
actions: {
|
||||||
|
...super.DEFAULT_OPTIONS.actions,
|
||||||
|
removeAttachment: this.#removeAttachment
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static PARTS = {
|
||||||
|
...super.PARTS,
|
||||||
|
attachments: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-attachments.hbs',
|
||||||
|
scrollable: ['.attachments']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static TABS = {
|
||||||
|
...super.TABS,
|
||||||
|
primary: {
|
||||||
|
...super.TABS?.primary,
|
||||||
|
tabs: [...(super.TABS?.primary?.tabs || []), { id: 'attachments' }],
|
||||||
|
initial: super.TABS?.primary?.initial || 'description',
|
||||||
|
labelPrefix: super.TABS?.primary?.labelPrefix || 'DAGGERHEART.GENERAL.Tabs'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
await super._preparePartContext(partId, context);
|
||||||
|
|
||||||
|
if (partId === 'attachments') {
|
||||||
|
context.attachedItems = await prepareAttachmentContext(this.document);
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = TextEditor.getDragEventData(event);
|
||||||
|
|
||||||
|
const attachmentsSection = event.target.closest('.attachments-section');
|
||||||
|
if (!attachmentsSection) return super._onDrop(event);
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
const item = await Item.implementation.fromDropData(data);
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
// Call the data model's public method
|
||||||
|
await this.document.system.addAttachment(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #removeAttachment(event, target) {
|
||||||
|
// Call the data model's public method
|
||||||
|
await this.document.system.removeAttachment(target.dataset.uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
await super._preparePartContext(partId, context);
|
||||||
|
|
||||||
|
if (partId === 'attachments') {
|
||||||
|
// Keep this simple UI preparation in the mixin
|
||||||
|
const attachedUUIDs = this.document.system.attached;
|
||||||
|
context.attachedItems = await Promise.all(
|
||||||
|
attachedUUIDs.map(async uuid => {
|
||||||
|
const item = await fromUuid(uuid);
|
||||||
|
return {
|
||||||
|
uuid: uuid,
|
||||||
|
name: item?.name || 'Unknown Item',
|
||||||
|
img: item?.img || 'icons/svg/item-bag.svg'
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import DHBaseItemSheet from '../api/base-item.mjs';
|
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||||
|
import ItemAttachmentSheet from '../api/item-attachment-sheet.mjs';
|
||||||
|
|
||||||
export default class ArmorSheet extends DHBaseItemSheet {
|
export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['armor'],
|
classes: ['armor'],
|
||||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
|
||||||
tagifyConfigs: [
|
tagifyConfigs: [
|
||||||
{
|
{
|
||||||
selector: '.features-input',
|
selector: '.features-input',
|
||||||
|
|
@ -26,7 +26,8 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
}
|
},
|
||||||
|
...super.PARTS
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import DHBaseItemSheet from '../api/base-item.mjs';
|
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||||
|
import ItemAttachmentSheet from '../api/item-attachment-sheet.mjs';
|
||||||
|
|
||||||
export default class WeaponSheet extends DHBaseItemSheet {
|
export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['weapon'],
|
classes: ['weapon'],
|
||||||
|
|
@ -25,12 +26,13 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
}
|
},
|
||||||
|
...super.PARTS
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async _preparePartContext(partId, context) {
|
async _preparePartContext(partId, context) {
|
||||||
super._preparePartContext(partId, context);
|
await super._preparePartContext(partId, context);
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'settings':
|
case 'settings':
|
||||||
context.features = this.document.system.weaponFeatures.map(x => x.value);
|
context.features = this.document.system.weaponFeatures.map(x => x.value);
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true)
|
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true)
|
||||||
damage = Math.ceil(damage * (CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1));
|
damage = Math.ceil(damage * (CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1));
|
||||||
|
|
||||||
target.actor.takeDamage(damage, message.system.roll.type);
|
target.actor.takeDamage(damage, message.system.damage.damageType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,5 @@ export const encounterCountdown = {
|
||||||
simple: 'countdown-encounter-simple',
|
simple: 'countdown-encounter-simple',
|
||||||
position: 'countdown-encounter-position'
|
position: 'countdown-encounter-position'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const itemAttachmentSource = 'attachmentSource';
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,13 @@ export const damageTypes = {
|
||||||
id: 'physical',
|
id: 'physical',
|
||||||
label: 'DAGGERHEART.CONFIG.DamageType.physical.name',
|
label: 'DAGGERHEART.CONFIG.DamageType.physical.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.DamageType.physical.abbreviation',
|
abbreviation: 'DAGGERHEART.CONFIG.DamageType.physical.abbreviation',
|
||||||
icon: ['fa-hand-fist']
|
icon: 'fa-hand-fist'
|
||||||
},
|
},
|
||||||
magical: {
|
magical: {
|
||||||
id: 'magical',
|
id: 'magical',
|
||||||
label: 'DAGGERHEART.CONFIG.DamageType.magical.name',
|
label: 'DAGGERHEART.CONFIG.DamageType.magical.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.DamageType.magical.abbreviation',
|
abbreviation: 'DAGGERHEART.CONFIG.DamageType.magical.abbreviation',
|
||||||
icon: ['fa-wand-sparkles']
|
icon: 'fa-wand-sparkles'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ export const armorFeatures = {
|
||||||
img: 'icons/magic/defensive/barrier-shield-dome-pink.webp',
|
img: 'icons/magic/defensive/barrier-shield-dome-pink.webp',
|
||||||
changes: [
|
changes: [
|
||||||
{
|
{
|
||||||
key: 'system.bonuses.damageReduction.magical',
|
key: 'system.resistance.magical.reduction',
|
||||||
mode: 2,
|
mode: 2,
|
||||||
value: '@system.armorScore'
|
value: '@system.armorScore'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormula(actor) {
|
getFormula() {
|
||||||
/* const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : actor.system[this.multiplier]?.total;
|
|
||||||
return this.custom.enabled
|
|
||||||
? this.custom.formula
|
|
||||||
: `${multiplier ?? 1}${this.dice}${this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : ''}`; */
|
|
||||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`,
|
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`,
|
||||||
bonus = this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : '';
|
bonus = this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : '';
|
||||||
return this.custom.enabled ? this.custom.formula : `${multiplier ?? 1}${this.dice}${bonus}`;
|
return this.custom.enabled ? this.custom.formula : `${multiplier ?? 1}${this.dice}${bonus}`;
|
||||||
|
|
@ -93,7 +89,6 @@ export class DHDamageField extends fields.SchemaField {
|
||||||
parts: new fields.ArrayField(new fields.EmbeddedDataField(DHDamageData)),
|
parts: new fields.ArrayField(new fields.EmbeddedDataField(DHDamageData)),
|
||||||
includeBase: new fields.BooleanField({ initial: false })
|
includeBase: new fields.BooleanField({ initial: false })
|
||||||
};
|
};
|
||||||
// if (hasBase) damageFields.includeBase = new fields.BooleanField({ initial: true });
|
|
||||||
super(damageFields, options, context);
|
super(damageFields, options, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,15 +97,19 @@ export class DHDamageData extends foundry.abstract.DataModel {
|
||||||
/** @override */
|
/** @override */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
// ...super.defineSchema(),
|
|
||||||
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
||||||
type: new fields.StringField({
|
type: new fields.SetField(
|
||||||
choices: CONFIG.DH.GENERAL.damageTypes,
|
new fields.StringField({
|
||||||
initial: 'physical',
|
choices: CONFIG.DH.GENERAL.damageTypes,
|
||||||
label: 'Type',
|
initial: 'physical',
|
||||||
nullable: false,
|
nullable: false,
|
||||||
required: true
|
required: true
|
||||||
}),
|
}),
|
||||||
|
{
|
||||||
|
label: 'Type',
|
||||||
|
initial: 'physical'
|
||||||
|
}
|
||||||
|
),
|
||||||
resultBased: new fields.BooleanField({
|
resultBased: new fields.BooleanField({
|
||||||
initial: false,
|
initial: false,
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
||||||
|
|
|
||||||
|
|
@ -180,16 +180,9 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
getRollData(data = {}) {
|
getRollData(data = {}) {
|
||||||
const actorData = this.actor.getRollData(false);
|
const actorData = this.actor.getRollData(false);
|
||||||
|
|
||||||
// Remove when included directly in Actor getRollData
|
// Add Roll results to RollDatas
|
||||||
actorData.prof = actorData.proficiency?.total ?? 1;
|
|
||||||
actorData.cast = actorData.spellcast?.total ?? 1;
|
|
||||||
actorData.result = data.roll?.total ?? 1;
|
actorData.result = data.roll?.total ?? 1;
|
||||||
/* actorData.scale = data.costs?.length
|
|
||||||
? data.costs.reduce((a, c) => {
|
|
||||||
a[c.type] = c.value;
|
|
||||||
return a;
|
|
||||||
}, {})
|
|
||||||
: 1; */
|
|
||||||
actorData.scale = data.costs?.length // Right now only return the first scalable cost.
|
actorData.scale = data.costs?.length // Right now only return the first scalable cost.
|
||||||
? (data.costs.find(c => c.scalable)?.total ?? 1)
|
? (data.costs.find(c => c.scalable)?.total ?? 1)
|
||||||
: 1;
|
: 1;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollDamage(event, data) {
|
async rollDamage(event, data) {
|
||||||
let formula = this.damage.parts.map(p => this.getFormulaValue(p, data).getFormula(this.actor)).join(' + ');
|
let formula = this.damage.parts.map(p => this.getFormulaValue(p, data).getFormula(this.actor)).join(' + '),
|
||||||
|
damageTypes = [...new Set(this.damage.parts.reduce((a, c) => a.concat([...c.type]), []))];
|
||||||
|
|
||||||
|
damageTypes = !damageTypes.length ? ['physical'] : damageTypes;
|
||||||
|
|
||||||
if (!formula || formula == '') return;
|
if (!formula || formula == '') return;
|
||||||
let roll = { formula: formula, total: formula },
|
let roll = { formula: formula, total: formula },
|
||||||
|
|
@ -25,6 +28,7 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
hasSave: this.hasSave,
|
hasSave: this.hasSave,
|
||||||
isCritical: data.system?.roll?.isCritical ?? false,
|
isCritical: data.system?.roll?.isCritical ?? false,
|
||||||
source: data.system?.source,
|
source: data.system?.source,
|
||||||
|
damageTypes,
|
||||||
event
|
event
|
||||||
};
|
};
|
||||||
if (this.hasSave) config.onSave = this.save.damageMod;
|
if (this.hasSave) config.onSave = this.save.damageMod;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import BaseDataActor from './base.mjs';
|
||||||
const resourceField = () =>
|
const resourceField = () =>
|
||||||
new foundry.data.fields.SchemaField({
|
new foundry.data.fields.SchemaField({
|
||||||
value: new foundry.data.fields.NumberField({ initial: 0, integer: true }),
|
value: new foundry.data.fields.NumberField({ initial: 0, integer: true }),
|
||||||
|
bonus: new foundry.data.fields.NumberField({ initial: 0, integer: true }),
|
||||||
max: new foundry.data.fields.NumberField({ initial: 0, integer: true })
|
max: new foundry.data.fields.NumberField({ initial: 0, integer: true })
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -22,6 +23,7 @@ export default class DhpAdversary extends BaseDataActor {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
tier: new fields.StringField({
|
tier: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.tiers,
|
choices: CONFIG.DH.GENERAL.tiers,
|
||||||
|
|
@ -32,7 +34,6 @@ export default class DhpAdversary extends BaseDataActor {
|
||||||
choices: CONFIG.DH.ACTOR.adversaryTypes,
|
choices: CONFIG.DH.ACTOR.adversaryTypes,
|
||||||
initial: CONFIG.DH.ACTOR.adversaryTypes.standard.id
|
initial: CONFIG.DH.ACTOR.adversaryTypes.standard.id
|
||||||
}),
|
}),
|
||||||
description: new fields.StringField(),
|
|
||||||
motivesAndTactics: new fields.StringField(),
|
motivesAndTactics: new fields.StringField(),
|
||||||
notes: new fields.HTMLField(),
|
notes: new fields.HTMLField(),
|
||||||
difficulty: new fields.NumberField({ required: true, initial: 1, integer: true }),
|
difficulty: new fields.NumberField({ required: true, initial: 1, integer: true }),
|
||||||
|
|
@ -63,6 +64,7 @@ export default class DhpAdversary extends BaseDataActor {
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
{
|
{
|
||||||
|
type: ['physical'],
|
||||||
value: {
|
value: {
|
||||||
multiplier: 'flat'
|
multiplier: 'flat'
|
||||||
}
|
}
|
||||||
|
|
@ -93,4 +95,9 @@ export default class DhpAdversary extends BaseDataActor {
|
||||||
get features() {
|
get features() {
|
||||||
return this.parent.items.filter(x => x.type === 'feature');
|
return this.parent.items.filter(x => x.type === 'feature');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareDerivedData() {
|
||||||
|
this.resources.hitPoints.maxTotal = this.resources.hitPoints.max + this.resources.hitPoints.bonus;
|
||||||
|
this.resources.stress.maxTotal = this.resources.stress.max + this.resources.stress.bonus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
import DHBaseActorSettings from "../../applications/sheets/api/actor-setting.mjs";
|
import DHBaseActorSettings from '../../applications/sheets/api/actor-setting.mjs';
|
||||||
|
|
||||||
|
const resistanceField = () =>
|
||||||
|
new foundry.data.fields.SchemaField({
|
||||||
|
resistance: new foundry.data.fields.BooleanField({ initial: false }),
|
||||||
|
immunity: new foundry.data.fields.BooleanField({ initial: false }),
|
||||||
|
reduction: new foundry.data.fields.NumberField({ integer: true, initial: 0 })
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes metadata about the actor data model type
|
* Describes metadata about the actor data model type
|
||||||
|
|
@ -16,6 +23,7 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
||||||
type: 'base',
|
type: 'base',
|
||||||
isNPC: true,
|
isNPC: true,
|
||||||
settingSheet: null,
|
settingSheet: null,
|
||||||
|
hasResistances: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,10 +35,15 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
const schema = {};
|
||||||
|
|
||||||
return {
|
if (this.metadata.isNPC) schema.description = new fields.HTMLField({ required: true, nullable: true });
|
||||||
description: new fields.HTMLField({ required: true, nullable: true })
|
if (this.metadata.hasResistances)
|
||||||
};
|
schema.resistance = new fields.SchemaField({
|
||||||
|
physical: resistanceField(),
|
||||||
|
magical: resistanceField()
|
||||||
|
});
|
||||||
|
return schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
resources: new fields.SchemaField({
|
resources: new fields.SchemaField({
|
||||||
hitPoints: new fields.SchemaField({
|
hitPoints: new fields.SchemaField({
|
||||||
value: new foundry.data.fields.NumberField({ initial: 0, integer: true }),
|
value: new foundry.data.fields.NumberField({ initial: 0, integer: true }),
|
||||||
|
|
@ -98,10 +99,6 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
levelData: new fields.EmbeddedDataField(DhLevelData),
|
levelData: new fields.EmbeddedDataField(DhLevelData),
|
||||||
bonuses: new fields.SchemaField({
|
bonuses: new fields.SchemaField({
|
||||||
armorScore: new fields.NumberField({ integer: true, initial: 0 }),
|
armorScore: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
damageReduction: new fields.SchemaField({
|
|
||||||
physical: new fields.NumberField({ integer: true, initial: 0 }),
|
|
||||||
magical: new fields.NumberField({ integer: true, initial: 0 })
|
|
||||||
}),
|
|
||||||
damageThresholds: new fields.SchemaField({
|
damageThresholds: new fields.SchemaField({
|
||||||
severe: new fields.NumberField({ integer: true, initial: 0 }),
|
severe: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
major: new fields.NumberField({ integer: true, initial: 0 })
|
major: new fields.NumberField({ integer: true, initial: 0 })
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export default class DhCompanion extends BaseDataActor {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
partner: new ForeignDocumentUUIDField({ type: 'Actor' }),
|
partner: new ForeignDocumentUUIDField({ type: 'Actor' }),
|
||||||
resources: new fields.SchemaField({
|
resources: new fields.SchemaField({
|
||||||
stress: new fields.SchemaField({
|
stress: new fields.SchemaField({
|
||||||
|
|
@ -66,6 +67,7 @@ export default class DhCompanion extends BaseDataActor {
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
{
|
{
|
||||||
|
type: ['physical'],
|
||||||
value: {
|
value: {
|
||||||
dice: 'd6',
|
dice: 'd6',
|
||||||
multiplier: 'prof'
|
multiplier: 'prof'
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,21 @@ export default class DhEnvironment extends BaseDataActor {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
label: 'TYPES.Actor.environment',
|
label: 'TYPES.Actor.environment',
|
||||||
type: 'environment',
|
type: 'environment',
|
||||||
settingSheet: DHEnvironmentSettings
|
settingSheet: DHEnvironmentSettings,
|
||||||
|
hasResistances: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
tier: new fields.StringField({
|
tier: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.tiers,
|
choices: CONFIG.DH.GENERAL.tiers,
|
||||||
initial: CONFIG.DH.GENERAL.tiers.tier1.id
|
initial: CONFIG.DH.GENERAL.tiers.tier1.id
|
||||||
}),
|
}),
|
||||||
type: new fields.StringField({ choices: CONFIG.DH.ACTOR.environmentTypes }),
|
type: new fields.StringField({ choices: CONFIG.DH.ACTOR.environmentTypes }),
|
||||||
description: new fields.StringField(),
|
|
||||||
impulses: new fields.StringField(),
|
impulses: new fields.StringField(),
|
||||||
difficulty: new fields.NumberField({ required: true, initial: 11, integer: true }),
|
difficulty: new fields.NumberField({ required: true, initial: 11, integer: true }),
|
||||||
potentialAdversaries: new fields.TypedObjectField(
|
potentialAdversaries: new fields.TypedObjectField(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import DHAncestry from './ancestry.mjs';
|
import DHAncestry from './ancestry.mjs';
|
||||||
import DHArmor from './armor.mjs';
|
import DHArmor from './armor.mjs';
|
||||||
|
import DHAttachableItem from './attachableItem.mjs';
|
||||||
import DHClass from './class.mjs';
|
import DHClass from './class.mjs';
|
||||||
import DHCommunity from './community.mjs';
|
import DHCommunity from './community.mjs';
|
||||||
import DHConsumable from './consumable.mjs';
|
import DHConsumable from './consumable.mjs';
|
||||||
|
|
@ -13,6 +14,7 @@ import DHBeastform from './beastform.mjs';
|
||||||
export {
|
export {
|
||||||
DHAncestry,
|
DHAncestry,
|
||||||
DHArmor,
|
DHArmor,
|
||||||
|
DHAttachableItem,
|
||||||
DHClass,
|
DHClass,
|
||||||
DHCommunity,
|
DHCommunity,
|
||||||
DHConsumable,
|
DHConsumable,
|
||||||
|
|
@ -27,6 +29,7 @@ export {
|
||||||
export const config = {
|
export const config = {
|
||||||
ancestry: DHAncestry,
|
ancestry: DHAncestry,
|
||||||
armor: DHArmor,
|
armor: DHArmor,
|
||||||
|
attachableItem: DHAttachableItem,
|
||||||
class: DHClass,
|
class: DHClass,
|
||||||
community: DHCommunity,
|
community: DHCommunity,
|
||||||
consumable: DHConsumable,
|
consumable: DHConsumable,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import AttachableItem from './attachableItem.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ActionField from '../fields/actionField.mjs';
|
||||||
import { armorFeatures } from '../../config/itemConfig.mjs';
|
import { armorFeatures } from '../../config/itemConfig.mjs';
|
||||||
|
import { actionsTypes } from '../action/_module.mjs';
|
||||||
|
|
||||||
export default class DHArmor extends BaseDataItem {
|
export default class DHArmor extends AttachableItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static get metadata() {
|
static get metadata() {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
|
|
|
||||||
160
module/data/item/attachableItem.mjs
Normal file
160
module/data/item/attachableItem.mjs
Normal file
|
|
@ -0,0 +1,160 @@
|
||||||
|
import BaseDataItem from './base.mjs';
|
||||||
|
|
||||||
|
export default class AttachableItem extends BaseDataItem {
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
|
attached: new fields.ArrayField(new fields.DocumentUUIDField({ type: 'Item', nullable: true }))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async _preUpdate(changes, options, user) {
|
||||||
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
|
if (allowed === false) return false;
|
||||||
|
|
||||||
|
// Handle equipped status changes for attachment effects
|
||||||
|
if (changes.system?.equipped !== undefined && changes.system.equipped !== this.equipped) {
|
||||||
|
await this.#handleAttachmentEffectsOnEquipChange(changes.system.equipped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async #handleAttachmentEffectsOnEquipChange(newEquippedStatus) {
|
||||||
|
const actor = this.parent.parent?.type === 'character' ? this.parent.parent : this.parent.parent?.parent;
|
||||||
|
const parentType = this.parent.type;
|
||||||
|
|
||||||
|
if (!actor || !this.attached?.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newEquippedStatus) {
|
||||||
|
// Item is being equipped - add attachment effects
|
||||||
|
for (const attachedUuid of this.attached) {
|
||||||
|
const attachedItem = await fromUuid(attachedUuid);
|
||||||
|
if (attachedItem && attachedItem.effects.size > 0) {
|
||||||
|
await this.#copyAttachmentEffectsToActor({
|
||||||
|
attachedItem,
|
||||||
|
attachedUuid,
|
||||||
|
parentType
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Item is being unequipped - remove attachment effects
|
||||||
|
await this.#removeAllAttachmentEffects(parentType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async #copyAttachmentEffectsToActor({ attachedItem, attachedUuid, parentType }) {
|
||||||
|
const actor = this.parent.parent;
|
||||||
|
if (!actor || !attachedItem.effects.size > 0 || !this.equipped) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const effectsToCreate = [];
|
||||||
|
for (const effect of attachedItem.effects) {
|
||||||
|
const effectData = effect.toObject();
|
||||||
|
effectData.origin = `${this.parent.uuid}:${attachedUuid}`;
|
||||||
|
|
||||||
|
const attachmentSource = {
|
||||||
|
itemUuid: attachedUuid,
|
||||||
|
originalEffectId: effect.id
|
||||||
|
};
|
||||||
|
attachmentSource[`${parentType}Uuid`] = this.parent.uuid;
|
||||||
|
|
||||||
|
effectData.flags = {
|
||||||
|
...effectData.flags,
|
||||||
|
[CONFIG.DH.id]: {
|
||||||
|
...effectData.flags?.[CONFIG.DH.id],
|
||||||
|
[CONFIG.DH.FLAGS.itemAttachmentSource]: attachmentSource
|
||||||
|
}
|
||||||
|
};
|
||||||
|
effectsToCreate.push(effectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (effectsToCreate.length > 0) {
|
||||||
|
return await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
async #removeAllAttachmentEffects(parentType) {
|
||||||
|
const actor = this.parent.parent;
|
||||||
|
if (!actor) return;
|
||||||
|
|
||||||
|
const parentUuidProperty = `${parentType}Uuid`;
|
||||||
|
const effectsToRemove = actor.effects.filter(effect => {
|
||||||
|
const attachmentSource = effect.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.itemAttachmentSource);
|
||||||
|
return attachmentSource && attachmentSource[parentUuidProperty] === this.parent.uuid;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (effectsToRemove.length > 0) {
|
||||||
|
await actor.deleteEmbeddedDocuments(
|
||||||
|
'ActiveEffect',
|
||||||
|
effectsToRemove.map(e => e.id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public method for adding an attachment
|
||||||
|
*/
|
||||||
|
async addAttachment(droppedItem) {
|
||||||
|
const newUUID = droppedItem.uuid;
|
||||||
|
|
||||||
|
if (this.attached.includes(newUUID)) {
|
||||||
|
ui.notifications.warn(`${droppedItem.name} is already attached to this ${this.parent.type}.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedAttached = [...this.attached, newUUID];
|
||||||
|
await this.parent.update({
|
||||||
|
'system.attached': updatedAttached
|
||||||
|
});
|
||||||
|
|
||||||
|
// Copy effects if equipped
|
||||||
|
if (this.equipped && droppedItem.effects.size > 0) {
|
||||||
|
await this.#copyAttachmentEffectsToActor({
|
||||||
|
attachedItem: droppedItem,
|
||||||
|
attachedUuid: newUUID,
|
||||||
|
parentType: this.parent.type
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public method for removing an attachment
|
||||||
|
*/
|
||||||
|
async removeAttachment(attachedUuid) {
|
||||||
|
await this.parent.update({
|
||||||
|
'system.attached': this.attached.filter(uuid => uuid !== attachedUuid)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove effects
|
||||||
|
await this.#removeAttachmentEffects(attachedUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
async #removeAttachmentEffects(attachedUuid) {
|
||||||
|
const actor = this.parent.parent;
|
||||||
|
if (!actor) return;
|
||||||
|
|
||||||
|
const parentType = this.parent.type;
|
||||||
|
const parentUuidProperty = `${parentType}Uuid`;
|
||||||
|
const effectsToRemove = actor.effects.filter(effect => {
|
||||||
|
const attachmentSource = effect.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.itemAttachmentSource);
|
||||||
|
return (
|
||||||
|
attachmentSource &&
|
||||||
|
attachmentSource[parentUuidProperty] === this.parent.uuid &&
|
||||||
|
attachmentSource.itemUuid === attachedUuid
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (effectsToRemove.length > 0) {
|
||||||
|
await actor.deleteEmbeddedDocuments(
|
||||||
|
'ActiveEffect',
|
||||||
|
effectsToRemove.map(e => e.id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import AttachableItem from './attachableItem.mjs';
|
||||||
import { actionsTypes } from '../action/_module.mjs';
|
import { actionsTypes } from '../action/_module.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ActionField from '../fields/actionField.mjs';
|
||||||
|
|
||||||
export default class DHWeapon extends BaseDataItem {
|
export default class DHWeapon extends AttachableItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static get metadata() {
|
static get metadata() {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
|
|
@ -56,6 +56,7 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
{
|
{
|
||||||
|
type: ['physical'],
|
||||||
value: {
|
value: {
|
||||||
multiplier: 'prof',
|
multiplier: 'prof',
|
||||||
dice: 'd8'
|
dice: 'd8'
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@ export default class DamageRoll extends DHRoll {
|
||||||
super.postEvaluate(roll, config);
|
super.postEvaluate(roll, config);
|
||||||
config.roll.type = config.type;
|
config.roll.type = config.type;
|
||||||
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
config.roll.modifierTotal = this.calculateTotalModifiers(roll);
|
||||||
|
}
|
||||||
|
|
||||||
|
static async buildPost(roll, config, message) {
|
||||||
|
await super.buildPost(roll, config, message);
|
||||||
if (config.source?.message) {
|
if (config.source?.message) {
|
||||||
const chatMessage = ui.chat.collection.get(config.source.message);
|
const chatMessage = ui.chat.collection.get(config.source.message);
|
||||||
chatMessage.update({ 'system.damage': config });
|
chatMessage.update({ 'system.damage': config });
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ export default class DHRoll extends Roll {
|
||||||
|
|
||||||
// Create Chat Message
|
// Create Chat Message
|
||||||
if (config.source?.message) {
|
if (config.source?.message) {
|
||||||
|
if (game.modules.get('dice-so-nice')?.active) await game.dice3d.showForRoll(roll, game.user, true);
|
||||||
} else {
|
} else {
|
||||||
const messageData = {};
|
|
||||||
config.message = await this.toMessage(roll, config);
|
config.message = await this.toMessage(roll, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,44 @@
|
||||||
export default class DhActiveEffect extends ActiveEffect {
|
export default class DhActiveEffect extends ActiveEffect {
|
||||||
get isSuppressed() {
|
get isSuppressed() {
|
||||||
if (['weapon', 'armor'].includes(this.parent.type)) {
|
// If this is a copied effect from an attachment, never suppress it
|
||||||
|
// (These effects have attachmentSource metadata)
|
||||||
|
if (this.flags?.daggerheart?.attachmentSource) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then apply the standard suppression rules
|
||||||
|
if (['weapon', 'armor'].includes(this.parent?.type)) {
|
||||||
return !this.parent.system.equipped;
|
return !this.parent.system.equipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent.type === 'domainCard') {
|
if (this.parent?.type === 'domainCard') {
|
||||||
return this.parent.system.inVault;
|
return this.parent.system.inVault;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.isSuppressed;
|
return super.isSuppressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the parent item is currently attached to another item
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
get isAttached() {
|
||||||
|
if (!this.parent || !this.parent.parent) return false;
|
||||||
|
|
||||||
|
// Check if this item's UUID is in any actor's armor or weapon attachment lists
|
||||||
|
const actor = this.parent.parent;
|
||||||
|
if (!actor || !actor.items) return false;
|
||||||
|
|
||||||
|
return actor.items.some(item => {
|
||||||
|
return (
|
||||||
|
(item.type === 'armor' || item.type === 'weapon') &&
|
||||||
|
item.system?.attached &&
|
||||||
|
Array.isArray(item.system.attached) &&
|
||||||
|
item.system.attached.includes(this.parent.uuid)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async _preCreate(data, options, user) {
|
async _preCreate(data, options, user) {
|
||||||
const update = {};
|
const update = {};
|
||||||
if (!data.img) {
|
if (!data.img) {
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,10 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
getRollData() {
|
getRollData() {
|
||||||
return this.system;
|
const rollData = super.getRollData();
|
||||||
|
rollData.prof = this.system.proficiency?.total ?? 1;
|
||||||
|
rollData.cast = this.system.spellcast?.total ?? 1;
|
||||||
|
return rollData;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatRollModifier(roll) {
|
formatRollModifier(roll) {
|
||||||
|
|
@ -462,7 +465,7 @@ export default class DhpActor extends Actor {
|
||||||
const canUseArmor =
|
const canUseArmor =
|
||||||
this.system.armor &&
|
this.system.armor &&
|
||||||
this.system.armor.system.marks.value < this.system.armorScore &&
|
this.system.armor.system.marks.value < this.system.armorScore &&
|
||||||
this.system.armorApplicableDamageTypes[type];
|
type.every(t => this.system.armorApplicableDamageTypes[t] === true);
|
||||||
const canUseStress = Object.keys(this.system.rules.damageReduction.stressDamageReduction).reduce((acc, x) => {
|
const canUseStress = Object.keys(this.system.rules.damageReduction.stressDamageReduction).reduce((acc, x) => {
|
||||||
const rule = this.system.rules.damageReduction.stressDamageReduction[x];
|
const rule = this.system.rules.damageReduction.stressDamageReduction[x];
|
||||||
if (damageKeyToNumber(x) <= hpDamage) return acc || (rule.enabled && availableStress >= rule.cost);
|
if (damageKeyToNumber(x) <= hpDamage) return acc || (rule.enabled && availableStress >= rule.cost);
|
||||||
|
|
@ -480,11 +483,9 @@ export default class DhpActor extends Actor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const flatReduction = this.system.bonuses.damageReduction[type];
|
type = !Array.isArray(type) ? [type] : type;
|
||||||
const damage = Math.max(baseDamage - (flatReduction ?? 0), 0);
|
|
||||||
const hpDamage = this.convertDamageToThreshold(damage);
|
|
||||||
|
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.postDamageTreshold`, this, hpDamage, damage, type) === false) return null;
|
const hpDamage = this.calculateDamage(baseDamage, type);
|
||||||
|
|
||||||
if (!hpDamage) return;
|
if (!hpDamage) return;
|
||||||
|
|
||||||
|
|
@ -511,6 +512,38 @@ export default class DhpActor extends Actor {
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, damage, type) === false) return null;
|
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, damage, type) === false) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calculateDamage(baseDamage, type) {
|
||||||
|
if (Hooks.call(`${CONFIG.DH.id}.preCalculateDamage`, this, baseDamage, type) === false) return null;
|
||||||
|
|
||||||
|
/* if(this.system.resistance[type]?.immunity) return 0;
|
||||||
|
if(this.system.resistance[type]?.resistance) baseDamage = Math.ceil(baseDamage / 2); */
|
||||||
|
if (this.canResist(type, 'immunity')) return 0;
|
||||||
|
if (this.canResist(type, 'resistance')) baseDamage = Math.ceil(baseDamage / 2);
|
||||||
|
|
||||||
|
// const flatReduction = this.system.resistance[type].reduction;
|
||||||
|
const flatReduction = this.getDamageTypeReduction(type);
|
||||||
|
const damage = Math.max(baseDamage - (flatReduction ?? 0), 0);
|
||||||
|
const hpDamage = this.convertDamageToThreshold(damage);
|
||||||
|
|
||||||
|
if (Hooks.call(`${CONFIG.DH.id}.postCalculateDamage`, this, baseDamage, type) === false) return null;
|
||||||
|
|
||||||
|
return hpDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
canResist(type, resistance) {
|
||||||
|
if (!type) return 0;
|
||||||
|
return type.every(t => this.system.resistance[t]?.[resistance] === true);
|
||||||
|
}
|
||||||
|
|
||||||
|
getDamageTypeReduction(type) {
|
||||||
|
if (!type) return 0;
|
||||||
|
const reduction = Object.entries(this.system.resistance).reduce(
|
||||||
|
(a, [index, value]) => (type.includes(index) ? Math.min(value.reduction, a) : a),
|
||||||
|
Infinity
|
||||||
|
);
|
||||||
|
return reduction === Infinity ? 0 : reduction;
|
||||||
|
}
|
||||||
|
|
||||||
async takeHealing(resources) {
|
async takeHealing(resources) {
|
||||||
resources.forEach(r => (r.value *= -1));
|
resources.forEach(r => (r.value *= -1));
|
||||||
await this.modifyResource(resources);
|
await this.modifyResource(resources);
|
||||||
|
|
@ -577,18 +610,6 @@ export default class DhpActor extends Actor {
|
||||||
u.resources,
|
u.resources,
|
||||||
u.target.uuid
|
u.target.uuid
|
||||||
);
|
);
|
||||||
/* if (game.user.isGM) {
|
|
||||||
await u.target.update(u.resources);
|
|
||||||
} else {
|
|
||||||
await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
|
||||||
action: socketEvent.GMUpdate,
|
|
||||||
data: {
|
|
||||||
action: GMUpdateEvent.UpdateDocument,
|
|
||||||
uuid: u.target.uuid,
|
|
||||||
update: u.resources
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -236,16 +236,7 @@ Roll.replaceFormulaData = function (formula, data = {}, { missing, warn = false
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDamageKey = damage => {
|
export const getDamageKey = damage => {
|
||||||
switch (damage) {
|
return ['none', 'minor', 'major', 'severe'][damage];
|
||||||
case 3:
|
|
||||||
return 'severe';
|
|
||||||
case 2:
|
|
||||||
return 'major';
|
|
||||||
case 1:
|
|
||||||
return 'minor';
|
|
||||||
case 0:
|
|
||||||
return 'none';
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDamageLabel = damage => {
|
export const getDamageLabel = damage => {
|
||||||
|
|
@ -253,16 +244,12 @@ export const getDamageLabel = damage => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const damageKeyToNumber = key => {
|
export const damageKeyToNumber = key => {
|
||||||
switch (key) {
|
return {
|
||||||
case 'severe':
|
none: 0,
|
||||||
return 3;
|
minor: 1,
|
||||||
case 'major':
|
major: 2,
|
||||||
return 2;
|
severe: 3
|
||||||
case 'minor':
|
}[key];
|
||||||
return 1;
|
|
||||||
case 'none':
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function constructHTMLButton({
|
export default function constructHTMLButton({
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,40 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
multi-select {
|
||||||
|
position: relative;
|
||||||
|
height: 34px;
|
||||||
|
.tags {
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin: 5px;
|
||||||
|
height: inherit;
|
||||||
|
.tag {
|
||||||
|
box-shadow: 0 0 0 1.1em #e5e5e5 inset;
|
||||||
|
vertical-align: top;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0.3em 0 0.3em 0.5em;
|
||||||
|
color: black;
|
||||||
|
border-radius: 3px;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition: 0.13s ease-out;
|
||||||
|
height: 22px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
gap: 0.5em;
|
||||||
|
z-index: 1;
|
||||||
|
.remove {
|
||||||
|
font-size: 10px;
|
||||||
|
margin-inline: auto 4.6666666667px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
position: absolute;
|
||||||
|
height: inherit;
|
||||||
|
outline: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,4 @@
|
||||||
@import './inventory-fieldset-items.less';
|
@import './inventory-fieldset-items.less';
|
||||||
@import './prose-mirror.less';
|
@import './prose-mirror.less';
|
||||||
@import './filter-menu.less';
|
@import './filter-menu.less';
|
||||||
|
@import './tab-attachments.less';
|
||||||
|
|
|
||||||
7
styles/less/global/tab-attachments.less
Normal file
7
styles/less/global/tab-attachments.less
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
.daggerheart.dh-style {
|
||||||
|
.tab.attachments {
|
||||||
|
.attached-items {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
gap: 15px 0;
|
gap: 15px 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: 0;
|
||||||
|
|
||||||
.adversary-sidebar-sheet {
|
.adversary-sidebar-sheet {
|
||||||
grid-row: 1 / span 2;
|
grid-row: 1 / span 2;
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,11 @@
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
justify-items: center;
|
|
||||||
|
|
||||||
.status-label {
|
.status-label {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
gap: 15px 0;
|
gap: 15px 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: 0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
.character-sidebar-sheet {
|
.character-sidebar-sheet {
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,11 @@
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
justify-items: center;
|
|
||||||
|
|
||||||
.status-label {
|
.status-label {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
.status-number {
|
.status-number {
|
||||||
justify-items: center;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.status-value {
|
.status-value {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -85,6 +87,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
||||||
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
{{formGroup fields.origin value=source.origin rootId=rootId disabled=true}}
|
{{formGroup fields.origin value=source.origin rootId=rootId disabled=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if isItemEffect}}
|
{{#if isItemEffect}}
|
||||||
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=legacyTransfer.hint}}
|
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}}
|
{{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@
|
||||||
<div class='status-value'>
|
<div class='status-value'>
|
||||||
<p><input class="bar-input" name="system.resources.hitPoints.value" value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
<p><input class="bar-input" name="system.resources.hitPoints.value" value="{{source.system.resources.hitPoints.value}}" type="number"></p>
|
||||||
<p>/</p>
|
<p>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.hitPoints.max}}</p>
|
<p class="bar-label">{{source.system.resources.hitPoints.maxTotal}}</p>
|
||||||
</div>
|
</div>
|
||||||
<progress
|
<progress
|
||||||
class='progress-bar'
|
class='progress-bar'
|
||||||
value='{{source.system.resources.hitPoints.value}}'
|
value='{{source.system.resources.hitPoints.value}}'
|
||||||
max='{{source.system.resources.hitPoints.max}}'
|
max='{{source.system.resources.hitPoints.maxTotal}}'
|
||||||
></progress>
|
></progress>
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>HP</h4>
|
<h4>HP</h4>
|
||||||
|
|
@ -26,12 +26,12 @@
|
||||||
<div class='status-value'>
|
<div class='status-value'>
|
||||||
<p><input class="bar-input" name="system.resources.stress.value" value="{{source.system.resources.stress.value}}" type="number"></p>
|
<p><input class="bar-input" name="system.resources.stress.value" value="{{source.system.resources.stress.value}}" type="number"></p>
|
||||||
<p>/</p>
|
<p>/</p>
|
||||||
<p class="bar-label">{{source.system.resources.stress.max}}</p>
|
<p class="bar-label">{{source.system.resources.stress.maxTotal}}</p>
|
||||||
</div>
|
</div>
|
||||||
<progress
|
<progress
|
||||||
class='progress-bar stress-color'
|
class='progress-bar stress-color'
|
||||||
value='{{source.system.resources.stress.value}}'
|
value='{{source.system.resources.stress.value}}'
|
||||||
max='{{source.system.resources.stress.max}}'
|
max='{{source.system.resources.stress.maxTotal}}'
|
||||||
></progress>
|
></progress>
|
||||||
<div class="status-label">
|
<div class="status-label">
|
||||||
<h4>Stress</h4>
|
<h4>Stress</h4>
|
||||||
|
|
|
||||||
|
|
@ -1,66 +1,45 @@
|
||||||
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}">
|
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
|
||||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
|
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
|
||||||
<div class="item-label-wrapper">
|
<div class="item-label">
|
||||||
<div class="item-label {{#unless (and (not isSidebar) (or item.system.resource item.system.quantity))}}fullWidth{{/unless}}">
|
{{#if isCompanion}}
|
||||||
{{#if isCompanion}}
|
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
||||||
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
{{else}}
|
||||||
{{else}}
|
<div class="item-name">{{item.name}}</div>
|
||||||
<div class="item-name">{{item.name}}</div>
|
{{/if}}
|
||||||
{{/if}}
|
{{#if (eq type 'weapon')}}
|
||||||
{{#if (eq type 'weapon')}}
|
<div class="item-tags">
|
||||||
<div class="item-tags">
|
|
||||||
{{#if isSidebar}}
|
|
||||||
<div class="item-labels">
|
|
||||||
<div class="label">
|
|
||||||
{{!-- {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}} --}}
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
|
|
||||||
<span> - </span>
|
|
||||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
|
||||||
{{!-- ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) --}}
|
|
||||||
{{#with (lookup @root.config.GENERAL.damageTypes item.system.attack.damage.parts.0.type)}}
|
|
||||||
{{#each icon}}
|
|
||||||
<i class="fa-solid {{this}}"></i>
|
|
||||||
{{/each}}
|
|
||||||
{{/with}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
|
||||||
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}})
|
|
||||||
</div>
|
|
||||||
<div class="tag">
|
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if (eq type 'armor')}}
|
|
||||||
{{#if isSidebar}}
|
{{#if isSidebar}}
|
||||||
<div class="item-labels">
|
<div class="item-labels">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
{{!-- {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}} --}}
|
||||||
{{item.system.baseScore}}
|
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
|
||||||
|
<span> - </span>
|
||||||
|
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||||
|
{{!-- ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) --}}
|
||||||
|
{{#each item.system.attack.damage.parts.0.type as | type | }}
|
||||||
|
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||||
|
<i class="fa-solid {{icon}}"></i>
|
||||||
|
{{/with}}
|
||||||
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="item-tags">
|
<div class="tag">
|
||||||
<div class="tag">
|
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
||||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
</div>
|
||||||
{{item.system.baseScore}}
|
<div class="tag">
|
||||||
</div>
|
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
||||||
<div class="tag">
|
</div>
|
||||||
{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}:
|
<div class="tag">
|
||||||
{{item.system.baseThresholds.major}}
|
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||||
<span>/</span>
|
(
|
||||||
{{item.system.baseThresholds.severe}}
|
{{#each item.system.attack.damage.parts.0.type}}
|
||||||
</div>
|
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' this '.abbreviation')}}
|
||||||
|
{{/each}}
|
||||||
|
)
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
29
templates/sheets/global/tabs/tab-attachments.hbs
Normal file
29
templates/sheets/global/tabs/tab-attachments.hbs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<section
|
||||||
|
class='tab {{tabs.attachments.cssClass}} {{tabs.attachments.id}}'
|
||||||
|
data-tab='{{tabs.attachments.id}}'
|
||||||
|
data-group='{{tabs.attachments.group}}'
|
||||||
|
>
|
||||||
|
<fieldset class="one-column drop-section attachments-section">
|
||||||
|
<legend>{{localize tabs.attachments.label}}</legend>
|
||||||
|
|
||||||
|
{{#if attachedItems}}
|
||||||
|
<div class="attached-items">
|
||||||
|
{{#each attachedItems as |item|}}
|
||||||
|
<div class="inventory-item attached-item" data-uuid="{{item.uuid}}">
|
||||||
|
<img src="{{item.img}}" alt="{{item.name}}" class="item-img">
|
||||||
|
<div class="item-label">
|
||||||
|
<div class="item-name">{{item.name}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<a data-action="removeAttachment" data-uuid="{{item.uuid}}"><i class="fa-solid fa-trash remove-attachment"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="drop-area" data-drop-type="Item" style="width: 100%;">
|
||||||
|
<span>{{localize "DAGGERHEART.EFFECTS.Attachments.attachHint"}}</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
0
templates/sheets/items/weapon/attachments.hbs
Normal file
0
templates/sheets/items/weapon/attachments.hbs
Normal file
|
|
@ -15,7 +15,11 @@
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' source.system.attack.range '.name')}}
|
{{localize (concat 'DAGGERHEART.CONFIG.Range.' source.system.attack.range '.name')}}
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
{{source.system.attack.damage.parts.0.value.dice}}{{#if source.system.attack.damage.parts.0.value.bonus}} + {{source.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
{{source.system.attack.damage.parts.0.value.dice}}{{#if source.system.attack.damage.parts.0.value.bonus}} + {{source.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||||
({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' source.system.attack.damage.parts.0.type '.abbreviation')}})
|
(
|
||||||
|
{{#each source.system.attack.damage.parts.0.type}}
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' this '.abbreviation')}}
|
||||||
|
{{/each}}
|
||||||
|
)
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' source.system.burden)}}
|
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' source.system.burden)}}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue