Merged with main

This commit is contained in:
WBHarry 2025-09-07 01:01:53 +02:00
commit 2c6aabb97a
31 changed files with 175 additions and 122 deletions

View file

@ -66,7 +66,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
group: 'primary',
id: 'base',
icon: null,
label: 'Base'
label: 'DAGGERHEART.GENERAL.Tabs.base'
},
config: {
active: false,
@ -74,7 +74,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
group: 'primary',
id: 'config',
icon: null,
label: 'Configuration'
label: 'DAGGERHEART.GENERAL.Tabs.configuration'
},
effect: {
active: false,
@ -82,7 +82,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
group: 'primary',
id: 'effect',
icon: null,
label: 'Effect'
label: 'DAGGERHEART.GENERAL.Tabs.effects'
}
};

View file

@ -232,7 +232,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
* @protected
*/
async _prepareLoadoutContext(context, _options) {
context.cardView = !game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList);
context.cardView = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsCard);
}
/**
@ -722,8 +722,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
* @type {ApplicationClickAction}
*/
static async #toggleLoadoutView(_, button) {
const newAbilityView = button.dataset.value !== 'true';
await game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsList, newAbilityView);
const newAbilityView = button.dataset.value === 'true';
await game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.displayDomainCardsAsCard, newAbilityView);
this.render();
}

View file

@ -455,7 +455,7 @@ export default function DHApplicationMixin(Base) {
options.push({
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat',
icon: 'fa-solid fa-message',
callback: async target => (await getDocFromElement(target)).toChat(this.document.id)
callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid)
});
if (deletable)

View file

@ -1,4 +1,4 @@
export const displayDomainCardsAsList = 'displayDomainCardsAsList';
export const displayDomainCardsAsCard = 'displayDomainCardsAsCard';
export const narrativeCountdown = {
simple: 'countdown-narrative-simple',
position: 'countdown-narrative-position'

View file

@ -90,22 +90,22 @@ export const rangeInclusion = {
export const otherTargetTypes = {
friendly: {
id: 'friendly',
label: 'Friendly'
label: 'DAGGERHEART.CONFIG.TargetTypes.friendly'
},
hostile: {
id: 'hostile',
label: 'Hostile'
label: 'DAGGERHEART.CONFIG.TargetTypes.hostile'
},
any: {
id: 'any',
label: 'Any'
label: 'DAGGERHEART.CONFIG.TargetTypes.any'
}
};
export const targetTypes = {
self: {
id: 'self',
label: 'Self'
label: 'DAGGERHEART.CONFIG.TargetTypes.self'
},
...otherTargetTypes
};
@ -587,17 +587,17 @@ export const abilityCosts = {
},
hope: {
id: 'hope',
label: 'Hope',
label: 'DAGGERHEART.CONFIG.HealingType.hope.name',
group: 'TYPES.Actor.character'
},
armor: {
id: 'armor',
label: 'Armor Slot',
label: 'DAGGERHEART.CONFIG.HealingType.armor.name',
group: 'TYPES.Actor.character'
},
fear: {
id: 'fear',
label: 'Fear',
label: 'DAGGERHEART.CONFIG.HealingType.fear.name',
group: 'TYPES.Actor.adversary'
},
resource: itemAbilityCosts.resource

View file

@ -28,7 +28,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
actionType: new fields.StringField({
choices: CONFIG.DH.ITEM.actionTypes,
initial: 'action',
nullable: true
nullable: false,
required: true
})
};

View file

@ -218,7 +218,8 @@ export default class CostField extends fields.ArrayField {
* @returns
*/
static getRealCosts(costs) {
const realCosts = costs?.length ? costs.filter(c => c.enabled) : [];
const cloneCosts = foundry.utils.deepClone(costs),
realCosts = cloneCosts?.length ? cloneCosts.filter(c => c.enabled) : [];
let mergedCosts = [];
realCosts.forEach(c => {
const getCost = Object.values(mergedCosts).find(gc => gc.key === c.key);

View file

@ -176,7 +176,9 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
multiplier: new fields.StringField({
choices: CONFIG.DH.GENERAL.multiplierTypes,
initial: 'prof',
label: 'DAGGERHEART.ACTIONS.Config.damage.multiplier'
label: 'DAGGERHEART.ACTIONS.Config.damage.multiplier',
nullable: false,
required: true
}),
flatMultiplier: new fields.NumberField({
nullable: true,
@ -186,7 +188,9 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
dice: new fields.StringField({
choices: CONFIG.DH.GENERAL.diceTypes,
initial: 'd6',
label: 'DAGGERHEART.GENERAL.Dice.single'
label: 'DAGGERHEART.GENERAL.Dice.single',
nullable: false,
required: true
}),
bonus: new fields.NumberField({ nullable: true, initial: null, label: 'DAGGERHEART.GENERAL.bonus' }),
custom: new fields.SchemaField({

View file

@ -15,13 +15,17 @@ export class DHActionRollData extends foundry.abstract.DataModel {
bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }),
advState: new fields.StringField({
choices: CONFIG.DH.ACTIONS.advantageState,
initial: 'neutral'
initial: 'neutral',
nullable: false,
required: true
}),
diceRolling: new fields.SchemaField({
multiplier: new fields.StringField({
choices: CONFIG.DH.GENERAL.diceSetNumbers,
initial: 'prof',
label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier'
label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.multiplier',
nullable: false,
required: true
}),
flatMultiplier: new fields.NumberField({
nullable: true,
@ -31,7 +35,9 @@ export class DHActionRollData extends foundry.abstract.DataModel {
dice: new fields.StringField({
choices: CONFIG.DH.GENERAL.diceTypes,
initial: CONFIG.DH.GENERAL.diceTypes.d6,
label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.dice'
label: 'DAGGERHEART.ACTIONS.RollField.diceRolling.dice',
nullable: false,
required: true
}),
compare: new fields.StringField({
choices: CONFIG.DH.ACTIONS.diceCompare,

View file

@ -19,7 +19,9 @@ export default class SaveField extends fields.SchemaField {
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
damageMod: new fields.StringField({
initial: CONFIG.DH.ACTIONS.damageOnSave.none.id,
choices: CONFIG.DH.ACTIONS.damageOnSave
choices: CONFIG.DH.ACTIONS.damageOnSave,
nullable: false,
required: true
})
};
super(saveFields, options, context);

View file

@ -7,7 +7,8 @@ export default class TargetField extends fields.SchemaField {
type: new fields.StringField({
choices: CONFIG.DH.GENERAL.targetTypes,
initial: CONFIG.DH.GENERAL.targetTypes.any.id,
nullable: true
nullable: true,
blank: true
}),
amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 })
};

View file

@ -169,7 +169,7 @@ export const defaultLevelTiers = {
tiers: {
2: {
tier: 2,
name: 'Tier 2',
name: 'DAGGERHEART.APPLICATIONS.Levelup.tier2.name',
levels: {
start: 2,
end: 4
@ -232,7 +232,7 @@ export const defaultLevelTiers = {
},
3: {
tier: 3,
name: 'Tier 3',
name: 'DAGGERHEART.APPLICATIONS.Levelup.tier3.name',
levels: {
start: 5,
end: 7
@ -313,7 +313,7 @@ export const defaultLevelTiers = {
},
4: {
tier: 4,
name: 'Tier 4',
name: 'DAGGERHEART.APPLICATIONS.Levelup.tier4.name',
levels: {
start: 8,
end: 10

View file

@ -234,7 +234,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
const subclassInTier = subclasses.some(x => x.tier === Number(tierKey));
return {
name: tier.name,
name: game.i18n.localize(tier.name),
active: this.currentLevel >= Math.min(...tier.belongingLevels),
groups: Object.keys(tier.options).map(optionKey => {
const option = tier.options[optionKey];

View file

@ -9,12 +9,12 @@ export default function DhDualityRollEnricher(match, _options) {
}
function getDualityMessage(roll, flavor) {
const trait = roll.trait && abilities[roll.trait] ? game.i18n.localize(abilities[roll.trait].label) : null;
const trait = roll?.trait && abilities[roll.trait] ? game.i18n.localize(abilities[roll.trait].label) : null;
const label =
flavor ??
(roll.trait
(roll?.trait
? game.i18n.format('DAGGERHEART.GENERAL.rollWith', { roll: trait })
: roll.reaction
: roll?.reaction
? game.i18n.localize('DAGGERHEART.GENERAL.reactionRoll')
: game.i18n.localize('DAGGERHEART.GENERAL.duality'));
@ -22,9 +22,9 @@ function getDualityMessage(roll, flavor) {
? game.i18n.localize(abilities[roll.trait].label)
: game.i18n.localize('DAGGERHEART.GENERAL.duality');
const advantage = roll.advantage
const advantage = roll?.advantage
? CONFIG.DH.ACTIONS.advantageState.advantage.value
: roll.disadvantage
: roll?.disadvantage
? CONFIG.DH.ACTIONS.advantageState.disadvantage.value
: undefined;
const advantageLabel =
@ -36,21 +36,21 @@ function getDualityMessage(roll, flavor) {
const dualityElement = document.createElement('span');
dualityElement.innerHTML = `
<button type="button" class="duality-roll-button${roll.inline ? ' inline' : ''}"
<button type="button" class="duality-roll-button${roll?.inline ? ' inline' : ''}"
data-title="${label}"
data-label="${dataLabel}"
data-reaction="${roll.reaction ? 'true' : 'false'}"
data-hope="${roll.hope ?? 'd12'}"
data-fear="${roll.fear ?? 'd12'}"
data-reaction="${roll?.reaction ? 'true' : 'false'}"
data-hope="${roll?.hope ?? 'd12'}"
data-fear="${roll?.fear ?? 'd12'}"
${advantage ? `data-advantage="${advantage}"` : ''}
${roll.difficulty !== undefined ? `data-difficulty="${roll.difficulty}"` : ''}
${roll.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''}
${roll.advantage ? 'data-advantage="true"' : ''}
${roll.disadvantage ? 'data-disadvantage="true"' : ''}
${roll?.difficulty !== undefined ? `data-difficulty="${roll.difficulty}"` : ''}
${roll?.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''}
${roll?.advantage ? 'data-advantage="true"' : ''}
${roll?.disadvantage ? 'data-disadvantage="true"' : ''}
>
${roll.reaction ? '<i class="fa-solid fa-reply"></i>' : '<i class="fa-solid fa-circle-half-stroke"></i>'}
${roll?.reaction ? '<i class="fa-solid fa-reply"></i>' : '<i class="fa-solid fa-circle-half-stroke"></i>'}
${label}
${!flavor && (roll.difficulty || advantageLabel) ? `(${[roll.difficulty, advantageLabel ? game.i18n.localize(`DAGGERHEART.GENERAL.${advantageLabel}.short`) : null].filter(x => x).join(' ')})` : ''}
${!flavor && (roll?.difficulty || advantageLabel) ? `(${[roll.difficulty, advantageLabel ? game.i18n.localize(`DAGGERHEART.GENERAL.${advantageLabel}.short`) : null].filter(x => x).join(' ')})` : ''}
</button>
`;