Compare commits

..

No commits in common. "4558fbdcf618314c1460360377015b3229e17b0c" and "b186f22cc71dc321dd009540a0dc5337c7242ce3" have entirely different histories.

16 changed files with 112 additions and 105 deletions

View file

@ -64,7 +64,7 @@ You can find the documentation here: https://github.com/Foundryborne/daggerheart
## Contributing
Looking to contribute to the project? Look no further, check out our [contributing guide](CONTRIBUTING.md), and keep the [Code of Conduct](coc.md) in mind when working on things.
Looking to contribute to the project? Look no further, check out our [contributing guide](contributing.md), and keep the [Code of Conduct](coc.md) in mind when working on things.
## Disclaimer:

View file

@ -342,8 +342,7 @@ Hooks.on(CONFIG.DH.HOOKS.hooksConfig.tagTeamStart, async data => {
const party = game.actors.get(data.partyId);
if (!party) return;
const TagTeamDialog = game.system.api.applications.dialogs.TagTeamDialog;
const dialog = foundry.applications.instances.get(`TagTeamDialog-${party.id}`) ?? new TagTeamDialog(party);
const dialog = new game.system.api.applications.dialogs.TagTeamDialog(party);
dialog.tabGroups.application = 'tagTeamRoll';
await dialog.render({ force: true });
}
@ -354,8 +353,7 @@ Hooks.on(CONFIG.DH.HOOKS.hooksConfig.groupRollStart, async data => {
const party = game.actors.get(data.partyId);
if (!party) return;
const GroupRollDialog = game.system.api.applications.dialogs.GroupRollDialog;
const dialog = foundry.applications.instances.get(`GroupRollDialog-${party.id}`) ?? new GroupRollDialog(party);
const dialog = new game.system.api.applications.dialogs.GroupRollDialog(party);
dialog.tabGroups.application = 'groupRoll';
await dialog.render({ force: true });
}

View file

@ -22,10 +22,9 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
);
const orderedArmorSources = getArmorSources(actor).filter(s => !s.disabled);
const armor = orderedArmorSources.reduce((acc, { name, document }) => {
const armor = orderedArmorSources.reduce((acc, { document }) => {
const { current, max } = document.type === 'armor' ? document.system.armor : document.system.armorData;
acc.push({
name,
effect: document,
marks: [...Array(max).keys()].reduce((acc, _, index) => {
const spent = index < current;
@ -153,8 +152,14 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
const armorSources = [];
for (const source of this.marks.armor) {
const parent = source.effect.origin
? await foundry.utils.fromUuid(source.effect.origin)
: source.effect.parent;
const useEffectName = parent.type === 'armor' || parent instanceof Actor;
const label = useEffectName ? source.effect.name : parent.name;
armorSources.push({
label: source.name,
label: label,
uuid: source.effect.uuid,
marks: source.marks
});

View file

@ -6,7 +6,7 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class GroupRollDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(party) {
super({ id: `GroupRollDialog-${party.id}` });
super();
this.party = party;
this.partyMembers = party.system.partyMembers
@ -35,6 +35,7 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
static DEFAULT_OPTIONS = {
tag: 'form',
id: 'GroupRollDialog',
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'group-roll-dialog'],
position: { width: 390, height: 'auto' },
window: {

View file

@ -7,7 +7,7 @@ const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class TagTeamDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(party) {
super({ id: `TagTeamDialog-${party.id}` });
super();
this.party = party;
this.partyMembers = party.system.partyMembers
@ -36,6 +36,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
static DEFAULT_OPTIONS = {
tag: 'form',
id: 'TagTeamDialog',
classes: ['daggerheart', 'views', 'dh-style', 'dialog', 'tag-team-dialog'],
position: { width: 550, height: 'auto' },
actions: {
@ -59,17 +60,13 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
id: 'initialization',
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/initialization.hbs'
},
tagTeamRoll: {
id: 'tagTeamRoll',
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs'
},
rollSelection: {
id: 'rollSelection',
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/rollSelection.hbs'
},
result: {
id: 'result',
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/result.hbs'
tagTeamRoll: {
id: 'tagTeamRoll',
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamRoll.hbs'
}
};
@ -100,15 +97,36 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
}
_configureRenderParts(options) {
const parts = super._configureRenderParts(options);
const { initialization, rollSelection, tagTeamRoll } = super._configureRenderParts(options);
const augmentedParts = { initialization };
for (const memberKey of Object.keys(this.party.system.tagTeam.members)) {
parts[memberKey] = {
augmentedParts[memberKey] = {
id: memberKey,
template: 'systems/daggerheart/templates/dialogs/tagTeamDialog/tagTeamMember.hbs'
};
}
augmentedParts.rollSelection = rollSelection;
augmentedParts.tagTeamRoll = tagTeamRoll;
return parts;
return augmentedParts;
}
/**@inheritdoc */
async _onRender(context, options) {
await super._onRender(context, options);
// if (this.element.querySelector('.roll-selection')) {
// for (const element of this.element.querySelectorAll('.team-member-container')) {
// element.classList.add('select-padding');
// }
// }
if (this.element.querySelector('.team-container')) return;
const initializationPart = this.element.querySelector('.initialization-container');
initializationPart.insertAdjacentHTML('afterend', '<div class="team-container"></div>');
const teamContainer = this.element.querySelector('.team-container');
for (const memberContainer of this.element.querySelectorAll('.team-member-container'))
teamContainer.appendChild(memberContainer);
}
async _prepareContext(_options) {
@ -149,9 +167,6 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
partContext.initiatorDisabled = !selectedMembers.length;
partContext.openForAllPlayers = this.openForAllPlayers;
break;
case 'tagTeamRoll':
partContext.memberKeys = Object.keys(this.party.system.tagTeam.members);
break;
case 'rollSelection':
partContext.members = Object.keys(this.party.system.tagTeam.members).reduce((acc, key) => {
@ -160,7 +175,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
return acc;
}, {});
break;
case 'result':
case 'tagTeamRoll':
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
const critSelected = !selectedRoll
? undefined
@ -228,7 +243,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
}
getUpdatingParts(target) {
const { initialization, rollSelection, result } = this.constructor.PARTS;
const { initialization, rollSelection, tagTeamRoll } = this.constructor.PARTS;
const isInitialization = this.tabGroups.application === initialization.id;
const updatingMember = target.closest('.team-member-container')?.dataset?.memberKey;
@ -236,7 +251,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
...(isInitialization ? [initialization.id] : []),
...(updatingMember ? [updatingMember] : []),
...(!isInitialization ? [rollSelection.id] : []),
...(!isInitialization ? [result.id] : [])
...(!isInitialization ? [tagTeamRoll.id] : [])
];
}

View file

@ -531,7 +531,7 @@ export default function DHApplicationMixin(Base) {
visible: element => {
const target = element.closest('[data-item-uuid]');
const doc = getDocFromElementSync(target);
return doc?.isOwner !== false && target.dataset.itemType !== 'beastform';
return doc?.isOwner && target.dataset.itemType !== 'beastform';
},
callback: async (target, event) => {
const doc = await getDocFromElement(target);

View file

@ -257,7 +257,7 @@ export default class DHRoll extends Roll {
if (!roll.terms[i].isDeterministic) continue;
const termTotal = roll.terms[i].total;
if (typeof termTotal === 'number') {
const multiplier = roll.terms[i - 1]?.operator === '-' ? -1 : 1;
const multiplier = roll.terms[i - 1]?.operator === ' - ' ? -1 : 1;
modifierTotal += multiplier * termTotal;
}
}

View file

@ -171,7 +171,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/** Recursively finds the first parent document of the given object */
static #resolveParentDocument(model, documentClass) {
if (!model) return null;
return model instanceof documentClass
? model
: model.parent

View file

@ -757,12 +757,9 @@ export function getArmorSources(actor) {
// Get the origin item. Since the actor is already loaded, it should already be cached
// Consider the relative function versions if this causes an issue
const origin = doc.origin ? foundry.utils.fromUuidSync(doc.origin) : doc;
const useParentName = doc.parent && !(doc.parent instanceof Actor);
const name = doc.origin || !useParentName ? doc.name : doc.parent.name;
return {
origin,
name,
name: origin.name,
document: doc,
data: doc.system.armor ?? doc.system.armorData,
disabled: !!doc.disabled || !!doc.isSuppressed

View file

@ -40,8 +40,7 @@
"experiences": {
"ti3Z1mq2M92KK4GJ": {
"name": "Bloodthirsty",
"description": "",
"value": 3
"description": ""
}
},
"bonuses": {
@ -243,24 +242,27 @@
"type": "withinRange",
"target": "hostile",
"range": "melee"
},
"changes": [
{
"key": "system.difficulty",
"value": 3,
"priority": null,
"type": "add"
}
]
}
},
"_id": "qZfNiqw1iAIxeuYg",
"img": "icons/commodities/biological/wing-lizard-brown.webp",
"changes": [
{
"key": "system.difficulty",
"mode": 2,
"value": "3",
"priority": null
}
],
"disabled": false,
"duration": {
"value": null,
"units": "seconds",
"expiry": null,
"expired": false
"startTime": null,
"combat": null,
"seconds": null,
"rounds": null,
"turns": null,
"startRound": null,
"startTurn": null
},
"description": "<p>While flying, the Bat gains a +3 bonus to their Difficulty.</p>",
"origin": null,
@ -272,9 +274,6 @@
"_stats": {
"compendiumSource": null
},
"start": null,
"showIcon": 1,
"folder": null,
"_key": "!actors.items.effects!tBWHW00epmMnkawe.gx22MpD8fWoi8klZ.qZfNiqw1iAIxeuYg"
}
],

View file

@ -249,7 +249,7 @@
"name": "Crushing Blows",
"type": "feature",
"system": {
"description": "<p>When the @Lookup[@name] makes a successful attack, the target must mark an Armor Slot without receiving its benefits (they can still use armor to reduce the damage). If they cant mark an Armor Slot, they must mark an additional HP.</p>",
"description": "<p>When the @Lookup[@name] makes a successful attack, the target must mark an Armor Slot without receiving its benefi ts (they can still use armor to reduce the damage). If they cant mark an Armor Slot, they must mark an additional HP.</p>",
"resource": null,
"actions": {
"0sXciTiPc30v8czv": {

View file

@ -138,9 +138,12 @@
"src": "systems/daggerheart/assets/icons/documents/actors/dragon-head.svg",
"anchorX": 0.5,
"anchorY": 0.5,
"offsetX": 0,
"offsetY": 0,
"fit": "contain",
"scaleX": 1,
"scaleY": 1,
"rotation": 0,
"tint": "#ffffff",
"alphaThreshold": 0.75
},
@ -191,7 +194,7 @@
"saturation": 0,
"contrast": 0
},
"detectionModes": {},
"detectionModes": [],
"occludable": {
"radius": 0
},
@ -217,8 +220,7 @@
"flags": {},
"randomImg": false,
"appendNumber": false,
"prependAdjective": false,
"depth": 1
"prependAdjective": false
},
"items": [
{
@ -255,7 +257,7 @@
"name": "Acidic Form",
"type": "feature",
"system": {
"description": "<p>When the @Lookup[@name] makes a successful attack, the target must mark an Armor Slot without receiving its benefits (they can still use armor to reduce the damage). If they cant mark an Armor Slot, they must mark an additional HP.</p>",
"description": "<p>When the @Lookup[@name] makes a successful attack, the target must mark an Armor Slot without receiving its benefi ts (they can still use armor to reduce the damage). If they cant mark an Armor Slot, they must mark an additional HP.</p>",
"resource": null,
"actions": {
"gtT2oHSyZg9OHHJD": {

View file

@ -45,7 +45,7 @@
"hitPoints": {
"value": {
"dice": "d10",
"bonus": 2,
"bonus": 1,
"multiplier": "prof",
"flatMultiplier": 1,
"custom": {

View file

@ -2,7 +2,7 @@
"id": "daggerheart",
"title": "Daggerheart",
"description": "An unofficial implementation of the Daggerheart system",
"version": "2.2.2",
"version": "2.2.1",
"compatibility": {
"minimum": "14.359",
"verified": "14.360",
@ -10,7 +10,7 @@
},
"url": "https://github.com/Foundryborne/daggerheart",
"manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json",
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.2.2/system.zip",
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.2.1/system.zip",
"authors": [
{
"name": "WBHarry"

View file

@ -1,38 +0,0 @@
<section class="tag-team-roll tab {{#if tabs.tagTeamRoll.active}} active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
<div class="tag-team-roll-container {{#unless isEditable}}inactive{{/unless}}">
<div class="results-container">
<span class="result-container-label">{{localize "DAGGERHEART.GENERAL.result.plural"}}</span>
<div class="results-inner-container">
{{#if hintText}}
<div class="hint">{{localize hintText}}</div>
{{else}}
{{#if joinedRoll.roll}}
<div class="result-container">
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.dualityRoll"}}</span>
<div class="result-info">
<div class="damage-info">{{joinedRoll.roll.total}}</div>
<div>{{localize "DAGGERHEART.GENERAL.withThing" thing=joinedRoll.roll.totalLabel}}</div>
</div>
</div>
{{/if}}
{{#if joinedRoll.rollData.options.hasDamage}}
<div class="result-container">
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.damage"}}</span>
{{#each joinedRoll.rollData.options.damage as |damage key|}}
<div class="result-info">
<div>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}</div>
<div class="damage-info">{{damage.total}}</div>
</div>
{{/each}}
</div>
{{/if}}
{{/if}}
</div>
</div>
<div class="finish-container">
<button type="button" data-action="cancelRoll">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.cancelTagTeamRoll"}}</button>
<button type="button" data-action="finishRoll" {{#if hintText}}disabled{{/if}} class="finish-button">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.finishTagTeamRoll"}}</button>
</div>
</div>
</section>

View file

@ -1,9 +1,38 @@
<div class="tab {{#if tabs.tagTeamRoll.active}}active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
<div class="team-container">
{{#each memberKeys as |key|}}
<div data-application-part="{{key}}"></div>
{{/each}}
<section class="tag-team-roll tab {{#if tabs.tagTeamRoll.active}} active{{/if}}" data-group="{{tabs.tagTeamRoll.group}}" data-tab="{{tabs.tagTeamRoll.id}}">
<div class="tag-team-roll-container {{#unless isEditable}}inactive{{/unless}}">
<div class="results-container">
<span class="result-container-label">{{localize "DAGGERHEART.GENERAL.result.plural"}}</span>
<div class="results-inner-container">
{{#if hintText}}
<div class="hint">{{localize hintText}}</div>
{{else}}
{{#if joinedRoll.roll}}
<div class="result-container">
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.dualityRoll"}}</span>
<div class="result-info">
<div class="damage-info">{{joinedRoll.roll.total}}</div>
<div>{{localize "DAGGERHEART.GENERAL.withThing" thing=joinedRoll.roll.totalLabel}}</div>
</div>
</div>
{{/if}}
{{#if joinedRoll.rollData.options.hasDamage}}
<div class="result-container">
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.damage"}}</span>
{{#each joinedRoll.rollData.options.damage as |damage key|}}
<div class="result-info">
<div>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}</div>
<div class="damage-info">{{damage.total}}</div>
</div>
{{/each}}
</div>
{{/if}}
{{/if}}
</div>
</div>
<div class="finish-container">
<button type="button" data-action="cancelRoll">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.cancelTagTeamRoll"}}</button>
<button type="button" data-action="finishRoll" {{#if hintText}}disabled{{/if}} class="finish-button">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.finishTagTeamRoll"}}</button>
</div>
</div>
<div data-application-part="rollSelection"></div>
<div data-application-part="result"></div>
</div>
</section>