Fix conflict

This commit is contained in:
Dapoolp 2025-06-27 18:01:49 +02:00
commit 38d228c53e
20 changed files with 324 additions and 70 deletions

View file

@ -4,6 +4,10 @@ export default class DhActiveEffect extends ActiveEffect {
return !this.parent.system.equipped;
}
if (this.parent.type === 'domainCard') {
return this.parent.system.inVault;
}
return super.isSuppressed;
}

View file

@ -29,10 +29,22 @@ export default class DhpActor extends Actor {
if (this.type !== 'character' || newLevel === this.system.levelData.level.changed) return;
if (newLevel > this.system.levelData.level.current) {
await this.update({ 'system.levelData.level.changed': newLevel });
const maxLevel = Object.values(
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.LevelTiers).tiers
).reduce((acc, tier) => Math.max(acc, tier.levels.end), 0);
if (newLevel > maxLevel) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.Sheets.PC.Errors.tooHighLevel'));
}
await this.update({ 'system.levelData.level.changed': Math.min(newLevel, maxLevel) });
} else {
const usedLevel = Math.max(newLevel, 1);
if (newLevel < 1) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.Sheets.PC.Errors.tooLowLevel'));
}
const updatedLevelups = Object.keys(this.system.levelData.levelups).reduce((acc, level) => {
if (Number(level) > newLevel) acc[`-=${level}`] = null;
if (Number(level) > usedLevel) acc[`-=${level}`] = null;
return acc;
}, {});
@ -42,7 +54,7 @@ export default class DhpActor extends Actor {
const subclassFeatureState = { class: null, multiclass: null };
let multiclass = null;
Object.keys(this.system.levelData.levelups)
.filter(x => x > newLevel)
.filter(x => x > usedLevel)
.forEach(levelKey => {
const level = this.system.levelData.levelups[levelKey];
const achievementCards = level.achievements.domainCards.map(x => x.itemUuid);
@ -103,8 +115,8 @@ export default class DhpActor extends Actor {
system: {
levelData: {
level: {
current: newLevel,
changed: newLevel
current: usedLevel,
changed: usedLevel
},
levelups: updatedLevelups
}
@ -400,7 +412,7 @@ export default class DhpActor extends Actor {
}
async takeHealing(resources) {
resources.forEach(r => r.value *= -1);
resources.forEach(r => (r.value *= -1));
await this.modifyResource(resources);
}
@ -410,16 +422,16 @@ export default class DhpActor extends Actor {
resources.forEach(r => {
switch (r.type) {
case 'armorStack':
updates.armor.resources['system.marks.value'] = Math.max(Math.min(
this.system.armor.system.marks.value + r.value,
this.system.armorScore
), 0);
updates.armor.resources['system.marks.value'] = Math.max(
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
0
);
break;
default:
updates.actor.resources[`system.resources.${r.type}.value`] = Math.max(Math.min(
this.system.resources[r.type].value + r.value,
this.system.resources[r.type].max
), 0);
updates.actor.resources[`system.resources.${r.type}.value`] = Math.max(
Math.min(this.system.resources[r.type].value + r.value, this.system.resources[r.type].max),
0
);
break;
}
});