mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Removed automatic deletion of features on delevel when not using levelup auto
This commit is contained in:
parent
ac16b00271
commit
6c258c6853
1 changed files with 78 additions and 72 deletions
|
|
@ -84,6 +84,8 @@ export default class DhpActor extends Actor {
|
||||||
|
|
||||||
await this.update({ 'system.levelData.level.changed': Math.min(newLevel, maxLevel) });
|
await this.update({ 'system.levelData.level.changed': Math.min(newLevel, maxLevel) });
|
||||||
} else {
|
} else {
|
||||||
|
const levelupAuto = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).levelupAuto;
|
||||||
|
|
||||||
const usedLevel = Math.max(newLevel, 1);
|
const usedLevel = Math.max(newLevel, 1);
|
||||||
if (newLevel < 1) {
|
if (newLevel < 1) {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.tooLowLevel'));
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.tooLowLevel'));
|
||||||
|
|
@ -95,6 +97,7 @@ export default class DhpActor extends Actor {
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
if (levelupAuto) {
|
||||||
const features = [];
|
const features = [];
|
||||||
const domainCards = [];
|
const domainCards = [];
|
||||||
const experiences = [];
|
const experiences = [];
|
||||||
|
|
@ -105,7 +108,9 @@ export default class DhpActor extends Actor {
|
||||||
.forEach(levelKey => {
|
.forEach(levelKey => {
|
||||||
const level = this.system.levelData.levelups[levelKey];
|
const level = this.system.levelData.levelups[levelKey];
|
||||||
const achievementCards = level.achievements.domainCards.map(x => x.itemUuid);
|
const achievementCards = level.achievements.domainCards.map(x => x.itemUuid);
|
||||||
const advancementCards = level.selections.filter(x => x.type === 'domainCard').map(x => x.itemUuid);
|
const advancementCards = level.selections
|
||||||
|
.filter(x => x.type === 'domainCard')
|
||||||
|
.map(x => x.itemUuid);
|
||||||
domainCards.push(...achievementCards, ...advancementCards);
|
domainCards.push(...achievementCards, ...advancementCards);
|
||||||
experiences.push(...Object.keys(level.achievements.experiences));
|
experiences.push(...Object.keys(level.achievements.experiences));
|
||||||
features.push(...level.selections.flatMap(x => x.features));
|
features.push(...level.selections.flatMap(x => x.features));
|
||||||
|
|
@ -176,6 +181,7 @@ export default class DhpActor extends Actor {
|
||||||
const itemCard = this.items.find(x => x.uuid === domainCard);
|
const itemCard = this.items.find(x => x.uuid === domainCard);
|
||||||
itemCard.delete();
|
itemCard.delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await this.update({
|
await this.update({
|
||||||
system: {
|
system: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue