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) => {
if (item.type === "ActiveEffect") {
const effect = item.effects[0];
console.log(effect.changes);
const conditions = []
effect.changes.forEach(change => {
if (change.key.indexOf("wunden") === -1) {
const key = change.key
.replace(/system\./g, "")
.replace(/\.mod/g, "")
.replace(/attribute./g, "")
.replace(/.links/g, "(Links)")
.replace(/.rechts/g, "(Rechts)")
const value = Number(change.value) > 0 ? "+" + change.value : change.value;
conditions.push(
`${key}${value}`
)
}
})
if (effect) {
effect.changes.forEach(change => {
if (change.key.indexOf("wunden") === -1) {
const key = change.key
.replace(/system\./g, "")
.replace(/\.mod/g, "")
.replace(/attribute./g, "")
.replace(/.links/g, "(Links)")
.replace(/.rechts/g, "(Rechts)")
const value = Number(change.value) > 0 ? "+" + change.value : change.value;
conditions.push(
`${key}${value}`
)
}
})
}
context.effects.push({
name: item.name,

View File

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