Fixed subclass effects

This commit is contained in:
WBHarry 2025-06-21 22:39:53 +02:00
parent c15d55a505
commit 51f9b5d5c1
4 changed files with 26 additions and 18 deletions

View file

@ -300,9 +300,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
return {
armor: characterGuide.suggestedArmor ?? null,
primaryWeapon: characterGuide.suggestedPrimaryWeapon ?? null,
secondaryWeapon:
{ ...characterGuide.suggestedSecondaryWeapon, uuid: characterGuide.suggestedSecondaryWeapon.uuid } ??
null,
secondaryWeapon: characterGuide.suggestedSecondaryWeapon
? { ...characterGuide.suggestedSecondaryWeapon, uuid: characterGuide.suggestedSecondaryWeapon.uuid }
: null,
inventory: {
take: inventory.take ?? [],
choiceA:
@ -399,11 +399,19 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
const data = TextEditor.getDragEventData(event);
const item = await foundry.utils.fromUuid(data.uuid);
if (item.type === 'ancestry' && event.target.closest('.ancestry-card')) {
this.setup.ancestry = { ...item, uuid: item.uuid };
this.setup.ancestry = {
...item,
effects: Array.from(item.effects).map(x => x.toObject()),
uuid: item.uuid
};
} else if (item.type === 'community' && event.target.closest('.community-card')) {
this.setup.community = { ...item, uuid: item.uuid };
this.setup.community = {
...item,
effects: Array.from(item.effects).map(x => x.toObject()),
uuid: item.uuid
};
} else if (item.type === 'class' && event.target.closest('.class-card')) {
this.setup.class = { ...item, uuid: item.uuid };
this.setup.class = { ...item, effects: Array.from(item.effects).map(x => x.toObject()), uuid: item.uuid };
this.setup.subclass = {};
this.setup.domainCards = {
[foundry.utils.randomID()]: {},
@ -417,7 +425,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
return;
}
this.setup.subclass = { ...item, uuid: item.uuid };
this.setup.subclass = {
...item,
effects: Array.from(item.effects).map(x => x.toObject()),
uuid: item.uuid
};
} else if (item.type === 'domainCard' && event.target.closest('.domain-card')) {
if (!this.setup.class.uuid) {
ui.notifications.error(game.i18n.localize('DAGGERHEART.CharacterCreation.Notifications.MissingClass'));

View file

@ -302,7 +302,7 @@ export class EncounterCountdowns extends Countdowns {
}
export const registerCountdownApplicationHooks = () => {
const updateCountdowns = async shouldIncrease => {
const updateCountdowns = async shouldProgress => {
if (game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Automation).countdowns) {
const countdownSetting = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns);
for (let countdownCategoryKey in countdownSetting) {
@ -310,10 +310,10 @@ export const registerCountdownApplicationHooks = () => {
for (let countdownKey in countdownCategory.countdowns) {
const countdown = countdownCategory.countdowns[countdownKey];
if (shouldIncrease(countdown)) {
if (shouldProgress(countdown)) {
await countdownSetting.updateSource({
[`${countdownCategoryKey}.countdowns.${countdownKey}.progress.current`]:
countdown.progress.current + 1
countdown.progress.current - 1
});
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Countdowns, countdownSetting);
foundry.applications.instances.get(`${countdownCategoryKey}-countdowns`)?.render();
@ -326,18 +326,14 @@ export const registerCountdownApplicationHooks = () => {
Hooks.on(SYSTEM.HOOKS.characterAttack, async () => {
updateCountdowns(countdown => {
return (
countdown.progress.type.value === countdownTypes.characterAttack.id &&
countdown.progress.current < countdown.progress.max
countdown.progress.type.value === countdownTypes.characterAttack.id && countdown.progress.current > 0
);
});
});
Hooks.on(SYSTEM.HOOKS.spotlight, async () => {
updateCountdowns(countdown => {
return (
countdown.progress.type.value === countdownTypes.spotlight.id &&
countdown.progress.current < countdown.progress.max
);
return countdown.progress.type.value === countdownTypes.spotlight.id && countdown.progress.current > 0;
});
});
};