Fixes an import from compendium error, as the imported document does not yet have any statistics when it has been dropped
Pull Request Check / testing (pull_request) Successful in 18s Details

feature/wounds
macniel 2025-10-11 14:05:07 +02:00
parent b781a1935b
commit ca847ac135
2 changed files with 24 additions and 15 deletions

View File

@ -158,22 +158,24 @@ export class CharacterSheet extends ActorSheet {
Object.values(actorData.items).forEach((item, index) => { Object.values(actorData.items).forEach((item, index) => {
if (item.type === "ActiveEffect") { if (item.type === "ActiveEffect") {
const effect = item.effects[0]; const effect = item.effects[0];
console.log(effect.changes);
const conditions = [] const conditions = []
effect.changes.forEach(change => {
if (change.key.indexOf("wunden") === -1) { if (effect) {
const key = change.key effect.changes.forEach(change => {
.replace(/system\./g, "") if (change.key.indexOf("wunden") === -1) {
.replace(/\.mod/g, "") const key = change.key
.replace(/attribute./g, "") .replace(/system\./g, "")
.replace(/.links/g, "(Links)") .replace(/\.mod/g, "")
.replace(/.rechts/g, "(Rechts)") .replace(/attribute./g, "")
const value = Number(change.value) > 0 ? "+" + change.value : change.value; .replace(/.links/g, "(Links)")
conditions.push( .replace(/.rechts/g, "(Rechts)")
`${key}${value}` const value = Number(change.value) > 0 ? "+" + change.value : change.value;
) conditions.push(
} `${key}${value}`
}) )
}
})
}
context.effects.push({ context.effects.push({
name: item.name, name: item.name,

View File

@ -781,6 +781,12 @@
<div class="tab effects" data-group="primary" data-tab="effects"> <div class="tab effects" data-group="primary" data-tab="effects">
<table class="effects"> <table class="effects">
<thead>
<th>Effekt</th>
<th>Veränderungen</th>
<th></th>
</thead>
<tbody>
{{#each this.effects}} {{#each this.effects}}
<tr> <tr>
<td> <td>
@ -792,6 +798,7 @@
class="fa-solid fa-trash"></i></button>{{/if}}</td> class="fa-solid fa-trash"></i></button>{{/if}}</td>
</tr> </tr>
{{/each}} {{/each}}
</tbody>
</table> </table>
</div> </div>