Compare commits

..

No commits in common. "8abc94a7da097d5d37eb4c9c0a174a6a7ded3b49" and "a1d312432126e014cdd3a59bacd89746b4e8b88d" have entirely different histories.

10 changed files with 44 additions and 62 deletions

View file

@ -2010,8 +2010,7 @@
"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."
},
"OriginTag": "Origin: {name}"
}
},
"GENERAL": {
"Ability": {

View file

@ -603,7 +603,7 @@ export default function DHApplicationMixin(Base) {
const doc = await fromUuid(itemUuid);
//get inventory-item description element
const descriptionElement = el.querySelector('.inventory-description');
const descriptionElement = el.querySelector('.invetory-description');
if (!doc || !descriptionElement) continue;
// localize the description (idk if it's still necessary)

View file

@ -54,10 +54,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return {};
}
get hasDescription() {
return Boolean(this.description);
}
/**
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
*
@ -352,31 +348,29 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
'system.bonuses.roll.spellcast.bonus'
];
const results = [];
const applicableEffects = await actor.allApplicableEffects({ noTransferArmor: true, noSelfArmor: true });
for (const effect of [...applicableEffects].filter(e => !e.isSuppressed)) {
if (effect.parent.type === 'weapon') {
// Effects on weapons only ever apply for the weapon itself (with a few exceptions)
const restricted =
effect.parent.system.secondary
// Secondary applies only to other primary weapons
? effectParent?.type !== 'weapon' || effectParent?.system.secondary
// Primary only applies to itself
: effectParent?.id !== effect.parent.id;
if (restricted) {
const sourceChanges = effect._source.system.changes;
const changes = sourceChanges.filter(x => weaponTransferredEffectKeys.includes(x.key));
if (changes.length) {
results.push(effect.clone({ 'system.changes': changes }));
return Array.from(await actor.allApplicableEffects({ noTransferArmor: true, noSelfArmor: true })).reduce(
(acc, effect) => {
const effectData = effect.toObject();
/* Effects on weapons only ever apply for the weapon itself, with a few defined exceptions */
if (effect.parent.type === 'weapon') {
/* Unless they're secondary - then they apply only to other primary weapons */
if (effect.parent.system.secondary) {
if (effectParent?.type !== 'weapon' || effectParent?.system.secondary) {
effectData.system.changes =
effectData.system.changes.filter(x => weaponTransferredEffectKeys.includes(x.key));
}
} else if (effectParent?.id !== effect.parent.id) {
effectData.system.changes =
effectData.system.changes.filter(x => weaponTransferredEffectKeys.includes(x.key));
}
continue;
}
}
results.push(effect);
}
if (!effect.isSuppressed) {
acc.push(effectData);
}
return results;
return acc;
}, []);
}
/**

View file

@ -65,10 +65,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
);
}
get hasDescription() {
return Boolean(this.description);
}
/* -------------------------------------------- */
/* Event Handlers */
/* -------------------------------------------- */
@ -228,13 +224,12 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
* @returns {string[]} An array of localized tag strings.
*/
_getTags() {
const tags = [];
const originActor = DhActiveEffect.#resolveParentDocument(fromUuidSync(this.origin, { strict: false }), Actor);
if (originActor && originActor !== this.actor) {
tags.push(_loc('DAGGERHEART.EFFECTS.OriginTag', { name: originActor.name }));
} else if (!(this.parent instanceof Actor)) {
tags.push(`${_loc(this.parent.system.metadata.label)}: ${this.parent.name}`);
}
const tags = [
`${game.i18n.localize(this.parent.system.metadata.label)}: ${this.parent.name}`,
game.i18n.localize(
this.isTemporary ? 'DAGGERHEART.EFFECTS.Duration.temporary' : 'DAGGERHEART.EFFECTS.Duration.passive'
)
];
for (const statusId of this.statuses) {
const status = CONFIG.statusEffects.find(s => s.id === statusId);

View file

@ -46,9 +46,7 @@ export default class DhpCombat extends Combat {
for (let actor of actors) {
await actor.createEmbeddedDocuments(
'ActiveEffect',
effects
.filter(x => x.effectTargetTypes.includes(actor.type))
.map(x => foundry.utils.deepClone(x))
effects.filter(x => x.effectTargetTypes.includes(actor.type))
);
}
} else {

View file

@ -89,10 +89,6 @@ export default class DHItem extends foundry.documents.Item {
return !pack?.locked && this.isOwner && isValidType && hasActions;
}
get hasDescription() {
return Boolean(this.system.description);
}
/** @inheritdoc */
static async createDialog(data = {}, createOptions = {}, options = {}) {
const { folders, types, template, context = {}, ...dialogOptions } = options;

View file

@ -54,8 +54,10 @@
margin-left: 10px;
display: inline-block;
}
.item-main {
background: light-dark(@dark-blue-40, @golden-40);
&:has(.inventory-item-content.extensible) {
.item-main {
background: light-dark(@dark-blue-40, @golden-40);
}
}
&:has(.inventory-item-content.extended) {
.inventory-item-header .item-label .item-name .expanded-icon {
@ -161,7 +163,7 @@
grid-template-rows: 1fr;
padding-top: 4px;
}
.inventory-description {
.invetory-description {
overflow: hidden;
h1 {

View file

@ -3,8 +3,6 @@
.application.daggerheart {
prose-mirror {
--menu-padding: 4px 0px;
--menu-height: calc(var(--menu-button-height) + 8px);
height: 100% !important;
width: 100%;

View file

@ -2,7 +2,7 @@
"id": "daggerheart",
"title": "Daggerheart",
"description": "An unofficial implementation of the Daggerheart system",
"version": "2.4.1",
"version": "2.4.0",
"compatibility": {
"minimum": "14.364",
"verified": "14.364",
@ -10,7 +10,7 @@
},
"url": "https://github.com/Foundryborne/daggerheart",
"manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json",
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.1/system.zip",
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.0/system.zip",
"authors": [
{
"name": "WBHarry"

View file

@ -26,7 +26,7 @@ Parameters:
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
>
<div class="item-main">
<div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.hasDescription))}}data-action="toggleExtended" {{/unless}}>
<div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.system.description))}}data-action="toggleExtended" {{/unless}}>
{{!-- Image --}}
<div class="img-portait" draggable="true"
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
@ -44,7 +44,7 @@ Parameters:
{{!-- Name & Tags --}}
<div class="item-label" draggable="true">
{{!-- Item Name --}}
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.hasDescription))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
{{!-- Tags Start --}}
{{#if (not hideTags)}}
@ -130,12 +130,12 @@ Parameters:
</div>
{{/unless}}
</div>
{{#unless hideDescription}}
<div class="inventory-item-content{{#unless (or noExtensible (not item.hasDescription))}} extensible{{/unless}}">
{{!-- Description --}}
<div class="inventory-description"></div>
</div>
{{/unless}}
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}">
{{!-- Description --}}
{{#unless hideDescription}}
<div class="invetory-description"></div>
{{/unless}}
</div>
</div>
{{!-- Dice Resource --}}
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}