Merge branch 'main' into feature/517-action-cost-on-success

This commit is contained in:
Dapoolp 2025-08-03 15:12:18 +02:00
commit 99af4a41d3
123 changed files with 11736 additions and 428 deletions

View file

@ -93,7 +93,7 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
const adversaries = foundry.utils.getProperty(this.actor, path);
const newAdversaries = adversaries.filter(a => a.uuid !== doc.uuid);
await this.actor.update({ [path]: newAdversaries });
await this.actor.update({ [path]: newAdversaries.map(x => x.uuid) });
}
async _onDragStart(event) {

View file

@ -223,7 +223,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
if (!confirmed) return;
}
const target = event.target.closest('button[data-die-index]');
const target = event.target.closest('[data-die-index]');
let originalRoll_parsed = message.rolls.map(roll => JSON.parse(roll))[0];
const rollClass =
game.system.api.dice[

View file

@ -9,3 +9,7 @@ export const encounterCountdown = {
};
export const itemAttachmentSource = 'attachmentSource';
export const userFlags = {
welcomeMessage: 'welcome-message'
};

View file

@ -1,3 +1,7 @@
export const compendiumJournals = {
welcome: 'Compendium.daggerheart.journals.JournalEntry.g7NhKvwltwafmMyR'
};
export const range = {
self: {
id: 'self',

View file

@ -69,7 +69,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
}
get hitTargets() {
return this.currentTargets.filter(t => (t.hit || !this.targetSelection));
return this.currentTargets.filter(t => (t.hit || !this.hasRoll || !this.targetSelection));
}
async updateTargets() {
@ -120,6 +120,8 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
}
if(this.hasSave) this.setPendingSaves();
}
this.canViewSecret = this.parent.speakerActor?.testUserPermission(game.user, 'OBSERVER');
}
getTargetList() {

View file

@ -1,5 +1,4 @@
export { default as D20Roll } from './d20Roll.mjs';
export { default as DamageRoll } from './damageRoll.mjs';
export { default as DHRoll } from './dhRoll.mjs';
export { default as DualityDie } from './dualityDie.mjs';
export { default as DualityRoll } from './dualityRoll.mjs';

View file

@ -170,7 +170,8 @@ export default class D20Roll extends DHRoll {
.map(d => {
return {
dice: d.denomination,
value: d.total
value: d.total,
results: d.results
};
});
data.modifierTotal = this.calculateTotalModifiers(roll);

View file

@ -1,5 +0,0 @@
export default class DualityDie extends foundry.dice.terms.Die {
constructor({ number = 1, faces = 12, ...args } = {}) {
super({ number, faces, ...args });
}
}

View file

@ -25,26 +25,26 @@ export default class DualityRoll extends D20Roll {
get dHope() {
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.dice[0];
// return this.#hopeDice;
}
set dHope(faces) {
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
this.terms[0].faces = this.getFaces(faces);
// this.#hopeDice = `d${face}`;
}
get dFear() {
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
if (!(this.dice[1] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.dice[1];
// return this.#fearDice;
}
set dFear(faces) {
if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
if (!(this.dice[1] instanceof foundry.dice.terms.Die)) this.createBaseDice();
this.dice[1].faces = this.getFaces(faces);
// this.#fearDice = `d${face}`;
}
@ -119,22 +119,22 @@ export default class DualityRoll extends D20Roll {
/** @inheritDoc */
static fromData(data) {
data.terms[0].class = game.system.api.dice.DualityDie.name;
data.terms[2].class = game.system.api.dice.DualityDie.name;
data.terms[0].class = foundry.dice.terms.Die.name;
data.terms[2].class = foundry.dice.terms.Die.name;
return super.fromData(data);
}
createBaseDice() {
if (
this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie &&
this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie
this.dice[0] instanceof foundry.dice.terms.Die &&
this.dice[1] instanceof foundry.dice.terms.Die
) {
this.terms = [this.terms[0], this.terms[1], this.terms[2]];
return;
}
this.terms[0] = new CONFIG.Dice.daggerheart.DualityDie();
this.terms[0] = new foundry.dice.terms.Die({ faces: 12 });
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
this.terms[2] = new CONFIG.Dice.daggerheart.DualityDie();
this.terms[2] = new foundry.dice.terms.Die({ faces: 12 });
}
applyAdvantage() {

View file

@ -597,7 +597,7 @@ export default class DhpActor extends Actor {
async modifyResource(resources) {
if (!resources.length) return;
if (resources.find(r => r.type === 'stress')) this.convertStressDamageToHP(resources);
if (resources.find(r => r.key === 'stress')) this.convertStressDamageToHP(resources);
let updates = {
actor: { target: this, resources: {} },
armor: { target: this.system.armor, resources: {} },
@ -664,14 +664,14 @@ export default class DhpActor extends Actor {
}
convertStressDamageToHP(resources) {
const stressDamage = resources.find(r => r.type === 'stress'),
const stressDamage = resources.find(r => r.key === 'stress'),
newValue = this.system.resources.stress.value + stressDamage.value;
if (newValue <= this.system.resources.stress.max) return;
const hpDamage = resources.find(r => r.type === 'hitPoints');
const hpDamage = resources.find(r => r.key === 'hitPoints');
if (hpDamage) hpDamage.value++;
else
resources.push({
type: 'hitPoints',
key: 'hitPoints',
value: 1
});
}