mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Compare commits
17 commits
0779443d4a
...
2d6c442421
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d6c442421 | ||
|
|
effab8db0c | ||
|
|
4b651836ff | ||
|
|
c181a47cc2 | ||
|
|
d76b4bb707 | ||
|
|
79d6522614 | ||
|
|
0c2d257871 | ||
|
|
4974df16d0 | ||
|
|
3a5529f1dc | ||
|
|
02a73d774a | ||
|
|
450287e4d0 | ||
|
|
81e264a477 | ||
|
|
d3d9ddfb41 | ||
|
|
7b35feb36d | ||
|
|
6e0d0b4e2c | ||
|
|
3de9c2f909 | ||
|
|
3faf588e6c |
87 changed files with 1772 additions and 1253 deletions
|
|
@ -6,6 +6,7 @@ import * as documents from './module/documents/_module.mjs';
|
|||
import { macros } from './module/_module.mjs';
|
||||
import * as collections from './module/documents/collections/_module.mjs';
|
||||
import * as dice from './module/dice/_module.mjs';
|
||||
import * as die from './module/dice/die/_module.mjs';
|
||||
import * as fields from './module/data/fields/_module.mjs';
|
||||
import RegisterHandlebarsHelpers from './module/helpers/handlebarsHelper.mjs';
|
||||
import { enricherConfig, enricherRenderSetup } from './module/enrichers/_module.mjs';
|
||||
|
|
@ -23,7 +24,7 @@ import TokenManager from './module/documents/tokenManager.mjs';
|
|||
CONFIG.DH = SYSTEM;
|
||||
CONFIG.TextEditor.enrichers.push(...enricherConfig);
|
||||
|
||||
CONFIG.Dice.rolls = [BaseRoll, DHRoll, DualityRoll, D20Roll, DamageRoll, FateRoll];
|
||||
CONFIG.Dice.rolls = [Roll = BaseRoll, DHRoll, DualityRoll, D20Roll, DamageRoll, FateRoll];
|
||||
CONFIG.Dice.daggerheart = {
|
||||
DHRoll: DHRoll,
|
||||
DualityRoll: DualityRoll,
|
||||
|
|
@ -38,8 +39,8 @@ CONFIG.RegionBehavior.dataModels = {
|
|||
};
|
||||
|
||||
Object.assign(CONFIG.Dice.termTypes, dice.diceTypes);
|
||||
CONFIG.Dice.terms.d = dice.BaseDie;
|
||||
CONFIG.Dice.types = [dice.BaseDie, CONFIG.Dice.terms.f];
|
||||
CONFIG.Dice.terms.d = die.BaseDie;
|
||||
CONFIG.Dice.types = [die.BaseDie, CONFIG.Dice.terms.f];
|
||||
|
||||
CONFIG.Actor.documentClass = documents.DhpActor;
|
||||
CONFIG.Actor.dataModels = models.actors.config;
|
||||
|
|
@ -269,6 +270,10 @@ Hooks.on('i18nInit', () => {
|
|||
});
|
||||
|
||||
Hooks.on('setup', () => {
|
||||
if (game.user.isGM) {
|
||||
document.body.dataset.gm = true;
|
||||
}
|
||||
|
||||
CONFIG.statusEffects = [
|
||||
...CONFIG.statusEffects.filter(x => !['dead', 'unconscious'].includes(x.id)),
|
||||
...Object.values(SYSTEM.GENERAL.conditions()).map(x => ({
|
||||
|
|
|
|||
13
lang/en.json
13
lang/en.json
|
|
@ -104,8 +104,10 @@
|
|||
"startCountdown": "Start Countdown"
|
||||
},
|
||||
"damage": {
|
||||
"addResource": "Add Resource",
|
||||
"multiplier": "Multiplier",
|
||||
"flatMultiplier": "Flat Multiplier"
|
||||
"flatMultiplier": "Flat Multiplier",
|
||||
"markResources": "Mark Resources"
|
||||
},
|
||||
"general": {
|
||||
"customFormula": "Custom Formula",
|
||||
|
|
@ -2245,7 +2247,7 @@
|
|||
"hint": "A used armor slot normally reduces damage by one step. This value increases the number of steps damage is reduced by."
|
||||
},
|
||||
"magical": {
|
||||
"label": "Daamge Reduction: Only Magical",
|
||||
"label": "Damage Reduction: Only Magical",
|
||||
"hint": "Armor can only be used to reduce magical damage"
|
||||
},
|
||||
"maxArmorMarkedBonus": "Max Armor Used",
|
||||
|
|
@ -2483,7 +2485,6 @@
|
|||
"reroll": "Reroll",
|
||||
"rerolled": "Rerolled",
|
||||
"rerollThing": "Reroll {thing}",
|
||||
"resource": "Resource",
|
||||
"result": {
|
||||
"single": "Result",
|
||||
"plural": "Results"
|
||||
|
|
@ -2550,6 +2551,9 @@
|
|||
},
|
||||
"identifier": {
|
||||
"label": "Identifier"
|
||||
},
|
||||
"gmNotes": {
|
||||
"label": "GM Notes"
|
||||
}
|
||||
},
|
||||
"Ancestry": {
|
||||
|
|
@ -2565,6 +2569,9 @@
|
|||
"severe": "Severe Threshold"
|
||||
}
|
||||
},
|
||||
"Base": {
|
||||
"addGMNote": "Add GM Note"
|
||||
},
|
||||
"Beastform": {
|
||||
"FIELDS": {
|
||||
"beastformType": { "label": "Beastform Type" },
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
const context = await super._prepareContext(_options);
|
||||
context.config = CONFIG.DH;
|
||||
context.title = this.config.title ?? this.title;
|
||||
context.formula = this.roll.constructFormula(this.config);
|
||||
|
||||
const { damageFormula, resourceFormulas } = this.roll.constructFormulas(this.config);
|
||||
context.damageFormula = damageFormula;
|
||||
context.resourceFormulas = resourceFormulas;
|
||||
|
||||
context.hasHealing = this.config.hasHealing;
|
||||
context.directDamage = this.config.directDamage;
|
||||
context.selectedMessageMode = this.config.selectedMessageMode;
|
||||
|
|
@ -73,7 +77,11 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
|
||||
static updateRollConfiguration(_event, _, formData) {
|
||||
const data = foundry.utils.expandObject(formData.object);
|
||||
foundry.utils.mergeObject(this.config.roll, data.roll);
|
||||
|
||||
if (this.config.damageFormula)
|
||||
foundry.utils.mergeObject(this.config.damageFormula, data.damageFormula);
|
||||
|
||||
foundry.utils.mergeObject(this.config.resourceFormulas, data.resourceFormulas);
|
||||
foundry.utils.mergeObject(this.config.modifiers, data.modifiers);
|
||||
this.config.selectedMessageMode = data.selectedMessageMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -185,8 +185,6 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
|||
|
||||
if (result === undefined) return;
|
||||
|
||||
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
||||
.expandRollMessage?.desc;
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
|
||||
const msg = {
|
||||
|
|
@ -202,7 +200,6 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
|||
img: this.selectedMove.img,
|
||||
description: game.i18n.localize(this.selectedMove.description),
|
||||
result: result,
|
||||
open: autoExpandDescription ? 'open' : '',
|
||||
showRiskItAllButton: this.showRiskItAllButton,
|
||||
riskItAllButtonLabel: this.riskItAllButtonLabel,
|
||||
riskItAllHope: this.riskItAllHope
|
||||
|
|
|
|||
|
|
@ -196,9 +196,6 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
.filter(x => x.testUserPermission(game.user, 'LIMITED'))
|
||||
.filter(x => x.uuid !== this.actor.uuid);
|
||||
|
||||
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
||||
.expandRollMessage?.desc;
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = {
|
||||
user: game.user.id,
|
||||
|
|
@ -219,8 +216,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
actor: { name: this.actor.name, img: this.actor.img },
|
||||
moves: moves,
|
||||
characters: characters,
|
||||
selfId: this.actor.uuid,
|
||||
open: autoExpandDescription ? 'open' : ''
|
||||
selfId: this.actor.uuid
|
||||
}
|
||||
),
|
||||
flags: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ResourceUpdateMap } from '../../data/action/baseAction.mjs';
|
||||
import { ChatDamageData } from '../../data/chat-message/chatDamageData.mjs';
|
||||
import { MemberData } from '../../data/tagTeamData.mjs';
|
||||
import { getCritDamageBonus, shouldUseHopeFearAutomation } from '../../helpers/utils.mjs';
|
||||
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
|
||||
|
|
@ -140,7 +141,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
const hasRolled = Boolean(data.rollData);
|
||||
if (!hasRolled) return false;
|
||||
|
||||
return !data.rollData.options.hasDamage || Boolean(data.rollData.options.damage);
|
||||
return !data.rollData.options.hasDamage || data.damageRollData.active;
|
||||
});
|
||||
|
||||
return context;
|
||||
|
|
@ -181,7 +182,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
||||
const critSelected = !selectedRoll
|
||||
? undefined
|
||||
: (selectedRoll?.rollData?.options?.roll?.isCritical ?? false);
|
||||
: (selectedRoll?.roll?.isCritical ?? false);
|
||||
|
||||
partContext.hintText = await this.getInfoTexts(this.party.system.tagTeam.members);
|
||||
partContext.joinedRoll = await this.getJoinedRoll({
|
||||
|
|
@ -235,8 +236,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
}
|
||||
|
||||
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
||||
const critSelected = !selectedRoll ? undefined : (selectedRoll?.rollData?.options?.roll?.isCritical ?? false);
|
||||
const damage = data.rollData?.options?.damage;
|
||||
const critSelected = !selectedRoll ? undefined : (selectedRoll?.roll?.isCritical ?? false);
|
||||
|
||||
return {
|
||||
...data,
|
||||
|
|
@ -247,9 +247,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
hasRolled: Boolean(data.rollData),
|
||||
rollOptions,
|
||||
damageRollOptions,
|
||||
damage: damage,
|
||||
critDamage: await this.getCriticalDamage(damage),
|
||||
useCritDamage: critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical)
|
||||
damage: data.damageRollData,
|
||||
critDamage: await this.getCriticalDamage(data.damageRollData),
|
||||
useCritDamage: critSelected || (critSelected === undefined && data.roll?.isCritical)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -379,7 +379,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
let rollIsSelected = false;
|
||||
for (const member of Object.values(members)) {
|
||||
const rollFinished = Boolean(member.rollData);
|
||||
const damageFinished = member.rollData?.options?.hasDamage ? Boolean(member.rollData.options.damage) : true;
|
||||
const damageFinished = member.rollData?.options?.hasDamage ? member.damageRollData.active : true;
|
||||
|
||||
rollsAreFinished = rollsAreFinished && rollFinished && damageFinished;
|
||||
rollIsSelected = rollIsSelected || member.selected;
|
||||
|
|
@ -541,16 +541,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
await action.workflow.get('damage').execute(config, null, true);
|
||||
if (!config.damage) return;
|
||||
|
||||
const current = this.party.system.tagTeam.members[memberKey].rollData;
|
||||
await this.updatePartyData(
|
||||
{
|
||||
[`system.tagTeam.members.${memberKey}.rollData`]: {
|
||||
...current,
|
||||
options: {
|
||||
...current.options,
|
||||
damage: config.damage
|
||||
}
|
||||
}
|
||||
[`system.tagTeam.members.${memberKey}.damageRollData`]: config.damage
|
||||
},
|
||||
this.getUpdatingParts(button)
|
||||
);
|
||||
|
|
@ -558,15 +551,11 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
static async #removeDamageRoll(_, button) {
|
||||
const { memberKey } = button.dataset;
|
||||
const current = this.party.system.tagTeam.members[memberKey].rollData;
|
||||
this.updatePartyData(
|
||||
{
|
||||
[`system.tagTeam.members.${memberKey}.rollData`]: {
|
||||
...current,
|
||||
options: {
|
||||
...current.options,
|
||||
damage: null
|
||||
}
|
||||
[`system.tagTeam.members.${memberKey}.damageRollData`]: {
|
||||
main: null,
|
||||
resources: _replace({})
|
||||
}
|
||||
},
|
||||
this.getUpdatingParts(button)
|
||||
|
|
@ -574,81 +563,35 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
}
|
||||
|
||||
static async #rerollDamageDice(_, button) {
|
||||
const { memberKey, damageKey, part, dice } = button.dataset;
|
||||
const { isResource, memberKey, damageKey, diceIndex, resultIndex } = button.dataset;
|
||||
const memberData = this.party.system.tagTeam.members[memberKey];
|
||||
const partData = memberData.rollData.options.damage[damageKey].parts[part];
|
||||
const activeDiceResultKey = Object.keys(partData.dice[dice].results).find(
|
||||
index => partData.dice[dice].results[index].active
|
||||
);
|
||||
const { parsedRoll, rerolledDice } = await game.system.api.dice.DamageRoll.reroll(
|
||||
partData,
|
||||
dice,
|
||||
activeDiceResultKey
|
||||
);
|
||||
|
||||
const rollData = this.party.system.tagTeam.members[memberKey].rollData;
|
||||
rollData.options.damage[damageKey].parts = rollData.options.damage[damageKey].parts.map((damagePart, index) => {
|
||||
if (index !== Number.parseInt(part)) return damagePart;
|
||||
|
||||
return {
|
||||
...damagePart,
|
||||
total: parsedRoll.total,
|
||||
dice: rerolledDice
|
||||
};
|
||||
});
|
||||
rollData.options.damage[damageKey].total = rollData.options.damage[damageKey].parts.reduce((acc, part) => {
|
||||
acc += part.total;
|
||||
return acc;
|
||||
}, 0);
|
||||
await memberData.damageRollData.rerollDamageDie(isResource, damageKey, diceIndex, resultIndex);
|
||||
|
||||
const basePath = `system.tagTeam.members.${memberKey}.damageRollData`;
|
||||
const updatePath = isResource ? `${basePath}.resources.${damageKey}` : `${basePath}.main`;
|
||||
const updateValue = isResource ?
|
||||
memberData.damageRollData.resources[damageKey] : memberData.damageRollData.main;
|
||||
this.updatePartyData(
|
||||
{
|
||||
[`system.tagTeam.members.${memberKey}.rollData`]: rollData
|
||||
[updatePath]: updateValue.toJSON()
|
||||
},
|
||||
this.getUpdatingParts(button)
|
||||
);
|
||||
}
|
||||
|
||||
async getCriticalDamage(damage) {
|
||||
const newDamage = foundry.utils.deepClone(damage);
|
||||
for (let key in newDamage) {
|
||||
var damage = newDamage[key];
|
||||
damage.formula = '';
|
||||
damage.total = 0;
|
||||
|
||||
for (let part of damage.parts) {
|
||||
const criticalDamage = await getCritDamageBonus(part.formula);
|
||||
async getCriticalDamage(origDamage) {
|
||||
const newDamage = origDamage ? ChatDamageData.fromJSON(JSON.stringify(origDamage)) : null;
|
||||
if (newDamage?.main) {
|
||||
const criticalDamage = await getCritDamageBonus(newDamage.main.formula);
|
||||
if (criticalDamage) {
|
||||
part.modifierTotal += criticalDamage;
|
||||
part.total += criticalDamage;
|
||||
part.formula = `${part.dice.map(x => x.formula).join(' + ')} + ${part.modifierTotal}`;
|
||||
part.roll = new Roll(part.formula);
|
||||
}
|
||||
|
||||
damage.formula = [damage.formula, part.formula].filter(x => x).join(' + ');
|
||||
damage.total += part.total;
|
||||
}
|
||||
}
|
||||
|
||||
return newDamage;
|
||||
}
|
||||
|
||||
async getNonCriticalDamage(config) {
|
||||
const newDamage = foundry.utils.deepClone(config.damage);
|
||||
for (let key in newDamage) {
|
||||
var damage = newDamage[key];
|
||||
damage.formula = '';
|
||||
damage.total = 0;
|
||||
|
||||
for (let part of damage.parts) {
|
||||
const critDamageBonus = await getCritDamageBonus(part.formula);
|
||||
part.modifierTotal -= critDamageBonus;
|
||||
part.total -= critDamageBonus;
|
||||
part.formula = `${part.dice.map(x => x.formula).join(' + ')} + ${part.modifierTotal}`;
|
||||
part.roll = new Roll(part.formula);
|
||||
|
||||
damage.formula = [damage.formula, part.formula].filter(x => x).join(' + ');
|
||||
damage.total += part.total;
|
||||
const criticalTerm = new foundry.dice.terms.NumericTerm({ number: criticalDamage, evaluated: true });
|
||||
criticalTerm.evaluate();
|
||||
newDamage.main = await Roll.fromTerms([
|
||||
...origDamage.main.terms,
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
criticalTerm
|
||||
]);
|
||||
newDamage.main.options = foundry.utils.deepClone(origDamage.main.options);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -657,6 +600,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
static async #selectRoll(_, button) {
|
||||
const { memberKey } = button.dataset;
|
||||
|
||||
this.updatePartyData(
|
||||
{
|
||||
[`system.tagTeam.members`]: Object.entries(this.party.system.tagTeam.members).reduce(
|
||||
|
|
@ -667,7 +611,12 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
{}
|
||||
)
|
||||
},
|
||||
this.getUpdatingParts(button)
|
||||
/* Selecting a roll must update all member sections hbs to display the correct damage information incase of a critical */
|
||||
[
|
||||
...Object.keys(this.party.system.tagTeam.members),
|
||||
this.constructor.PARTS.rollSelection.id,
|
||||
this.constructor.PARTS.result.id
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -685,29 +634,65 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
if (!baseMainRoll?.rollData || !baseSecondaryRoll) return null;
|
||||
|
||||
const mainRoll = new MemberData(baseMainRoll.toObject());
|
||||
const secondaryRollData = new MemberData(baseSecondaryRoll.toObject()).rollData;
|
||||
const systemData = mainRoll.rollData.options;
|
||||
const isCritical = overrideIsCritical ?? systemData.roll.isCritical;
|
||||
if (isCritical) systemData.damage = await this.getCriticalDamage(systemData.damage);
|
||||
mainRoll.damageRollData = baseMainRoll.damageRollData ?
|
||||
ChatDamageData.fromJSON(JSON.stringify(baseMainRoll.damageRollData)) : null;
|
||||
const secondaryRoll = new MemberData(baseSecondaryRoll.toObject());
|
||||
secondaryRoll.damageRollData = baseSecondaryRoll.damageRollData ?
|
||||
ChatDamageData.fromJSON(JSON.stringify(baseSecondaryRoll.damageRollData)) : null;
|
||||
|
||||
if (secondaryRollData?.options.hasDamage) {
|
||||
const isCritical = overrideIsCritical ?? mainRoll.roll.isCritical;
|
||||
if (isCritical) mainRoll.damageRollData = await this.getCriticalDamage(mainRoll.damageRollData);
|
||||
|
||||
if (secondaryRoll.damageRollData) {
|
||||
const secondaryDamage = (displayVersion ? overrideIsCritical : isCritical)
|
||||
? await this.getCriticalDamage(secondaryRollData.options.damage)
|
||||
: secondaryRollData.options.damage;
|
||||
if (systemData.damage) {
|
||||
for (const [key, damage] of Object.entries(secondaryDamage ?? {})) {
|
||||
if (key in systemData.damage) {
|
||||
systemData.damage[key].formula = [systemData.damage[key]?.formula, damage.formula]
|
||||
.filter(x => x)
|
||||
.join(' + ');
|
||||
systemData.damage[key].total += damage.total;
|
||||
systemData.damage[key].parts.push(...damage.parts);
|
||||
? await this.getCriticalDamage(secondaryRoll.damageRollData)
|
||||
: secondaryRoll.damageRollData;
|
||||
if (mainRoll.damageRollData) {
|
||||
if (secondaryDamage.main) {
|
||||
if (mainRoll.damageRollData.main) {
|
||||
mainRoll.damageRollData.main = Roll.fromTerms([
|
||||
...baseMainRoll.damageRollData.main.terms,
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
...baseSecondaryRoll.damageRollData.main.terms
|
||||
]);
|
||||
|
||||
/* Joining the roll.options of both rolls */
|
||||
const joinedDamageTypes = new Set([
|
||||
...baseMainRoll.damageRollData.main.options.damageTypes,
|
||||
...baseSecondaryRoll.damageRollData.main.options.damageTypes
|
||||
]);
|
||||
mainRoll.damageRollData.main.options = {
|
||||
...baseMainRoll.damageRollData.main.options,
|
||||
damageTypes: [...joinedDamageTypes]
|
||||
};
|
||||
} else {
|
||||
systemData.damage[key] = damage;
|
||||
mainRoll.damageRollData.main = secondaryDamage.main;
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, damage] of Object.entries(secondaryDamage.resources ?? {})) {
|
||||
if (key in mainRoll.damageRollData.resources) {
|
||||
mainRoll.damageRollData.resources[key] = Roll.fromTerms([
|
||||
...baseMainRoll.damageRollData.resources[key].terms,
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
...baseSecondaryRoll.damageRollData.resources[key].terms
|
||||
]);
|
||||
|
||||
/* Joining the roll.options of both rolls */
|
||||
const joinedDamageTypes = new Set([
|
||||
...baseMainRoll.damageRollData.resources[key].options.damageTypes,
|
||||
...baseSecondaryRoll.damageRollData.resources[key].options.damageTypes
|
||||
]);
|
||||
mainRoll.damageRollData.resources[key].options = {
|
||||
...baseMainRoll.damageRollData.resources[key].options,
|
||||
damageTypes: [...joinedDamageTypes]
|
||||
};
|
||||
} else {
|
||||
mainRoll.damageRollData.resources[key] = damage;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
systemData.damage = secondaryDamage;
|
||||
mainRoll.damageRollData = secondaryDamage;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -762,13 +747,27 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
const mainActor = this.party.system.partyMembers.find(x => x.uuid === mainRoll.options.source.actor);
|
||||
mainRoll.options.title = game.i18n.localize('DAGGERHEART.APPLICATIONS.TagTeamSelect.chatMessageRollTitle');
|
||||
|
||||
/* This could assumably be done better. For some reason rolls don't get correctly done through rollData.toJSON */
|
||||
const systemData = {
|
||||
...mainRoll.options,
|
||||
damage: joinedRoll.damageRollData?.toJSON()
|
||||
};
|
||||
|
||||
if (joinedRoll.damageRollData.main) {
|
||||
systemData.damage.main = joinedRoll.damageRollData.toJSON();
|
||||
}
|
||||
for (const type of Object.keys(joinedRoll.damageRollData?.resources ?? {})) {
|
||||
systemData.damage.resources[type] = joinedRoll.damageRollData.resources[type].toJSON();
|
||||
}
|
||||
|
||||
const cls = getDocumentClass('ChatMessage'),
|
||||
msgData = {
|
||||
type: 'dualityRoll',
|
||||
user: game.user.id,
|
||||
title: game.i18n.localize('DAGGERHEART.APPLICATIONS.TagTeamSelect.title'),
|
||||
speaker: cls.getSpeaker({ actor: mainActor }),
|
||||
system: mainRoll.options,
|
||||
system: systemData,
|
||||
rolls: [JSON.stringify(joinedRoll.roll)],
|
||||
sound: null,
|
||||
flags: { core: { RollTable: true } }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getUnusedDamageTypes } from '../../helpers/utils.mjs';
|
||||
import { DHDamageData } from '../../data/fields/action/damageField.mjs';
|
||||
import DaggerheartSheet from '../sheets/daggerheart-sheet.mjs';
|
||||
|
||||
const { ApplicationV2 } = foundry.applications.api;
|
||||
|
|
@ -31,8 +31,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
removeElement: this.removeElement,
|
||||
removeTransformActor: this.removeTransformActor,
|
||||
editEffect: this.editEffect,
|
||||
addDamage: this.addDamage,
|
||||
removeDamage: this.removeDamage,
|
||||
addDamage: this.#onAddDamage,
|
||||
removeDamage: this.#onRemoveDamage,
|
||||
addDamageResource: this.#onAddDamageResource,
|
||||
removeDamageResource: this.#onRemoveDamageResource,
|
||||
editDoc: this.editDoc,
|
||||
addTrigger: this.addTrigger,
|
||||
removeTrigger: this.removeTrigger,
|
||||
|
|
@ -157,9 +159,9 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
context.tabs = this._getTabs(this.constructor.TABS);
|
||||
context.config = CONFIG.DH;
|
||||
if (this.action.damage) {
|
||||
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
||||
|
||||
if (this.action.damage.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
const allKeys = Object.keys(CONFIG.DH.GENERAL.healingTypes);
|
||||
context.allDamageTypesUsed = allKeys.every(k => k in this.action._source.damage.resources);
|
||||
if (this.action.damage?.main?.hasOwnProperty('includeBase') && this.action.type === 'attack')
|
||||
context.hasBaseDamage = !!this.action.parent.attack;
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +255,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
const submitData = this._prepareSubmitData(event, formData);
|
||||
|
||||
const data = foundry.utils.mergeObject(this.action.toObject(), submitData);
|
||||
this.action = await this.action.update(data);
|
||||
this.action = (await this.action.update(data)) ?? this.action;
|
||||
|
||||
this.sheetUpdate?.(this.action);
|
||||
this.render();
|
||||
|
|
@ -299,53 +301,70 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
}
|
||||
|
||||
static addDamage(_event) {
|
||||
if (!this.action.damage.parts) return;
|
||||
/** @this DHActionBaseConfig */
|
||||
static #onAddDamage() {
|
||||
if (!this.action.damage || this.action.damage?.main) return;
|
||||
|
||||
const choices = getUnusedDamageTypes(this.action._source.damage.parts);
|
||||
const data = this.action.toObject();
|
||||
data.damage.main = {
|
||||
...DHDamageData.schema.getInitialValue(),
|
||||
applyTo: 'hitPoints',
|
||||
type: 'physical'
|
||||
};
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
}
|
||||
|
||||
/** @this DHActionBaseConfig */
|
||||
static #onRemoveDamage() {
|
||||
if (!this.action.damage?.main) return;
|
||||
const data = this.action.toObject();
|
||||
data.damage.main = null;
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
}
|
||||
|
||||
/** @this DHActionBaseConfig */
|
||||
static #onAddDamageResource(_event) {
|
||||
if (!this.action.damage) return;
|
||||
|
||||
const allKeys = Object.keys(CONFIG.DH.GENERAL.healingTypes);
|
||||
const unused = allKeys.filter(k => !(k in this.action._source.damage.resources));
|
||||
const choices = unused.map(k => ({ value: k, label: _loc(CONFIG.DH.GENERAL.healingTypes[k].label) }));
|
||||
const content = new foundry.data.fields.StringField({
|
||||
label: game.i18n.localize('Damage Type'),
|
||||
label: _loc('DAGGERHEART.GENERAL.Resource.single'),
|
||||
choices,
|
||||
required: true
|
||||
}).toFormGroup(
|
||||
{},
|
||||
{
|
||||
}).toFormGroup({}, {
|
||||
name: 'type',
|
||||
localize: true,
|
||||
nameAttr: 'value',
|
||||
labelAttr: 'label'
|
||||
}
|
||||
).outerHTML;
|
||||
}).outerHTML;
|
||||
|
||||
const callback = (_, button) => {
|
||||
const data = this.action.toObject();
|
||||
const type = choices[button.form.elements.type.value].value;
|
||||
const part = this.action.schema.fields.damage.fields.parts.element.getInitialValue();
|
||||
part.applyTo = type;
|
||||
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
|
||||
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
|
||||
|
||||
data.damage.parts[type] = part;
|
||||
data.damage.resources[type] = {
|
||||
...this.action.schema.fields.damage.fields.resources.element.getInitialValue(),
|
||||
applyTo: type
|
||||
};
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
};
|
||||
|
||||
const typeDialog = new foundry.applications.api.DialogV2({
|
||||
buttons: [
|
||||
foundry.utils.mergeObject(
|
||||
{
|
||||
action: 'ok',
|
||||
label: 'Confirm',
|
||||
icon: 'fas fa-check',
|
||||
default: true
|
||||
},
|
||||
{ callback: callback }
|
||||
)
|
||||
default: true,
|
||||
callback
|
||||
}
|
||||
],
|
||||
content: content,
|
||||
rejectClose: false,
|
||||
modal: false,
|
||||
window: {
|
||||
title: game.i18n.localize('Add Damage')
|
||||
title: _loc('DAGGERHEART.ACTIONS.Config.damage.addResource')
|
||||
},
|
||||
position: { width: 300 }
|
||||
});
|
||||
|
|
@ -353,12 +372,12 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
|||
typeDialog.render(true);
|
||||
}
|
||||
|
||||
static removeDamage(_event, button) {
|
||||
if (!this.action.damage.parts) return;
|
||||
/** @this DHActionBaseConfig */
|
||||
static #onRemoveDamageResource(_event, button) {
|
||||
if (!this.action.damage?.resources) return;
|
||||
const data = this.action.toObject();
|
||||
const key = button.dataset.key;
|
||||
delete data.damage.parts[key];
|
||||
data.damage.parts[`${key}`] = _del;
|
||||
data.damage.resources[key] = _del;
|
||||
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { DHDamageData } from '../../data/fields/action/damageField.mjs';
|
||||
import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
|
||||
|
||||
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
|
||||
|
|
@ -8,8 +9,10 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
classes: ['adversary-settings'],
|
||||
position: { width: 455, height: 'auto' },
|
||||
actions: {
|
||||
addExperience: DHAdversarySettings.#addExperience,
|
||||
removeExperience: DHAdversarySettings.#removeExperience
|
||||
addExperience: this.#onAddExperience,
|
||||
removeExperience: this.#onRemoveExperience,
|
||||
addDamage: this.#onAddDamage,
|
||||
removeDamage: this.#onRemoveDamage
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -71,7 +74,7 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
* Adds a new experience entry to the actor.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #addExperience() {
|
||||
static async #onAddExperience() {
|
||||
const newExperience = {
|
||||
name: 'Experience',
|
||||
modifier: 0
|
||||
|
|
@ -83,7 +86,7 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
* Removes an experience entry from the actor.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #removeExperience(_, target) {
|
||||
static async #onRemoveExperience(_, target) {
|
||||
const experience = this.actor.system.experiences[target.dataset.experience];
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
|
|
@ -98,4 +101,28 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
|
||||
await this.actor.update({ [`system.experiences.${target.dataset.experience}`]: _del });
|
||||
}
|
||||
|
||||
/**
|
||||
* @this DHAdversarySettings
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static #onAddDamage() {
|
||||
this.actor.update({
|
||||
'system.attack.damage.main': {
|
||||
...DHDamageData.schema.getInitialValue(),
|
||||
applyTo: 'hitPoints',
|
||||
type: 'physical'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @this DHAdversarySettings
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static #onRemoveDamage() {
|
||||
this.actor.update({
|
||||
'system.attack.damage.main': null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
addFeature: DHBaseItemSheet.#addFeature,
|
||||
deleteFeature: DHBaseItemSheet.#deleteFeature,
|
||||
addResource: DHBaseItemSheet.#addResource,
|
||||
removeResource: DHBaseItemSheet.#removeResource
|
||||
removeResource: DHBaseItemSheet.#removeResource,
|
||||
editGMNote: DHBaseItemSheet.#onEditGMNote
|
||||
},
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.drop-section' },
|
||||
|
|
@ -76,10 +77,16 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
/**@inheritdoc */
|
||||
async _preparePartContext(partId, context, options) {
|
||||
await super._preparePartContext(partId, context, options);
|
||||
const TextEditor = foundry.applications.ux.TextEditor.implementation;
|
||||
|
||||
switch (partId) {
|
||||
case 'description':
|
||||
context.enrichedDescription = await this.document.system.getEnrichedDescription();
|
||||
context.enrichedDescription = await this.document.system.getEnrichedDescription({ gmNotes: false });
|
||||
context.enrichedGMNotes = await TextEditor.implementation.enrichHTML(this.item.system.gmNotes, {
|
||||
relativeTo: this.item,
|
||||
rollData: this.item.getRollData(),
|
||||
secrets: this.item.isOwner
|
||||
})
|
||||
break;
|
||||
case 'effects':
|
||||
await this._prepareEffectsContext(context, options);
|
||||
|
|
@ -331,4 +338,45 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the Add GM Note button being pressed. This is only used when an item has no GM notes.
|
||||
* Later edits to a GM note instead go through the normal editor toggle workflow.
|
||||
* @this DHBaseItemSheet
|
||||
*/
|
||||
static #onEditGMNote() {
|
||||
// Open the editor, which might be hidden. We remove the css class to hide temporarily
|
||||
// so that menu auto resizing functions properly.
|
||||
const editor = this.element.querySelector('prose-mirror[name="system.gmNotes"]');
|
||||
const wasHidden = editor.classList.contains('hide-if-inactive');
|
||||
editor.classList.remove('hide-if-inactive');
|
||||
editor.open = true;
|
||||
window.setTimeout(() => {
|
||||
if (wasHidden) editor.classList.add('hide-if-inactive');
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
async _onRender(context, options) {
|
||||
await super._onRender(context, options);
|
||||
|
||||
// Render an add gmnotes button if there are no set GM notes.
|
||||
// We need to re-render on close since its possible to prosemirror to close *without* triggering a full re-render
|
||||
if (game.user.isGM && !this.item.system.gmNotes) {
|
||||
const description = this.element.querySelector('[name="system.description"]');
|
||||
const addButton = () => {
|
||||
if (description.querySelector('[data-action=editGMNote]')) return;
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.classList.add('icon', 'toggle', 'fa-regular', 'fa-note-medical');
|
||||
button.dataset.action = 'editGMNote';
|
||||
button.dataset.tooltip = 'DAGGERHEART.ITEMS.Base.addGMNote';
|
||||
description.appendChild(button);
|
||||
}
|
||||
|
||||
addButton();
|
||||
description.addEventListener('close', () => addButton());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
const message = game.messages.get(li.dataset.messageId);
|
||||
return message.system.hasRoll && (game.user.isGM || message.isAuthor);
|
||||
},
|
||||
callback: async li => {
|
||||
onClick: async (_event, li) => {
|
||||
const message = game.messages.get(li.dataset.messageId);
|
||||
const reroll = await message.rolls[0].reroll({ liveRoll: true });
|
||||
message.update({ rolls: [reroll] });
|
||||
|
|
@ -126,7 +126,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
: false;
|
||||
return (game.user.isGM || message.isAuthor) && hasRolledDamage;
|
||||
},
|
||||
callback: async li => {
|
||||
onClick: async (_event, li) => {
|
||||
const message = game.messages.get(li.dataset.messageId);
|
||||
const update = await message.system.getRerolledDamage();
|
||||
message.update(update);
|
||||
|
|
@ -179,28 +179,15 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
}
|
||||
|
||||
async onRollSimple(event, message) {
|
||||
const buttonType = event.target.dataset.type ?? 'damage',
|
||||
total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0),
|
||||
damages = {
|
||||
hitPoints: {
|
||||
parts: [
|
||||
{
|
||||
applyTo: 'hitPoints',
|
||||
damageTypes: [],
|
||||
total
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
targets = Array.from(game.user.targets);
|
||||
|
||||
const buttonType = event.target.dataset.type ?? 'damage';
|
||||
const total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0);
|
||||
const targets = Array.from(game.user.targets);
|
||||
if (targets.length === 0)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
targets.forEach(target => {
|
||||
if (buttonType === 'healing') target.actor.takeHealing(damages);
|
||||
else target.actor.takeDamage(damages);
|
||||
});
|
||||
for (const target of targets) {
|
||||
if (buttonType === 'healing') target.actor.takeHealing({ hitPoints: total });
|
||||
else target.actor.takeDamage({ total });
|
||||
}
|
||||
}
|
||||
|
||||
async abilityUseButton(event, message) {
|
||||
|
|
@ -256,26 +243,17 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
}
|
||||
|
||||
const message = game.messages.get(messageData._id);
|
||||
const target = event.target.closest('[data-die-index]');
|
||||
const target = event.target.closest('[data-result]');
|
||||
|
||||
if (target.dataset.type === 'damage') {
|
||||
const { damageType, part, dice, result } = target.dataset;
|
||||
const damagePart = message.system.damage[damageType].parts[part];
|
||||
const { parsedRoll, rerolledDice } = await game.system.api.dice.DamageRoll.reroll(damagePart, dice, result);
|
||||
const damageParts = message.system.damage[damageType].parts.map((damagePart, index) => {
|
||||
if (index !== Number(part)) return damagePart;
|
||||
return {
|
||||
...damagePart,
|
||||
total: parsedRoll.total,
|
||||
dice: rerolledDice
|
||||
};
|
||||
});
|
||||
const updateMessage = game.messages.get(message._id);
|
||||
await updateMessage.update({
|
||||
[`system.damage.${damageType}`]: {
|
||||
total: parsedRoll.total,
|
||||
parts: damageParts
|
||||
}
|
||||
const { isResource, damageType, dice, result } = target.dataset;
|
||||
await message.system.damage.rerollDamageDie(isResource, damageType, dice, result);
|
||||
|
||||
const updatePath = isResource ? `system.damage.resources.${damageType}` : 'system.damage.main';
|
||||
const updateValue = isResource ?
|
||||
message.system.damage.resources[damageType] : message.system.damage.main;
|
||||
await message.update({
|
||||
[updatePath]: updateValue.toJSON()
|
||||
});
|
||||
} else {
|
||||
const rerollDice = message.system.roll.dice[target.dataset.dieIndex];
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ export const refreshTypes = {
|
|||
export const itemAbilityCosts = {
|
||||
resource: {
|
||||
id: 'resource',
|
||||
label: 'DAGGERHEART.GENERAL.resource',
|
||||
label: 'DAGGERHEART.GENERAL.Resource.single',
|
||||
group: 'Global'
|
||||
},
|
||||
quantity: {
|
||||
|
|
|
|||
|
|
@ -13,18 +13,19 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
if (this.damage.includeBase) {
|
||||
const baseDamage = this.getParentHitPointDamage();
|
||||
if (baseDamage) {
|
||||
if (!this.damage.parts.hitPoints) {
|
||||
this.damage.parts.hitPoints = baseDamage;
|
||||
if (!this.damage.main) {
|
||||
this.damage.main = baseDamage;
|
||||
} else {
|
||||
for (const type of baseDamage.type) this.damage.parts.hitPoints.type.add(type);
|
||||
for (const type of baseDamage.type) this.damage.main.type.add(type);
|
||||
|
||||
this.damage.parts.hitPoints.value.custom = {
|
||||
this.damage.main.value.custom = {
|
||||
enabled: true,
|
||||
formula: `${baseDamage.value.getFormula()} + ${this.damage.parts.hitPoints.value.getFormula()}`
|
||||
formula: `${baseDamage.value.getFormula()} + ${this.damage.main.value.getFormula()}`
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.roll.useDefault) {
|
||||
this.roll.trait = this.item.system.attack.roll.trait;
|
||||
this.roll.type = 'attack';
|
||||
|
|
@ -33,18 +34,18 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
}
|
||||
|
||||
getParentHitPointDamage() {
|
||||
return this.item?.system?.attack.damage.parts.hitPoints;
|
||||
return this.item?.system?.attack.damage.main;
|
||||
}
|
||||
|
||||
get damageFormula() {
|
||||
const hitPointsPart = this.damage.parts.hitPoints;
|
||||
const hitPointsPart = this.damage.main;
|
||||
if (!hitPointsPart) return '0';
|
||||
|
||||
return hitPointsPart.value.getFormula();
|
||||
}
|
||||
|
||||
get altDamageFormula() {
|
||||
const hitPointsPart = this.damage.parts.hitPoints;
|
||||
const hitPointsPart = this.damage.main;
|
||||
if (!hitPointsPart) return '0';
|
||||
|
||||
return hitPointsPart.valueAlt.getFormula();
|
||||
|
|
@ -73,7 +74,7 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||
|
||||
const useAltDamage = this.actor?.effects?.find(x => x.type === 'horde')?.active;
|
||||
for (const { value, valueAlt, type } of damage.parts) {
|
||||
for (const { value, valueAlt, type } of [damage.main, ...damage.resources].filter(d => !!d)) {
|
||||
const usedValue = useAltDamage ? valueAlt : value;
|
||||
const damageString = Roll.replaceFormulaData(usedValue.getFormula(), this.actor?.getRollData() ?? {});
|
||||
const str = damageString
|
||||
|
|
@ -82,7 +83,7 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
x: game.i18n.localize('DAGGERHEART.GENERAL.damage')
|
||||
});
|
||||
|
||||
const icons = Array.from(type)
|
||||
const icons = Array.from(type ?? [])
|
||||
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
||||
.filter(Boolean);
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postUseAction`, this, config) === false) return;
|
||||
|
||||
if (this.chatDisplay && !config.skips.createMessage && !config.actionChatMessageHandled) await this.toChat();
|
||||
if (this.chatDisplay && !config.skips.createMessage && !config.actionChatMessageHandled)
|
||||
await this.toChat(null, config);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
|
@ -288,7 +289,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
hasEffect: this.hasEffect,
|
||||
hasSave: this.hasSave,
|
||||
onSave: this.save?.damageMod,
|
||||
isDirect: !!this.damage?.direct,
|
||||
selectedMessageMode: game.settings.get('core', 'messageMode'),
|
||||
data: this.getRollData(),
|
||||
evaluate: this.hasRoll,
|
||||
|
|
@ -306,20 +306,20 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
};
|
||||
|
||||
if (this.damage) {
|
||||
config.isDirect = this.damage.direct;
|
||||
config.isDirect = !!this.damage.main?.direct;
|
||||
|
||||
const groupAttackTokens = this.damage.groupAttack
|
||||
const groupAttackTokens = this.damage.main?.groupAttack
|
||||
? game.system.api.fields.ActionFields.DamageField.getGroupAttackTokens(
|
||||
this.actor.id,
|
||||
this.damage.groupAttack
|
||||
this.damage.main.groupAttack
|
||||
)
|
||||
: null;
|
||||
|
||||
config.damageOptions = {
|
||||
groupAttack: this.damage.groupAttack
|
||||
groupAttack: this.damage.main?.groupAttack
|
||||
? {
|
||||
numAttackers: Math.max(groupAttackTokens.length, 1),
|
||||
range: this.damage.groupAttack
|
||||
range: this.damage.main.groupAttack
|
||||
}
|
||||
: null
|
||||
};
|
||||
|
|
@ -429,11 +429,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
}
|
||||
|
||||
get hasDamage() {
|
||||
return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type !== 'healing';
|
||||
return this.type !== 'healing' && (Boolean(this.damage.main) || !foundry.utils.isEmpty(this.damage.resources));
|
||||
}
|
||||
|
||||
get hasHealing() {
|
||||
return Boolean(Object.keys(this.damage?.parts ?? {}).length) && this.type === 'healing';
|
||||
return this.type === 'healing' && !foundry.utils.isEmpty(this.damage.resources);
|
||||
}
|
||||
|
||||
get hasSave() {
|
||||
|
|
@ -469,6 +469,25 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
if (source.damage?.parts && !source.damage.resources && !source.damage.main) {
|
||||
source.damage.main = null;
|
||||
source.damage.resources = {};
|
||||
for (const [partKey, part] of Object.entries(source.damage.parts)) {
|
||||
if (partKey === 'hitPoints' && source.type !== 'healing') {
|
||||
source.damage.main = {
|
||||
...part,
|
||||
includeBase: source.damage.includeBase,
|
||||
direct: source.damage.direct,
|
||||
groupAttack: source.damage.groupAttack
|
||||
};
|
||||
} else {
|
||||
source.damage.resources[partKey] = part;
|
||||
}
|
||||
}
|
||||
|
||||
delete source.damage.parts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,8 @@ export default class DHDamageAction extends DHBaseAction {
|
|||
* @returns Formula string
|
||||
*/
|
||||
getDamageFormula() {
|
||||
const strings = [];
|
||||
for (const { value } of this.damage.parts) {
|
||||
strings.push(Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {}));
|
||||
}
|
||||
if (!this.damage.main) return '';
|
||||
|
||||
return strings.join(' + ');
|
||||
return Roll.replaceFormulaData(this.damage.main.value.getFormula(), this.actor?.getRollData() ?? {});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ export default class DhpAdversary extends DhCreature {
|
|||
type: 'attack'
|
||||
},
|
||||
damage: {
|
||||
parts: {
|
||||
hitPoints: {
|
||||
main: {
|
||||
type: ['physical'],
|
||||
applyTo: 'hitPoints',
|
||||
value: {
|
||||
|
|
@ -94,7 +93,6 @@ export default class DhpAdversary extends DhCreature {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
experiences: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
|
|
|
|||
|
|
@ -104,8 +104,7 @@ export default class DhCharacter extends DhCreature {
|
|||
trait: 'strength'
|
||||
},
|
||||
damage: {
|
||||
parts: {
|
||||
hitPoints: {
|
||||
main: {
|
||||
type: ['physical'],
|
||||
applyTo: 'hitPoints',
|
||||
value: {
|
||||
|
|
@ -117,7 +116,6 @@ export default class DhCharacter extends DhCreature {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
levelData: new fields.EmbeddedDataField(DhLevelData),
|
||||
bonuses: new fields.SchemaField({
|
||||
|
|
@ -838,7 +836,7 @@ export default class DhCharacter extends DhCreature {
|
|||
isReversed: true
|
||||
};
|
||||
|
||||
this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||
this.attack.damage.main.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||
|
||||
// Clamp resources (must be done last to ensure all updates occur)
|
||||
this.resources.clamp();
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ export function getTierAdjustedAdversary(source, tier) {
|
|||
|
||||
// Store initial attack damage for abilities that have you deal a "standard attack"
|
||||
const initialAttack = {
|
||||
type: source.system.attack.damage?.parts.hitPoints?.type?.toSorted(),
|
||||
value: getFormula(source.system.attack.damage?.parts.hitPoints?.value)
|
||||
type: source.system.attack.damage?.main?.type?.toSorted(),
|
||||
value: getFormula(source.system.attack.damage?.main?.value)
|
||||
};
|
||||
|
||||
// Update damage of base attack.
|
||||
try {
|
||||
const damage = source.system.attack.damage;
|
||||
if (!damage?.parts.hitPoints) throw new Error('Unexpected missing attack in adversary');
|
||||
if (!damage?.main) throw new Error('Unexpected missing damage in adversary');
|
||||
|
||||
for (const property of ['value', 'valueAlt']) {
|
||||
const data = damage.parts.hitPoints[property];
|
||||
const data = damage.main[property];
|
||||
const previousFormula = getFormula(data);
|
||||
const value = calculateAdjustedDamage(previousFormula, 'attack', damageMeta);
|
||||
applyAdjustedDamage(data, value);
|
||||
|
|
@ -82,12 +82,12 @@ export function getTierAdjustedAdversary(source, tier) {
|
|||
|
||||
// Update damage in item actions and convert all formula matches in the descriptions to the new damage
|
||||
for (const action of Object.values(item.system.actions)) {
|
||||
if (!action.damage?.parts.hitPoints) continue;
|
||||
if (!action.damage?.main) continue;
|
||||
try {
|
||||
// Apply conversions and save a record. If it matches attack damage *and* Its not in the description, use attack conversion instead
|
||||
const result = [];
|
||||
for (const property of ['value', 'valueAlt']) {
|
||||
const { [property]: data, type: damageType } = action.damage.parts.hitPoints;
|
||||
const { [property]: data, type: damageType } = action.damage.main;
|
||||
const previousFormula = getFormula(data);
|
||||
const isActuallyAttack =
|
||||
previousFormula === initialAttack.value &&
|
||||
|
|
@ -199,7 +199,7 @@ function calculateAdjustedDamage(formula, type, { currentDamageRange, newDamageR
|
|||
}
|
||||
|
||||
/**
|
||||
* Get formula from either damage parts *or* a simple formula object.
|
||||
* Get formula from either damage data *or* a simple formula object.
|
||||
* @returns {string} the new formula data
|
||||
*/
|
||||
function getFormula(data) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { triggerChatRollFx } from '../../helpers/utils.mjs';
|
||||
import { ChatDamageData } from './chatDamageData.mjs';
|
||||
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
originItem: originItemField(),
|
||||
action: new fields.StringField()
|
||||
}),
|
||||
damage: new fields.ObjectField(),
|
||||
damage: new fields.EmbeddedDataField(ChatDamageData),
|
||||
damageOptions: new fields.ObjectField(),
|
||||
costs: new fields.ArrayField(new fields.ObjectField()),
|
||||
successConsumed: new fields.BooleanField({ initial: false })
|
||||
|
|
@ -132,28 +133,21 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
});
|
||||
}
|
||||
|
||||
/* TODO: Change how damage data is stored somehow to enable better rerolling */
|
||||
async getRerolledDamage() {
|
||||
if (!this.damage) return;
|
||||
if (!this.damage.active) return;
|
||||
|
||||
const rerolls = [];
|
||||
const update = { system: { damage: {} } };
|
||||
for (const partKey in this.damage) {
|
||||
const part = this.damage[partKey];
|
||||
const testRoll = Roll.fromData(part.parts[0].roll);
|
||||
const rerolled = await testRoll.reroll();
|
||||
rerolls.push(rerolled);
|
||||
const update = { system: { damage: { main: null, resources: _replace({}) } } };
|
||||
if (this.damage.main) {
|
||||
const reroll = await this.damage.main.reroll();
|
||||
rerolls.push(reroll);
|
||||
update.system.damage.main = reroll.toJSON();
|
||||
}
|
||||
|
||||
if (!update.system.damage[partKey]) update.system.damage[partKey] = { parts: [part.parts[0]] };
|
||||
const partData = update.system.damage[partKey].parts[0];
|
||||
update.system.damage[partKey].total = rerolled.total;
|
||||
partData.modifierTotal = rerolled.terms.reduce((acc, x) => {
|
||||
if (x.isDeterministic && !x.operator) acc += x.total;
|
||||
return acc;
|
||||
}, 0);
|
||||
partData.dice = rerolled.dice.map(d => ({ ...d.toJSON(), dice: d.denomination }));
|
||||
partData.total = rerolled.total;
|
||||
partData.roll = rerolled.toJSON();
|
||||
for (const key of Object.keys(this.damage.resources)) {
|
||||
const reroll = await this.damage.resources[key].reroll();
|
||||
rerolls.push(reroll);
|
||||
update.system.damage.resources[key] = reroll.toJSON();
|
||||
}
|
||||
|
||||
await triggerChatRollFx(rerolls);
|
||||
|
|
@ -198,6 +192,43 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
this.isGM = game.user.isGM; //temp
|
||||
}
|
||||
|
||||
static migrateData(source) {
|
||||
const { main, resources, ...flatDamageKeys } = source.damage ?? {};
|
||||
if (source.damage && !main && !resources) {
|
||||
source.damage.main = null;
|
||||
source.damage.resources = {};
|
||||
|
||||
const getRoll = key => {
|
||||
const damageData = source.damage[key];
|
||||
const oldRoll = damageData.parts[0]?.roll;
|
||||
return oldRoll ? JSON.stringify({
|
||||
...oldRoll,
|
||||
class: 'BaseRoll',
|
||||
options: {
|
||||
...oldRoll.options,
|
||||
damageTypes: damageData.parts[0].damageTypes ?? []
|
||||
}
|
||||
}) : null;
|
||||
};
|
||||
|
||||
for (const key of Object.keys(flatDamageKeys)) {
|
||||
if (key === 'hitPoints' && source.hasDamage && !source.hasHealing) {
|
||||
source.damage.main = getRoll('hitPoints');
|
||||
}
|
||||
else {
|
||||
source.damage.resources[key] = getRoll(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const key of Object.keys(flatDamageKeys)) {
|
||||
delete source.damage[key];
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
getTargetList() {
|
||||
const targets =
|
||||
this.targetMode && this.parent.isAuthor
|
||||
|
|
|
|||
58
module/data/chat-message/chatDamageData.mjs
Normal file
58
module/data/chat-message/chatDamageData.mjs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import { triggerChatRollFx } from '../../helpers/utils.mjs';
|
||||
|
||||
export class ChatDamageData extends foundry.abstract.DataModel {
|
||||
constructor(data = {}, options = {}) {
|
||||
super(data, options);
|
||||
|
||||
this._prepareRolls();
|
||||
}
|
||||
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
return {
|
||||
main: new fields.JSONField({ nullable: true, validate: ChatDamageData.#validateRoll}),
|
||||
resources: new fields.TypedObjectField(new fields.JSONField({validate: ChatDamageData.#validateRoll}))
|
||||
};
|
||||
}
|
||||
|
||||
get active() {
|
||||
return !!this.main || Boolean(Object.keys(this.resources).length);
|
||||
}
|
||||
|
||||
static #validateRoll(rollJSON) {
|
||||
if (rollJSON) {
|
||||
const roll = JSON.parse(rollJSON);
|
||||
if (!roll.evaluated) throw new Error('Roll objects added to ChatMessage documents must be evaluated');
|
||||
}
|
||||
}
|
||||
|
||||
_prepareRolls() {
|
||||
this.main &&= Roll.fromData(this.main);
|
||||
for (const key of Object.keys(this.resources)) {
|
||||
this.resources[key] = Roll.fromData(this.resources[key]);
|
||||
}
|
||||
}
|
||||
|
||||
async rerollDamageDie(isResource, damageType, dice, resultIndex) {
|
||||
const reroll = isResource ? this.resources[damageType] : this.main;
|
||||
const rerollDice = reroll.dice[dice];
|
||||
await rerollDice.rerollResult(resultIndex);
|
||||
await reroll._evaluate();
|
||||
|
||||
const rerolledResult = rerollDice.results[rerollDice.results.length - 1];
|
||||
if (rerolledResult) {
|
||||
const fakeRoll = {
|
||||
_evaluated: true,
|
||||
dice: [new foundry.dice.terms.Die({
|
||||
...rerollDice,
|
||||
results: [rerolledResult],
|
||||
total: rerolledResult.value,
|
||||
faces: rerollDice.faces
|
||||
})],
|
||||
options: { appearance: {} }
|
||||
};
|
||||
await triggerChatRollFx([fakeRoll]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,20 +12,10 @@ export default class DamageField extends fields.SchemaField {
|
|||
|
||||
/** @inheritDoc */
|
||||
constructor(options, context = {}) {
|
||||
const damageFields = {
|
||||
parts: new IterableTypedObjectField(DHDamageData),
|
||||
includeBase: new fields.BooleanField({
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
||||
}),
|
||||
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
|
||||
groupAttack: new fields.StringField({
|
||||
choices: CONFIG.DH.GENERAL.groupAttackRange,
|
||||
blank: true,
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.groupAttack.label'
|
||||
})
|
||||
};
|
||||
super(damageFields, options, context);
|
||||
super({
|
||||
main: new fields.EmbeddedDataField(DHDamageData, { nullable: true }),
|
||||
resources: new IterableTypedObjectField(DHResourceData)
|
||||
}, options, context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,25 +31,23 @@ export default class DamageField extends fields.SchemaField {
|
|||
this.hasRoll &&
|
||||
DamageField.getAutomation() === CONFIG.DH.SETTINGS.actionAutomationChoices.never.id &&
|
||||
!force
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
let formulas = this.damage.parts.map(p => ({
|
||||
formula: DamageField.getFormulaValue.call(this, p, config).getFormula(this.actor),
|
||||
damageTypes: p.applyTo === 'hitPoints' && !p.type.size ? new Set(['physical']) : p.type,
|
||||
applyTo: p.applyTo
|
||||
}));
|
||||
const damageFormula = this.damage.main ?
|
||||
DamageField.formatFormulas.call(this, [this.damage.main], config)[0] : null;
|
||||
const resourceFormulas = DamageField.formatFormulas.call(this, this.damage.resources, config);
|
||||
|
||||
if (!formulas.length) return false;
|
||||
|
||||
formulas = DamageField.formatFormulas.call(this, formulas, config);
|
||||
if (!damageFormula && !resourceFormulas.length) return false;
|
||||
|
||||
messageId = config.message?._id ?? messageId;
|
||||
const message = game.messages.get(messageId);
|
||||
const damageConfig = {
|
||||
dialog: {},
|
||||
...config,
|
||||
roll: formulas,
|
||||
damageFormula,
|
||||
resourceFormulas,
|
||||
data: this.getRollData(),
|
||||
isCritical: Boolean(message?.system.roll?.isCritical)
|
||||
};
|
||||
|
|
@ -92,7 +80,7 @@ export default class DamageField extends fields.SchemaField {
|
|||
|
||||
const targetDamage = [];
|
||||
const damagePromises = [];
|
||||
for (let target of targets) {
|
||||
for (const target of targets) {
|
||||
const actor = foundry.utils.fromUuidSync(target.actorId);
|
||||
if (!actor) continue;
|
||||
if (!config.hasHealing && config.onSave && target.saved?.success === true) {
|
||||
|
|
@ -114,13 +102,12 @@ export default class DamageField extends fields.SchemaField {
|
|||
actor.takeHealing(config.damage).then(updates => targetDamage.push({ token, updates }))
|
||||
);
|
||||
else {
|
||||
const configDamage = foundry.utils.deepClone(config.damage);
|
||||
const hpDamageMultiplier = config.actionActor?.system.rules?.attack?.damage?.hpDamageMultiplier ?? 1;
|
||||
const hpDamageTakenMultiplier = actor.system.rules?.attack?.damage?.hpDamageTakenMultiplier;
|
||||
if (configDamage.hitPoints) {
|
||||
for (const part of configDamage.hitPoints.parts) {
|
||||
part.total = Math.ceil(part.total * hpDamageMultiplier * hpDamageTakenMultiplier);
|
||||
}
|
||||
const configDamage = config.damage.clone();
|
||||
configDamage.main &&= configDamage.main.toJSON();
|
||||
if (configDamage.main) {
|
||||
const multiplier = config.actionActor?.system.rules?.attack?.damage?.hpDamageMultiplier ?? 1;
|
||||
const takenMultiplier = actor.system.rules?.attack?.damage?.hpDamageTakenMultiplier;
|
||||
configDamage.main.total = Math.ceil(configDamage.main.total * multiplier * takenMultiplier);
|
||||
}
|
||||
|
||||
damagePromises.push(
|
||||
|
|
@ -183,13 +170,19 @@ export default class DamageField extends fields.SchemaField {
|
|||
/**
|
||||
* Prepare formulas for Damage Roll
|
||||
* Must be called within Action context or similar.
|
||||
* @param {object[]} formulas Array of formatted formulas object
|
||||
* @param {DHResourceData[]} damageData Array of DHResourceData
|
||||
* @param {object} data Action getRollData
|
||||
* @returns
|
||||
*/
|
||||
static formatFormulas(formulas, data) {
|
||||
static formatFormulas(damageData, data) {
|
||||
const formulas = damageData.map(x => ({
|
||||
formula: DamageField.getFormulaValue.call(this, x, data).getFormula(this.actor),
|
||||
damageTypes: x.type ?? new Set(),
|
||||
applyTo: x.applyTo
|
||||
}));
|
||||
|
||||
const formattedFormulas = [];
|
||||
formulas.forEach(formula => {
|
||||
for (const formula of formulas) {
|
||||
if (isNaN(formula.formula))
|
||||
formula.formula = Roll.replaceFormulaData(formula.formula, this.getRollData(data));
|
||||
const same = formattedFormulas.find(
|
||||
|
|
@ -197,7 +190,8 @@ export default class DamageField extends fields.SchemaField {
|
|||
);
|
||||
if (same) same.formula += ` + ${formula.formula}`;
|
||||
else formattedFormulas.push(formula);
|
||||
});
|
||||
}
|
||||
|
||||
return formattedFormulas;
|
||||
}
|
||||
|
||||
|
|
@ -275,10 +269,18 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} the formula associated with this damage field
|
||||
*/
|
||||
getFormula() {
|
||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`,
|
||||
bonus = this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : '';
|
||||
return this.custom.enabled ? this.custom.formula : `${multiplier ?? 1}${this.dice}${bonus}`;
|
||||
if (this.custom.enabled) return this.custom.formula;
|
||||
|
||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`;
|
||||
if (!multiplier) return String(this.bonus || 0);
|
||||
|
||||
const dice = `${multiplier ?? 1}${this.dice}`;
|
||||
const sign = this.bonus < 0 ? ' - ' : ' + ';
|
||||
return this.bonus ? `${dice} ${sign} ${Math.abs(this.bonus)}` : dice;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -286,6 +288,7 @@ export class DHResourceData extends foundry.abstract.DataModel {
|
|||
/** @override */
|
||||
static defineSchema() {
|
||||
return {
|
||||
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
||||
applyTo: new fields.StringField({
|
||||
choices: CONFIG.DH.GENERAL.healingTypes,
|
||||
required: true,
|
||||
|
|
@ -308,7 +311,16 @@ export class DHDamageData extends DHResourceData {
|
|||
static defineSchema() {
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
||||
includeBase: new fields.BooleanField({
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
||||
}),
|
||||
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
|
||||
groupAttack: new fields.StringField({
|
||||
choices: CONFIG.DH.GENERAL.groupAttackRange,
|
||||
blank: true,
|
||||
label: 'DAGGERHEART.ACTIONS.Settings.groupAttack.label'
|
||||
}),
|
||||
type: new fields.SetField(
|
||||
new fields.StringField({
|
||||
choices: CONFIG.DH.GENERAL.damageTypes,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
super(summonFields, options, context);
|
||||
}
|
||||
|
||||
static async execute() {
|
||||
static async execute(config) {
|
||||
if (!canvas.scene) {
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.ACTIONS.TYPES.summon.error'));
|
||||
return;
|
||||
|
|
@ -36,6 +36,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
|
||||
const rolls = [];
|
||||
const summonData = [];
|
||||
const chatMessageData = [];
|
||||
for (const summon of this.summon) {
|
||||
const roll = new Roll(itemAbleRollParse(summon.count, this.actor, this.item));
|
||||
await roll.evaluate();
|
||||
|
|
@ -54,17 +55,18 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
tokenPreviewName: `${actor.prototypeToken.name}${remaining > 1 ? ` (${remaining}x)` : ''}`
|
||||
});
|
||||
}
|
||||
|
||||
chatMessageData.push({
|
||||
data: actor,
|
||||
quantity: countNumber
|
||||
});
|
||||
}
|
||||
|
||||
if (rolls.length) await triggerChatRollFx(rolls);
|
||||
|
||||
this.actor.sheet?.minimize();
|
||||
DHSummonField.handleSummon(summonData, this.actor);
|
||||
}
|
||||
|
||||
static async handleSummon(summonData, actionActor) {
|
||||
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: actionActor.token?.elevation });
|
||||
|
||||
return actionActor.sheet?.maximize();
|
||||
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: this.actor.token?.elevation });
|
||||
this.actor.sheet?.maximize();
|
||||
config.summonData = chatMessageData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ export function ActionMixin(Base) {
|
|||
result = this.parent;
|
||||
} else {
|
||||
result = await this.item.update({ [path]: updates }, options);
|
||||
if (!result) return result;
|
||||
}
|
||||
|
||||
return this.inCollection
|
||||
|
|
@ -269,10 +270,7 @@ export function ActionMixin(Base) {
|
|||
return this.delete();
|
||||
}
|
||||
|
||||
async toChat(origin) {
|
||||
const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
|
||||
.expandRollMessage?.desc;
|
||||
|
||||
async toChat(origin, config) {
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
title: game.i18n.localize('DAGGERHEART.CONFIG.FeatureForm.action'),
|
||||
|
|
@ -282,7 +280,7 @@ export function ActionMixin(Base) {
|
|||
img: this.baseAction ? this.parent.parent.img : this.img,
|
||||
tags: this.tags ? this.tags : ['Spell', 'Arcana', 'Lv 10'],
|
||||
areas: this.areas,
|
||||
summon: this.summon
|
||||
summon: config?.summonData
|
||||
},
|
||||
source: {
|
||||
actor: this.actor.uuid,
|
||||
|
|
@ -307,7 +305,7 @@ export function ActionMixin(Base) {
|
|||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/action.hbs',
|
||||
{ ...systemData, open: autoExpandDescription ? 'open' : '' }
|
||||
systemData
|
||||
),
|
||||
flags: {
|
||||
daggerheart: {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
})
|
||||
};
|
||||
|
||||
if (this.metadata.hasDescription) schema.description = new fields.HTMLField({ required: true, nullable: true });
|
||||
if (this.metadata.hasDescription) {
|
||||
schema.description = new fields.HTMLField({ required: true, nullable: true });
|
||||
schema.gmNotes = new fields.HTMLField({ required: true, nullable: true });
|
||||
}
|
||||
|
||||
if (this.metadata.hasResource) {
|
||||
schema.resource = new fields.SchemaField(
|
||||
|
|
@ -134,7 +137,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
/**
|
||||
* Augments the description for the item with type specific info to display. Implemented in applicable item subtypes.
|
||||
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||
* @returns {string}
|
||||
* @returns {Promise<{ prefix: string | null; value: string | null; suffix: string | null }>}
|
||||
*/
|
||||
async getDescriptionData(_options) {
|
||||
return { prefix: null, value: this.description, suffix: null };
|
||||
|
|
@ -143,16 +146,26 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
/**
|
||||
* Gets the enriched and augmented description for the item.
|
||||
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||
* @returns {string}
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getEnrichedDescription() {
|
||||
async getEnrichedDescription({ gmNotes = true } = {}) {
|
||||
if (!this.metadata.hasDescription) return '';
|
||||
|
||||
const { prefix, value, suffix } = await this.getDescriptionData();
|
||||
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
||||
let fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
||||
if (this.gmNotes && gmNotes) {
|
||||
const gmNotesElement = document.createElement('section');
|
||||
gmNotesElement.classList.add('gm-notes-section');
|
||||
gmNotesElement.dataset.visibility = 'gm';
|
||||
const header = document.createElement('header');
|
||||
header.classList.add('gm-notes');
|
||||
header.textContent = _loc('DAGGERHEART.ITEMS.FIELDS.gmNotes.label');
|
||||
gmNotesElement.innerHTML = header.outerHTML + this.gmNotes;
|
||||
fullDescription += gmNotesElement.outerHTML;
|
||||
}
|
||||
|
||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
||||
relativeTo: this,
|
||||
relativeTo: this.parent,
|
||||
rollData: this.getRollData(),
|
||||
secrets: this.parent.isOwner
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ export default class DHWeapon extends AttachableItem {
|
|||
type: 'attack'
|
||||
},
|
||||
damage: {
|
||||
parts: {
|
||||
hitPoints: {
|
||||
main: {
|
||||
type: ['physical'],
|
||||
value: {
|
||||
multiplier: 'prof',
|
||||
|
|
@ -77,7 +76,6 @@ export default class DHWeapon extends AttachableItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
rules: new fields.SchemaField({
|
||||
attack: new fields.SchemaField({
|
||||
|
|
@ -230,11 +228,12 @@ export default class DHWeapon extends AttachableItem {
|
|||
game.i18n.localize(`DAGGERHEART.CONFIG.Burden.${burden}`)
|
||||
];
|
||||
|
||||
for (const { value, type } of attack.damage.parts) {
|
||||
if (attack.damage.main) {
|
||||
const { value, type } = attack.damage.main;
|
||||
const parts = value.custom.enabled ? [game.i18n.localize('DAGGERHEART.GENERAL.custom')] : [value.dice];
|
||||
if (!value.custom.enabled && value.bonus) parts.push(value.bonus.signedString());
|
||||
|
||||
if (type.size > 0) {
|
||||
if (type?.size) {
|
||||
const typeTags = Array.from(type)
|
||||
.map(t => game.i18n.localize(`DAGGERHEART.CONFIG.DamageType.${t}.abbreviation`))
|
||||
.join(' | ');
|
||||
|
|
@ -258,10 +257,10 @@ export default class DHWeapon extends AttachableItem {
|
|||
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`));
|
||||
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||
|
||||
for (const { value, type } of damage.parts) {
|
||||
for (const { value, type } of [damage.main, ...damage.resources].filter(d => !!d)) {
|
||||
const str = Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {});
|
||||
|
||||
const icons = Array.from(type)
|
||||
const icons = Array.from(type ?? [])
|
||||
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
||||
.filter(Boolean);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { ChatDamageData } from './chat-message/chatDamageData.mjs';
|
||||
|
||||
export default class TagTeamData extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -37,6 +39,7 @@ export class MemberData extends foundry.abstract.DataModel {
|
|||
}),
|
||||
rollChoice: new fields.StringField({ nullable: true, initial: null }),
|
||||
rollData: new fields.JSONField({ nullable: true, initial: null }),
|
||||
damageRollData: new fields.EmbeddedDataField(ChatDamageData),
|
||||
selected: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,8 @@ export default class BaseRoll extends Roll {
|
|||
|
||||
/** @inheritdoc */
|
||||
static TOOLTIP_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRollTooltip.hbs';
|
||||
|
||||
get modifierTotal() {
|
||||
return this.total - this.dice.reduce((acc, dice) => acc + dice.total, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,36 +13,34 @@ export default class DamageRoll extends DHRoll {
|
|||
|
||||
static DefaultDialog = DamageDialog;
|
||||
|
||||
/** @inheritdoc */
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
if (config.dialog.configure === false) roll.constructFormula(config);
|
||||
for (const roll of config.roll) await roll.roll.evaluate();
|
||||
|
||||
roll._evaluated = true;
|
||||
|
||||
const parts = [];
|
||||
for (const rollData of config.roll) {
|
||||
const roll = rollData.roll;
|
||||
parts.push({
|
||||
...rollData,
|
||||
...roll.options.roll,
|
||||
total: roll.total,
|
||||
formula: roll.formula,
|
||||
dice: roll.dice.map(d => ({
|
||||
dice: d.denomination,
|
||||
total: d.total,
|
||||
formula: d.formula,
|
||||
results: d.results
|
||||
})),
|
||||
damageTypes: [...(rollData.damageTypes ?? [])],
|
||||
roll,
|
||||
type: config.type,
|
||||
modifierTotal: this.calculateTotalModifiers(roll)
|
||||
});
|
||||
rollData.roll = JSON.stringify(roll.toJSON());
|
||||
static createRollInstance(config) {
|
||||
return new this(undefined, config.data, config);
|
||||
}
|
||||
|
||||
config.damage = this.unifyDamageRoll(parts);
|
||||
/** @inheritdoc */
|
||||
static async buildEvaluate(roll, config = {}) {
|
||||
if (config.dialog.configure === false) roll.constructFormulas(config);
|
||||
|
||||
const evaluateRoll = async roll => {
|
||||
await roll.roll.evaluate();
|
||||
roll.roll.options = { damageTypes: roll.damageTypes ? [...roll.damageTypes] : [] };
|
||||
return roll.roll;
|
||||
}
|
||||
|
||||
if (!config.damage) config.damage = { main: null, resources: {} };
|
||||
|
||||
if (config.damageFormula) {
|
||||
config.damage.main = await evaluateRoll(config.damageFormula);
|
||||
config.damage.main.options = { damageTypes:
|
||||
config.damageFormula.damageTypes ? [...config.damageFormula.damageTypes] : []
|
||||
};
|
||||
}
|
||||
|
||||
for (const roll of config.resourceFormulas) {
|
||||
config.damage.resources[roll.applyTo] = await evaluateRoll(roll);
|
||||
}
|
||||
|
||||
roll._evaluated = true;
|
||||
}
|
||||
|
||||
static async buildPost(roll, config, message) {
|
||||
|
|
@ -53,9 +51,10 @@ export default class DamageRoll extends DHRoll {
|
|||
const diceRolls = [];
|
||||
if (game.modules.get('dice-so-nice')?.active) {
|
||||
config.mute = true;
|
||||
const pool = foundry.dice.terms.PoolTerm.fromRolls(
|
||||
Object.values(config.damage).flatMap(r => r.parts.map(p => p.roll))
|
||||
);
|
||||
const pool = foundry.dice.terms.PoolTerm.fromRolls([
|
||||
...(config.damage.main ? [config.damage.main] : []),
|
||||
...Object.values(config.damage.resources)
|
||||
]);
|
||||
diceRolls.push(Roll.fromTerms([pool]));
|
||||
}
|
||||
|
||||
|
|
@ -66,22 +65,14 @@ export default class DamageRoll extends DHRoll {
|
|||
await super.buildPost(roll, config, message);
|
||||
|
||||
if (config.source?.message) {
|
||||
chatMessage.update({ 'system.damage': config.damage });
|
||||
chatMessage.update({ 'system.damage': {
|
||||
...config.damage.toObject(),
|
||||
main: config.damage.main,
|
||||
resources: config.damage.resources
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
static unifyDamageRoll(rolls) {
|
||||
const unified = {};
|
||||
rolls.forEach(r => {
|
||||
const resource = unified[r.applyTo] ?? { formula: '', total: 0, parts: [] };
|
||||
resource.formula += `${resource.formula !== '' ? ' + ' : ''}${r.formula}`;
|
||||
resource.total += r.total;
|
||||
resource.parts.push(r);
|
||||
unified[r.applyTo] = resource;
|
||||
});
|
||||
return unified;
|
||||
}
|
||||
|
||||
static formatGlobal(rolls) {
|
||||
let formula, total;
|
||||
const applyTo = new Set(rolls.flatMap(r => r.applyTo));
|
||||
|
|
@ -130,11 +121,9 @@ export default class DamageRoll extends DHRoll {
|
|||
const type = this.options.messageType ?? (this.options.hasHealing ? 'healing' : 'damage');
|
||||
const changeKeys = [];
|
||||
|
||||
for (const roll of this.options.roll) {
|
||||
for (const damageType of roll.damageTypes?.values?.() ?? []) {
|
||||
for (const damageType of this.options.damageFormula?.damageTypes?.values?.() ?? []) {
|
||||
changeKeys.push(`system.bonuses.${type}.${damageType}`);
|
||||
}
|
||||
}
|
||||
|
||||
const item = this.data.parent?.items?.get(this.options.source.item);
|
||||
if (item) {
|
||||
|
|
@ -151,62 +140,69 @@ export default class DamageRoll extends DHRoll {
|
|||
return changeKeys;
|
||||
}
|
||||
|
||||
constructFormula(config) {
|
||||
constructFormulas(config) {
|
||||
return {
|
||||
damageFormula: this.constructFormula(this.options.damageFormula, config, true),
|
||||
resourceFormulas: this.options.resourceFormulas.map(x => this.constructFormula(x, config))
|
||||
};
|
||||
}
|
||||
|
||||
constructFormula(formulaData, config, isDamage) {
|
||||
if (!formulaData) return null;
|
||||
this.options.isCritical = config.isCritical;
|
||||
for (const [index, part] of this.options.roll.entries()) {
|
||||
const isHitpointPart = part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id;
|
||||
part.roll = new Roll(Roll.replaceFormulaData(part.formula, config.data));
|
||||
part.roll.terms = Roll.parse(part.roll.formula, config.data);
|
||||
if (part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||
part.modifiers = this.applyBaseBonus(part);
|
||||
this.addModifiers(part);
|
||||
part.modifiers?.forEach(m => {
|
||||
part.roll.terms.push(...this.formatModifier(m.value));
|
||||
});
|
||||
}
|
||||
|
||||
/* To Remove When Reaction System */
|
||||
if (index === 0 && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||
for (const mod in config.modifiers) {
|
||||
const modifier = config.modifiers[mod];
|
||||
if (modifier.beforeCrit === true && (modifier.enabled || modifier.value)) modifier.callback(part);
|
||||
}
|
||||
}
|
||||
formulaData.roll = new Roll(Roll.replaceFormulaData(formulaData.formula, config.data));
|
||||
formulaData.roll.terms = Roll.parse(formulaData.roll.formula, config.data);
|
||||
|
||||
if (part.extraFormula) {
|
||||
part.roll.terms.push(
|
||||
if (formulaData.extraFormula) {
|
||||
formulaData.roll.terms.push(
|
||||
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
|
||||
...this.constructor.parse(part.extraFormula, this.options.data)
|
||||
...this.constructor.parse(formulaData.extraFormula, this.options.data)
|
||||
);
|
||||
}
|
||||
|
||||
if (config.damageOptions.groupAttack?.numAttackers > 1 && isHitpointPart) {
|
||||
if (isDamage && formulaData.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||
formulaData.modifiers = this.applyBaseBonus(formulaData);
|
||||
this.addModifiers(formulaData);
|
||||
formulaData.modifiers?.forEach(m => {
|
||||
formulaData.roll.terms.push(...this.formatModifier(m.value));
|
||||
});
|
||||
|
||||
/* To Remove When Reaction System */
|
||||
for (const mod in config.modifiers) {
|
||||
const modifier = config.modifiers[mod];
|
||||
if (
|
||||
modifier.beforeCrit === true &&
|
||||
(modifier.enabled || modifier.value)
|
||||
) modifier.callback(formulaData);
|
||||
}
|
||||
|
||||
/* To Remove When Reaction System */
|
||||
for (const mod in config.modifiers) {
|
||||
const modifier = config.modifiers[mod];
|
||||
if (!modifier.beforeCrit && (modifier.enabled || modifier.value)) modifier.callback(formulaData);
|
||||
}
|
||||
|
||||
if (config.damageOptions.groupAttack?.numAttackers > 1) {
|
||||
const damageTypes = [foundry.dice.terms.Die, foundry.dice.terms.NumericTerm];
|
||||
for (const term of part.roll.terms) {
|
||||
for (const term of formulaData.roll.terms) {
|
||||
if (damageTypes.some(type => term instanceof type)) {
|
||||
term.number *= config.damageOptions.groupAttack.numAttackers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.isCritical && isHitpointPart) {
|
||||
const total = part.roll.dice.reduce((acc, term) => acc + term._faces * term._number, 0);
|
||||
if (config.isCritical) {
|
||||
const total = formulaData.roll.dice.reduce((acc, term) => acc + term._faces * term._number, 0);
|
||||
if (total > 0) {
|
||||
part.roll.terms.push(...this.formatModifier(total));
|
||||
formulaData.roll.terms.push(...this.formatModifier(total));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* To Remove When Reaction System */
|
||||
if (index === 0 && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
|
||||
for (const mod in config.modifiers) {
|
||||
const modifier = config.modifiers[mod];
|
||||
if (!modifier.beforeCrit && (modifier.enabled || modifier.value)) modifier.callback(part);
|
||||
}
|
||||
}
|
||||
formulaData.roll._formula = this.constructor.getFormula(formulaData.roll.terms);
|
||||
|
||||
part.roll._formula = this.constructor.getFormula(part.roll.terms);
|
||||
}
|
||||
return this.options.roll;
|
||||
return formulaData;
|
||||
}
|
||||
|
||||
/* To Remove When Reaction System */
|
||||
|
|
@ -299,76 +295,4 @@ export default class DamageRoll extends DHRoll {
|
|||
config.modifiers = mods;
|
||||
return mods;
|
||||
}
|
||||
|
||||
static async reroll(rollPart, dice, result) {
|
||||
let diceIndex = 0;
|
||||
let parsedRoll = game.system.api.dice.DamageRoll.fromData({
|
||||
...rollPart.roll,
|
||||
terms: rollPart.roll.terms.map(term => {
|
||||
const isDie = term.class === 'Die';
|
||||
const fixedTerm = {
|
||||
...term,
|
||||
...(isDie ? { results: rollPart.dice[diceIndex].results } : {})
|
||||
};
|
||||
|
||||
if (isDie) diceIndex++;
|
||||
return fixedTerm;
|
||||
}),
|
||||
class: 'DamageRoll',
|
||||
evaluated: false
|
||||
});
|
||||
|
||||
const parsedDiceTerms = Object.keys(parsedRoll.terms).reduce((acc, key) => {
|
||||
const term = parsedRoll.terms[key];
|
||||
if (term instanceof CONFIG.Dice.termTypes.DiceTerm) acc[Object.keys(acc).length] = term;
|
||||
return acc;
|
||||
}, {});
|
||||
const term = parsedDiceTerms[dice];
|
||||
const termResult = parsedDiceTerms[dice].results[result];
|
||||
|
||||
const newIndex = parsedDiceTerms[dice].results.length;
|
||||
await term.reroll(`/r1=${termResult.result}`);
|
||||
|
||||
const diceRolls = [];
|
||||
if (game.modules.get('dice-so-nice')?.active) {
|
||||
const newResult = parsedDiceTerms[dice].results[newIndex];
|
||||
diceRolls.push({
|
||||
_evaluated: true,
|
||||
dice: [
|
||||
new foundry.dice.terms.Die({
|
||||
...term,
|
||||
total: newResult.result,
|
||||
faces: term._faces,
|
||||
results: [newResult]
|
||||
})
|
||||
],
|
||||
options: { appearance: {} }
|
||||
});
|
||||
}
|
||||
|
||||
await triggerChatRollFx(diceRolls);
|
||||
await parsedRoll.evaluate();
|
||||
|
||||
const results = parsedRoll.dice[dice].results.map(result => ({
|
||||
...result,
|
||||
discarded: !result.active
|
||||
}));
|
||||
const newResult = results.splice(results.length - 1, 1);
|
||||
results.splice(Number(result) + 1, 0, newResult[0]);
|
||||
|
||||
const rerolledDice = parsedRoll.dice.map((x, index) => {
|
||||
const isRerollDice = index === Number(dice);
|
||||
if (!isRerollDice) return { ...x, dice: x.denomination };
|
||||
return {
|
||||
dice: parsedRoll.dice[dice].denomination,
|
||||
total: parsedRoll.dice[dice].total,
|
||||
results: results.map(result => ({
|
||||
...result,
|
||||
hasRerolls: result.hasRerolls || isRerollDice
|
||||
}))
|
||||
};
|
||||
});
|
||||
|
||||
return { parsedRoll, rerolledDice };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
||||
import { triggerChatRollFx } from '../helpers/utils.mjs';
|
||||
import BaseRoll from './baseRoll.mjs';
|
||||
|
||||
export default class DHRoll extends Roll {
|
||||
export default class DHRoll extends BaseRoll {
|
||||
baseTerms = [];
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, foundry.utils.mergeObject(options, { roll: [] }, { overwrite: false }));
|
||||
|
|
@ -40,6 +41,10 @@ export default class DHRoll extends Roll {
|
|||
return config;
|
||||
}
|
||||
|
||||
static createRollInstance(config) {
|
||||
return new this(config.roll.formula, config.data, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Partial<RollConfig>} config
|
||||
* @returns {Promise<RollConfig>}
|
||||
|
|
@ -57,7 +62,7 @@ export default class DHRoll extends Roll {
|
|||
|
||||
this.temporaryModifierBuilder(config);
|
||||
|
||||
let roll = new this(config.roll.formula, config.data, config);
|
||||
let roll = this.createRollInstance(config);
|
||||
if (config.dialog.configure !== false) {
|
||||
// Open Roll Dialog
|
||||
const DialogClass = config.dialog?.class ?? this.DefaultDialog;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
import { adjustDice } from '../../helpers/utils.mjs';
|
||||
|
||||
export default class BaseDie extends foundry.dice.terms.Die {
|
||||
async rerollResult(resultIndex) {
|
||||
const result = this.results[resultIndex];
|
||||
result.rerolled = true;
|
||||
result.active = false;
|
||||
await this.roll({ reroll: true });
|
||||
|
||||
const rerolledResult = this.results[this.results.length - 1];
|
||||
this.results.splice(this.results.length - 1, 1);
|
||||
this.results.splice(resultIndex, 0, rerolledResult);
|
||||
}
|
||||
|
||||
static MODIFIERS = {
|
||||
...foundry.dice.terms.Die.MODIFIERS,
|
||||
cc: 'compoundComboDice',
|
||||
|
|
|
|||
|
|
@ -409,8 +409,4 @@ export default class DualityRoll extends D20Roll {
|
|||
|
||||
return rerolled;
|
||||
}
|
||||
|
||||
fromJSON(json) {
|
||||
return super.fromJSON(json);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -622,6 +622,11 @@ export default class DhpActor extends Actor {
|
|||
return rollData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if damage can be reduced in one way or another.
|
||||
* @param {number} hpDamage the amount of marked hp that will be marked
|
||||
* @param {Set<string>} types a list of damage types
|
||||
*/
|
||||
#canReduceDamage(hpDamage, types) {
|
||||
const { stressDamageReduction, disabledArmor, reduceSeverity, thresholdImmunities } =
|
||||
this.system.rules.damageReduction;
|
||||
|
|
@ -648,35 +653,32 @@ export default class DhpActor extends Actor {
|
|||
return canUseArmor || canUseStress || hasReduceSeverity || hasThresholdImmunity;
|
||||
}
|
||||
|
||||
async takeDamage(damages, isDirect = false) {
|
||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, damages) === false) return null;
|
||||
async takeDamage(args, isDirect = false) {
|
||||
args = this.#parseDamageArgs(args);
|
||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, args) === false) return null;
|
||||
|
||||
if (this.type === 'companion') {
|
||||
await this.modifyResource([{ value: 1, key: 'stress' }]);
|
||||
return;
|
||||
}
|
||||
|
||||
const updates = [];
|
||||
const updates = args.resourceUpdates;
|
||||
if (args.main) {
|
||||
// todo: avoid side effects, but hook currently requires it
|
||||
args.main.value = this.calculateDamage(args.main.value, args.main.damageTypes);
|
||||
}
|
||||
|
||||
Object.entries(damages).forEach(([key, damage]) => {
|
||||
damage.parts.forEach(part => {
|
||||
if (part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
|
||||
part.total = this.calculateDamage(part.total, part.damageTypes);
|
||||
const update = updates.find(u => u.key === key);
|
||||
if (update) {
|
||||
update.value += part.total;
|
||||
update.damageTypes.add(...new Set(part.damageTypes));
|
||||
} else updates.push({ value: part.total, key, damageTypes: new Set(part.damageTypes) });
|
||||
});
|
||||
});
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postCalculateDamage`, this, args) === false) return null;
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postCalculateDamage`, this, damages) === false) return null;
|
||||
// Convert deducted resources to a record of updates. Return if nothing to do.
|
||||
if (!updates.some(u => u.value) && !args.main) return;
|
||||
|
||||
if (!updates.length) return;
|
||||
|
||||
const hpDamage = updates.find(u => u.key === CONFIG.DH.GENERAL.healingTypes.hitPoints.id);
|
||||
if (hpDamage?.value) {
|
||||
hpDamage.value = this.convertDamageToThreshold(hpDamage.value);
|
||||
if (args.main) {
|
||||
const hpDamage = {
|
||||
value: this.convertDamageToThreshold(args.main.value),
|
||||
damageTypes: new Set(args.main.damageTypes),
|
||||
key: CONFIG.DH.GENERAL.healingTypes.hitPoints.id
|
||||
};
|
||||
if (this.type === 'character' && !isDirect && this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)) {
|
||||
const armorSlotResult = await this.owner.query(
|
||||
'armorSlot',
|
||||
|
|
@ -691,7 +693,7 @@ export default class DhpActor extends Actor {
|
|||
);
|
||||
if (armorSlotResult) {
|
||||
const { modifiedDamage, armorChanges, stressSpent } = armorSlotResult;
|
||||
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
|
||||
hpDamage.value = modifiedDamage;
|
||||
for (const armorChange of armorChanges) {
|
||||
updates.push({ value: armorChange.amount, key: 'armor', uuid: armorChange.uuid });
|
||||
}
|
||||
|
|
@ -701,20 +703,24 @@ export default class DhpActor extends Actor {
|
|||
else updates.push({ value: stressSpent, key: 'stress' });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.type === 'adversary') {
|
||||
} else if (this.type === 'adversary') {
|
||||
const reducedSeverity = hpDamage.damageTypes.reduce((value, curr) => {
|
||||
return Math.max(this.system.rules.damageReduction.reduceSeverity[curr], value);
|
||||
}, 0);
|
||||
hpDamage.value = Math.max(hpDamage.value - reducedSeverity, 0);
|
||||
|
||||
if (
|
||||
hpDamage.value &&
|
||||
this.system.rules.damageReduction.thresholdImmunities[getDamageKey(hpDamage.value)]
|
||||
) {
|
||||
hpDamage.value -= 1;
|
||||
if (this.system.rules.damageReduction.thresholdImmunities[getDamageKey(hpDamage.value)]) {
|
||||
hpDamage.value = Math.max(0, hpDamage.value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Merge existing hitPoint deduction with finalised damage deduction
|
||||
const existing = updates.find(u => u.key === CONFIG.DH.GENERAL.healingTypes.hitPoints.id);
|
||||
if (existing) {
|
||||
existing.value += hpDamage.value;
|
||||
existing.damageTypes = hpDamage.damageTypes;
|
||||
} else {
|
||||
updates.push(hpDamage);
|
||||
}
|
||||
}
|
||||
|
||||
const results = await game.system.registeredTriggers.runTrigger(
|
||||
|
|
@ -730,11 +736,9 @@ export default class DhpActor extends Actor {
|
|||
resourceMap.updateResources();
|
||||
}
|
||||
|
||||
updates.forEach(
|
||||
u =>
|
||||
(u.value =
|
||||
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
|
||||
);
|
||||
for (const u of updates) {
|
||||
u.value = u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value;
|
||||
}
|
||||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
|
|
@ -743,6 +747,36 @@ export default class DhpActor extends Actor {
|
|||
return updates;
|
||||
}
|
||||
|
||||
async takeHealing(args) {
|
||||
args = this.#parseDamageArgs({ resources: 'resources' in args ? args.resources : args });
|
||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeHealing`, this, args) === false) return null;
|
||||
|
||||
const updates = args.resourceUpdates;
|
||||
for (const u of updates) {
|
||||
const shouldFlip = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false);
|
||||
u.value = shouldFlip ? u.value * -1 : u.value;
|
||||
}
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates) === false) return null;
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
||||
/** Parse damage args that may be coming from takeHealing or takeDamage. Used to simplify macro usage and roll vs non-roll usage */
|
||||
#parseDamageArgs(args = {}) {
|
||||
const damageRoll = 'total' in args ? args : (args.main ?? args.damage);
|
||||
const damageValue = typeof damageRoll === 'number' ? damageRoll : damageRoll?.total;
|
||||
const damageTypes = Array.from(damageRoll?.options?.damageTypes ?? damageRoll?.damageTypes ?? []);
|
||||
const main = typeof damageValue === 'number' ? { key: 'damage', value: damageValue, damageTypes } : null;
|
||||
const resourceUpdates = Object.entries(args.resources ?? {}).map(([key, damage]) => ({
|
||||
key,
|
||||
value: typeof damage === 'number' ? damage : damage?.total ?? 0
|
||||
}));
|
||||
|
||||
return { main, resourceUpdates };
|
||||
}
|
||||
|
||||
calculateDamage(baseDamage, type) {
|
||||
if (this.canResist(type, 'immunity')) return 0;
|
||||
if (this.canResist(type, 'resistance')) baseDamage = Math.ceil(baseDamage / 2);
|
||||
|
|
@ -767,32 +801,6 @@ export default class DhpActor extends Actor {
|
|||
return reduction === Infinity ? 0 : reduction;
|
||||
}
|
||||
|
||||
async takeHealing(healings) {
|
||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeHealing`, this, healings) === false) return null;
|
||||
|
||||
const updates = [];
|
||||
Object.entries(healings).forEach(([key, healing]) => {
|
||||
healing.parts.forEach(part => {
|
||||
const update = updates.find(u => u.key === key);
|
||||
if (update) update.value += part.total;
|
||||
else updates.push({ value: part.total, key });
|
||||
});
|
||||
});
|
||||
|
||||
updates.forEach(
|
||||
u =>
|
||||
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
|
||||
? u.value * -1
|
||||
: u.value)
|
||||
);
|
||||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates) === false) return null;
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resources are modified asynchronously, so be careful not to update the same resource in
|
||||
* quick succession.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,13 @@ import { emitGMUpdate, emitGMCreate, GMUpdateEvent } from '../systemRegistration
|
|||
export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||
targetHook = null;
|
||||
|
||||
static #EXPAND_SECTIONS = [
|
||||
{ selector: 'roll-section [data-action="expandRoll"]', key: 'roll' },
|
||||
{ selector: 'damage-section', key: 'damage' },
|
||||
{ selector: 'target-section', key: 'target' },
|
||||
{ selector: 'description-section', key: 'desc' }
|
||||
];
|
||||
|
||||
async renderHTML() {
|
||||
const actor = game.actors.get(this.speaker.actor);
|
||||
const actorData =
|
||||
|
|
@ -89,23 +96,26 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
}
|
||||
}
|
||||
|
||||
// Check registered selectors and the main item section for expanding
|
||||
// Preserving during re-render is handled by core foundry on anything with [data-action=expandRoll]
|
||||
const autoExpandRoll = game.settings.get(
|
||||
CONFIG.DH.id,
|
||||
CONFIG.DH.SETTINGS.gameSettings.appearance
|
||||
).expandRollMessage,
|
||||
rollSections = html.querySelectorAll('.roll-part'),
|
||||
itemDesc = html.querySelector('.domain-card-move');
|
||||
rollSections.forEach(s => {
|
||||
if (s.classList.contains('roll-section')) {
|
||||
const toExpand = s.querySelector('[data-action="expandRoll"]');
|
||||
toExpand.classList.toggle('expanded', autoExpandRoll.roll);
|
||||
} else if (s.classList.contains('damage-section'))
|
||||
s.classList.toggle('expanded', autoExpandRoll.damage);
|
||||
else if (s.classList.contains('target-section')) s.classList.toggle('expanded', autoExpandRoll.target);
|
||||
else if (s.classList.contains('description-section'))
|
||||
s.classList.toggle('expanded', autoExpandRoll.desc);
|
||||
});
|
||||
if (itemDesc && autoExpandRoll.desc) itemDesc.setAttribute('open', '');
|
||||
CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance
|
||||
).expandRollMessage;
|
||||
for (const { selector, key } of DhpChatMessage.#EXPAND_SECTIONS) {
|
||||
const elements = html.querySelectorAll(selector);
|
||||
for (const element of elements) {
|
||||
element.classList.toggle('expanded', autoExpandRoll[key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Auto expand the item description. These are not preserved by foundry during re-renders
|
||||
const itemDesc = html.querySelector('details');
|
||||
if (itemDesc) {
|
||||
const existing = document.querySelector(`.chat-message[data-message-id="${this.id}"] details`);
|
||||
if (existing?.hasAttribute('open') ?? autoExpandRoll.desc) {
|
||||
itemDesc.setAttribute('open', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.isAuthor && !this.speakerActor?.isOwner) {
|
||||
|
|
|
|||
|
|
@ -208,10 +208,7 @@ export default class DHItem extends foundry.documents.Item {
|
|||
tags: this._getTags()
|
||||
},
|
||||
actions: item.system.actionsList,
|
||||
description: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.system.description, {
|
||||
relativeTo: this.parent,
|
||||
rollData: this.parent?.getRollData() ?? {}
|
||||
})
|
||||
description: await this.system.getEnrichedDescription()
|
||||
};
|
||||
|
||||
const msg = {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ export default class DhTokenManager {
|
|||
}
|
||||
}
|
||||
|
||||
return await canvas.tokens.placeTokens(
|
||||
const placedData = await canvas.tokens.placeTokens(
|
||||
[
|
||||
{
|
||||
...actor.prototypeToken.toObject(),
|
||||
...(await actor.getTokenDocument()).toObject(),
|
||||
actorId: actor.id,
|
||||
displayName: 50,
|
||||
...tokenData
|
||||
|
|
@ -30,6 +30,8 @@ export default class DhTokenManager {
|
|||
],
|
||||
{ create: false }
|
||||
);
|
||||
|
||||
return placedData?.[0] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -46,22 +48,24 @@ export default class DhTokenManager {
|
|||
|
||||
const createElevation = elevation ?? level.elevation.bottom;
|
||||
for (const tokenData of tokensData) {
|
||||
const previewTokens = await this.createPreview(tokenData.actor, {
|
||||
const previewToken = await this.createPreview(tokenData.actor, {
|
||||
name: tokenData.tokenPreviewName,
|
||||
level: game.user.viewedLevel,
|
||||
elevation: createElevation,
|
||||
flags: { daggerheart: { createPlacement: true } }
|
||||
});
|
||||
if (!previewTokens?.length) return null;
|
||||
if (!previewToken) return null;
|
||||
|
||||
await canvas.scene.createEmbeddedDocuments(
|
||||
'Token',
|
||||
previewTokens.map(x => ({
|
||||
...x.toObject(),
|
||||
const finalTokenData = {
|
||||
...previewToken.toObject(),
|
||||
name: tokenData.actor.prototypeToken.name,
|
||||
displayName: tokenData.actor.prototypeToken.displayName,
|
||||
flags: tokenData.actor.prototypeToken.flags
|
||||
})),
|
||||
};
|
||||
|
||||
await canvas.scene.createEmbeddedDocuments(
|
||||
'Token',
|
||||
[finalTokenData],
|
||||
{ controlObject: true, parent: canvas.scene }
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,55 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
#wide = false;
|
||||
#bordered = false;
|
||||
|
||||
/** @inheritdoc */
|
||||
async activate(element, options = {}) {
|
||||
const { TextEditor } = foundry.applications.ux;
|
||||
this.#wide = false;
|
||||
this.#bordered = false;
|
||||
|
||||
const isMacro = document.getElementById('action-bar').contains(element);
|
||||
const macro = isMacro ? game.macros.get(game.user.hotbar[Number(element.dataset.slot)] ?? null) : null;
|
||||
const macroItemUuid = macro?.type === 'script' ? macro.command.match(/await game\.system\.api\.applications\.ui\.DhHotbar\.useItem\("([^"]+)"\);/)?.[1] : null;
|
||||
if (macroItemUuid && await fromUuid(macroItemUuid, { strict: false })) {
|
||||
element.dataset.tooltip = `#item#${macroItemUuid}`;
|
||||
options.direction = this.constructor.TOOLTIP_DIRECTIONS.UP;
|
||||
}
|
||||
|
||||
let html = options.html;
|
||||
if (element.dataset.tooltip?.startsWith('#battlepoints#')) {
|
||||
const key = element.dataset.tooltip?.match(/^#([\w-]+)#/)?.[1];
|
||||
switch (key) {
|
||||
case 'battlepoints':
|
||||
return this.#activateBattlepoints(element, options);
|
||||
case 'effect-display':
|
||||
html = await this.#activateEffectDisplay(element, options);
|
||||
break;
|
||||
case 'item':
|
||||
html = await this.#activateItem(element, options);
|
||||
break;
|
||||
case 'attack':
|
||||
html = await this.#activateAttack(element, options);
|
||||
break;
|
||||
case 'shortRest':
|
||||
case 'longRest':
|
||||
html = await this.#activateRest(element, options);
|
||||
break;
|
||||
case 'advantage':
|
||||
case 'disadvantage':
|
||||
html = await this.#activateAdvantageDisadvantage(element, options);
|
||||
break;
|
||||
case 'deathMove':
|
||||
html = await this.#activateDeathMove(element, options);
|
||||
break;
|
||||
}
|
||||
|
||||
this.noOffset = options.noOffset;
|
||||
super.activate(element, { ...options, html });
|
||||
}
|
||||
|
||||
async #activateBattlepoints(element, options) {
|
||||
this.#wide = true;
|
||||
this.#bordered = true;
|
||||
|
||||
html = await this.getBattlepointHTML(element.dataset.combatId);
|
||||
const html = await this.getBattlepointHTML(element.dataset.combatId);
|
||||
options.direction = this._determineItemTooltipDirection(element);
|
||||
super.activate(element, { ...options, html: html });
|
||||
|
||||
|
|
@ -20,13 +60,9 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
lockedTooltip.querySelectorAll('.battlepoint-toggle-container input').forEach(element => {
|
||||
element.addEventListener('input', this.toggleModifier.bind(this));
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
this.#wide = false;
|
||||
this.#bordered = false;
|
||||
}
|
||||
|
||||
if (element.dataset.tooltip === '#effect-display#') {
|
||||
async #activateEffectDisplay(element, options) {
|
||||
this.#bordered = true;
|
||||
let effect = {};
|
||||
if (element.dataset.uuid) {
|
||||
|
|
@ -75,7 +111,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
};
|
||||
}
|
||||
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/effect-display.hbs`,
|
||||
{
|
||||
effect
|
||||
|
|
@ -84,11 +120,11 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
|
||||
this.tooltip.innerHTML = html;
|
||||
options.direction = this._determineItemTooltipDirection(element);
|
||||
} else {
|
||||
this.#bordered = false;
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
if (element.dataset.tooltip?.startsWith('#item#')) {
|
||||
async #activateItem(element, options) {
|
||||
const itemUuid = element.dataset.tooltip.slice(6);
|
||||
const item = await foundry.utils.fromUuid(itemUuid);
|
||||
if (item) {
|
||||
|
|
@ -97,7 +133,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
await this.enrichText(item);
|
||||
|
||||
const type = isAction ? 'action' : isEffect ? 'effect' : item.type;
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/${type}.hbs`,
|
||||
{
|
||||
item: item,
|
||||
|
|
@ -108,17 +144,20 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
options.direction = this._determineItemTooltipDirection(element);
|
||||
options.direction ??= this._determineItemTooltipDirection(element);
|
||||
return html;
|
||||
}
|
||||
} else {
|
||||
const attack = element.dataset.tooltip?.startsWith('#attack#');
|
||||
if (attack) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async #activateAttack(element, options) {
|
||||
const actorUuid = element.dataset.tooltip.slice(8);
|
||||
const actor = await foundry.utils.fromUuid(actorUuid);
|
||||
const attack = actor.system.attack;
|
||||
|
||||
const description = await TextEditor.enrichHTML(attack.description);
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
const description = await foundry.applications.ux.TextEditor.enrichHTML(attack.description);
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/attack.hbs`,
|
||||
{
|
||||
attack: attack,
|
||||
|
|
@ -129,19 +168,57 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
return html;
|
||||
}
|
||||
|
||||
const shortRest = element.dataset.tooltip?.startsWith('#shortRest#');
|
||||
const longRest = element.dataset.tooltip?.startsWith('#longRest#');
|
||||
if (shortRest || longRest) {
|
||||
const key = element.dataset.tooltip.slice(shortRest ? 11 : 10);
|
||||
async #activateAdvantageDisadvantage(element, options) {
|
||||
const isAdvantage = element.dataset.tooltip?.startsWith('#advantage#');
|
||||
const actorUuid = element.dataset.tooltip.slice(isAdvantage ? 11 : 14);
|
||||
const actor = await foundry.utils.fromUuid(actorUuid);
|
||||
|
||||
if (actor) {
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/advantage.hbs`,
|
||||
{
|
||||
sources: isAdvantage ? actor.system.advantageSources : actor.system.disadvantageSources
|
||||
}
|
||||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
return html;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async #activateDeathMove(element, options) {
|
||||
const name = element.dataset.deathName;
|
||||
const img = element.dataset.deathImg;
|
||||
const description = element.dataset.deathDescription;
|
||||
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/death-move.hbs`,
|
||||
{
|
||||
move: { name: name, img: img, description: description }
|
||||
}
|
||||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
options.direction = this._determineItemTooltipDirection(
|
||||
element,
|
||||
this.constructor.TOOLTIP_DIRECTIONS.RIGHT
|
||||
);
|
||||
return html;
|
||||
}
|
||||
|
||||
async #activateRest(element, options) {
|
||||
const isShortRest = element.dataset.tooltip?.startsWith('#shortRest#');
|
||||
const key = element.dataset.tooltip.slice(isShortRest ? 11 : 10);
|
||||
const moves = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves[
|
||||
element.dataset.restType
|
||||
].moves;
|
||||
const move = moves[key];
|
||||
const description = await TextEditor.enrichHTML(move.description);
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
const description = await foundry.applications.ux.TextEditor.enrichHTML(move.description);
|
||||
const html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/downtime.hbs`,
|
||||
{
|
||||
move: move,
|
||||
|
|
@ -154,49 +231,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
element,
|
||||
this.constructor.TOOLTIP_DIRECTIONS.RIGHT
|
||||
);
|
||||
}
|
||||
|
||||
const isAdvantage = element.dataset.tooltip?.startsWith('#advantage#');
|
||||
const isDisadvantage = element.dataset.tooltip?.startsWith('#disadvantage#');
|
||||
if (isAdvantage || isDisadvantage) {
|
||||
const actorUuid = element.dataset.tooltip.slice(isAdvantage ? 11 : 14);
|
||||
const actor = await foundry.utils.fromUuid(actorUuid);
|
||||
|
||||
if (actor) {
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/advantage.hbs`,
|
||||
{
|
||||
sources: isAdvantage ? actor.system.advantageSources : actor.system.disadvantageSources
|
||||
}
|
||||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
const deathMove = element.dataset.tooltip?.startsWith('#deathMove#');
|
||||
if (deathMove) {
|
||||
const name = element.dataset.deathName;
|
||||
const img = element.dataset.deathImg;
|
||||
const description = element.dataset.deathDescription;
|
||||
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/death-move.hbs`,
|
||||
{
|
||||
move: { name: name, img: img, description: description }
|
||||
}
|
||||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
options.direction = this._determineItemTooltipDirection(
|
||||
element,
|
||||
this.constructor.TOOLTIP_DIRECTIONS.RIGHT
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.noOffset = options.noOffset;
|
||||
super.activate(element, { ...options, html: html });
|
||||
return html;
|
||||
}
|
||||
|
||||
_setAnchor(direction) {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,8 @@ export default class RegisterHandlebarsHelpers {
|
|||
return formula;
|
||||
}
|
||||
|
||||
static damageSymbols(damageParts) {
|
||||
const allTypes = [...new Set([...damageParts].flatMap(x => Array.from(x.type)))];
|
||||
const symbols = allTypes.map(p => CONFIG.DH.GENERAL.damageTypes[p].icon);
|
||||
static damageSymbols(damageData) {
|
||||
const symbols = damageData.type.map(p => CONFIG.DH.GENERAL.damageTypes[p].icon);
|
||||
return new Handlebars.SafeString(Array.from(symbols).map(symbol => `<i class="fa-solid ${symbol}"></i>`));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -700,19 +700,6 @@ export async function RefreshFeatures(
|
|||
return refreshedActors;
|
||||
}
|
||||
|
||||
export function getUnusedDamageTypes(parts) {
|
||||
const usedKeys = Object.keys(parts);
|
||||
return Object.keys(CONFIG.DH.GENERAL.healingTypes).reduce((acc, key) => {
|
||||
if (!usedKeys.includes(key))
|
||||
acc.push({
|
||||
value: key,
|
||||
label: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[key].label)
|
||||
});
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
|
||||
/** Returns resolved armor sources ordered by application order */
|
||||
export function getArmorSources(actor) {
|
||||
const rawArmorSources = Array.from(actor.allApplicableEffects()).filter(x => x.system.armorData);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ export class Migration_2_5_2 extends MigrationHandlerBase {
|
|||
async updateActiveEffectSource(effectSource, item) {
|
||||
let shouldUpdate = false;
|
||||
const newChanges = [];
|
||||
const srdItem = item?._stats.compendiumSource ?
|
||||
|
||||
const srdItem = item?._stats?.compendiumSource ?
|
||||
await foundry.utils.fromUuid(item?._stats.compendiumSource) :
|
||||
null;
|
||||
for (let i = 0; i < effectSource.system.changes.length; i++) {
|
||||
|
|
@ -15,7 +16,7 @@ export class Migration_2_5_2 extends MigrationHandlerBase {
|
|||
const srdEffect = srdItem?.effects.find(x => x.name === effectSource.name);
|
||||
if (change.type === 'custom') {
|
||||
const srdChange = srdEffect ? srdEffect.system.changes[i] : null;
|
||||
if (
|
||||
if (srdChange &&
|
||||
change.key === srdChange.key &&
|
||||
change.value === srdChange.value &&
|
||||
change.type !== srdChange.type
|
||||
|
|
|
|||
20
module/systemRegistration/migration-handlers/2_6_0.mjs
Normal file
20
module/systemRegistration/migration-handlers/2_6_0.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationHandlerBase } from './base.mjs';
|
||||
|
||||
export class Migration_2_6_0 extends MigrationHandlerBase {
|
||||
version = '2.6.0';
|
||||
|
||||
/** @inheritdoc */
|
||||
async updateActorSource(actor) {
|
||||
if (actor.type === 'party' && Object.keys(actor.system.tagTeam.members).length) {
|
||||
return {
|
||||
_id: actor._id,
|
||||
system: {
|
||||
tagTeam: {
|
||||
initiator: null,
|
||||
members: _replace({})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
/**
|
||||
* @import DHItem from "../../documents/item.mjs";
|
||||
* @import DhActor from "../../documents/actor.mjs";
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
* The base class of an async migration.
|
||||
* These are generally run between versions for things that require compendiums or must be done in post.
|
||||
* The migrate() functions calls the various updateXSource() functions.
|
||||
|
|
@ -22,6 +23,16 @@ export class MigrationHandlerBase {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a world actor
|
||||
* @param {DhActor} actor
|
||||
* @returns {Promise<object>}
|
||||
* @protected
|
||||
*/
|
||||
async updateActorSource(actor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async migrate() {
|
||||
// todo: handle more than just migrating effects. Right now this can only migrate effects
|
||||
// NOTE: the preload is hardcoded, we should not hardcode it
|
||||
|
|
@ -60,10 +71,39 @@ export class MigrationHandlerBase {
|
|||
}
|
||||
};
|
||||
|
||||
for (const actor of game.actors) {
|
||||
const updateActor = async actor => {
|
||||
const actorUpdate = await this.updateActorSource(actor);
|
||||
if (actorUpdate) {
|
||||
batch.push({
|
||||
action: 'update',
|
||||
documentName: 'Actor',
|
||||
updates: [actorUpdate]
|
||||
});
|
||||
}
|
||||
|
||||
const aeUpdates = [];
|
||||
for (const item of actor.items) {
|
||||
await updateItem(item);
|
||||
}
|
||||
|
||||
for (const effect of actor.effects) {
|
||||
const changes = await this.updateActiveEffectSource(effect.toObject(), { parent: actor });
|
||||
if (changes) aeUpdates.push(changes);
|
||||
}
|
||||
if (aeUpdates.length) {
|
||||
batch.push({
|
||||
action: 'update',
|
||||
documentName: 'ActiveEffect',
|
||||
updates: aeUpdates,
|
||||
parent: actor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (const actor of game.actors) {
|
||||
await updateActor(actor);
|
||||
|
||||
progress.advance();
|
||||
}
|
||||
for (const item of game.items) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { defaultRestOptions } from '../config/generalConfig.mjs';
|
||||
import { Migration_2_5_2 } from './migration-handlers/2_5_2.mjs';
|
||||
import { Migration_2_6_0 } from './migration-handlers/2_6_0.mjs';
|
||||
|
||||
export async function runMigrations() {
|
||||
let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion);
|
||||
|
|
@ -329,7 +330,8 @@ export async function runMigrations() {
|
|||
/* -------------------------------------------- */
|
||||
|
||||
const migrations = [
|
||||
new Migration_2_5_2()
|
||||
new Migration_2_5_2(),
|
||||
new Migration_2_6_0()
|
||||
].filter(m => m.version && foundry.utils.isNewerVersion(m.version, lastMigrationVersion));
|
||||
|
||||
for (const handler of migrations) {
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@
|
|||
"type": "effect",
|
||||
"_id": "p6V4k4yMwJ1UPZMz",
|
||||
"systemPath": "actions",
|
||||
"description": "<p><strong>Spend a Fear</strong> to summon a @UUID[Compendium.daggerheart.adversaries.Actor.sRn4bqerfARvhgSV]{Minor Chaos Elemental} drawn to the echoes of violence and discord. They appear within Far range of a chosen PC and immediately take the spotlight.</p><section id=\"secret-iCbXJnMeqDXXOc8n\" class=\"secret\"><p><em>What color does the grass turn as the elemental appears? How does the chaos warp insects and small wildlife within the grove?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
|
|||
|
|
@ -35,12 +35,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -91,7 +88,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -117,7 +114,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -156,7 +154,7 @@
|
|||
"type": "effect",
|
||||
"_id": "6DKa1Pm605HpChPd",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>When a PC starts the ambush on unsuspecting adversaries, you lose 2 Fear and the first attack roll a PC makes has advantage.</p><section class=\"secret\" id=\"secret-WV3oLdq2IoLoSZqe\"><p><em>What are the adversaries in the middle of doing when the ambush starts? How does this impact their approach to the fight?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@
|
|||
"type": "attack",
|
||||
"_id": "r5JN5oFYL5DC6Qqw",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>When an adversary is defeated, you can <strong>spend a Fear</strong> to have a stray attack from a siege weapon hit a point on the battlefield. All targets within Very Close range of that point must make an Agility Reaction Roll.</p><ul><li><p>Targets who fail take <strong>3d8+3</strong> physical or magic damage and must mark a Stress.</p></li><li><p>Targets who succeed must mark a Stress.</p></li></ul><section id=\"secret-qe1DM7HUSefRAplk\" class=\"secret\"><p><em>What debris is scattered by the attack? What is broken by the strike that can’t be easily mended?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
|
|||
|
|
@ -45,12 +45,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -101,7 +98,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -127,7 +124,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -204,7 +202,7 @@
|
|||
"type": "damage",
|
||||
"_id": "p1UiGEiGyl6r7PrA",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>Previous climbers left behind large metal rods that climbers can use to aid their ascent. If a PC using the pitons fails an action roll to climb, they can <strong>mark a Stress</strong> instead of ticking the countdown up.</p><section class=\"secret\" id=\"secret-fWHkzBQAxCLDmV6H\"><p><em>What do the shape and material of these pitons tell you about the previous climbers? How far apart are they from one another?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
@ -435,7 +433,7 @@
|
|||
"type": "effect",
|
||||
"_id": "M8MfD2qBfYCwNKvH",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>Spend a Fear to have a PC’s handhold fail, plummeting them toward the ground. If they aren’t saved on the next action, they hit the ground and tick up the countdown by 2. The PC takes <strong>1d12</strong> physical damage if the countdown is between 8 and 12, <strong>2d12</strong> between 4 and 7, and <strong>3d12</strong> at 3 or lower.</p><section class=\"secret\" id=\"secret-ufZ6ifPWxU4MkKow\"><p><em>How can you tell many others have fallen here before? What lives in these walls that might try to scare adventurers into falling for an easy meal?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [
|
||||
|
|
|
|||
|
|
@ -45,12 +45,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -101,7 +98,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -127,7 +124,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -236,7 +234,7 @@
|
|||
"type": "effect",
|
||||
"_id": "EATw4ZkcuGeDfgLZ",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>A portion of the ritual’s power is diverted into a cult member to fight off interlopers. Choose one adversary to become Imbued with terrible magic until the scene ends or they’re defeated. An Imbued adversary immediately takes the spotlight and gains one of the following benefits, or all three if you <strong>spend a Fear</strong>:</p><ul><li><p>They gain advantage on all attacks.</p></li><li><p>They deal an extra <strong>1d10</strong> damage on a successful attack.</p></li><li><p>They gain the following feature: <strong>Relentless (2) - Passive</strong>. This adversary can be spotlighted up to two times per GM turn. Spend Fear as usual to spotlight them.</p></li></ul><section class=\"secret\" id=\"secret-5wFIFufzFAPrIDaq\"><p><em>How does the enemy change in appearance? What fears do their blows bring to the surface?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
@ -283,13 +281,10 @@
|
|||
},
|
||||
"disabled": false,
|
||||
"duration": {
|
||||
"startTime": null,
|
||||
"combat": null,
|
||||
"seconds": null,
|
||||
"rounds": null,
|
||||
"turns": null,
|
||||
"startRound": null,
|
||||
"startTurn": null
|
||||
"value": null,
|
||||
"units": "seconds",
|
||||
"expiry": null,
|
||||
"expired": false
|
||||
},
|
||||
"description": "<p>An Imbued adversary immediately takes the spotlight and gains one of the following benefits, or all three if you <strong>spend a Fear</strong>:</p><ul><li><p>They gain advantage on all attacks.</p></li><li><p>They deal an extra <strong>1d10</strong> damage on a successful attack.</p></li><li><p>They gain the following feature: <strong>Relentless (2) - Passive</strong>. This adversary can be spotlighted up to two times per GM turn. Spend Fear as usual to spotlight them.</p></li></ul><section class=\"secret\" id=\"secret-YOHA68Na64uXDAxu\"><p><em>How does the enemy change in appearance? What fears do their blows bring to the surface?</em></p></section>",
|
||||
"tint": "#ffffff",
|
||||
|
|
@ -299,6 +294,9 @@
|
|||
"_stats": {
|
||||
"compendiumSource": null
|
||||
},
|
||||
"start": null,
|
||||
"showIcon": 1,
|
||||
"folder": null,
|
||||
"_key": "!actors.items.effects!QAXXiOKBDmCTauHD.0Rgqw1kUPeJ11ldd.dYQBQq1xIysM0qLo"
|
||||
},
|
||||
{
|
||||
|
|
@ -326,13 +324,10 @@
|
|||
},
|
||||
"disabled": true,
|
||||
"duration": {
|
||||
"startTime": null,
|
||||
"combat": null,
|
||||
"seconds": null,
|
||||
"rounds": null,
|
||||
"turns": null,
|
||||
"startRound": null,
|
||||
"startTurn": null
|
||||
"value": null,
|
||||
"units": "seconds",
|
||||
"expiry": null,
|
||||
"expired": false
|
||||
},
|
||||
"description": "",
|
||||
"tint": "#ffffff",
|
||||
|
|
@ -342,6 +337,9 @@
|
|||
"_stats": {
|
||||
"compendiumSource": null
|
||||
},
|
||||
"start": null,
|
||||
"showIcon": 1,
|
||||
"folder": null,
|
||||
"_key": "!actors.items.effects!QAXXiOKBDmCTauHD.0Rgqw1kUPeJ11ldd.Hxw5lXE77bGzuaOu"
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -44,12 +44,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -100,7 +97,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -126,7 +123,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -140,7 +138,7 @@
|
|||
"type": "healing",
|
||||
"_id": "uLCoTKa7Jn2HaRqR",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>A PC who takes a rest in the Hallowed Temple automatically clears all HP.</p><section class=\"secret\" id=\"secret-vN4UFTYIQW8nd2mC\"><p><em>What does the incense smell like? What kinds of songs do the acolytes sing?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
@ -337,7 +335,7 @@
|
|||
"type": "effect",
|
||||
"_id": "pJVipg7CbA9CB0Um",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>When the PCs have trespassed, blasphemed, or offended the clergy, you can <strong>spend a Fear</strong> to summon a @UUID[Compendium.daggerheart.adversaries.Actor.r1mbfSSwKWdcFdAU]{High Seraph} and [[/r 1d4]] @UUID[Compendium.daggerheart.adversaries.Actor.B4LZcGuBAHzyVdzy]{Bladed Guard} within Close range of the senior priest to reinforce their will.</p><section class=\"secret\" id=\"secret-tG902NbtYpyK0NFi\"><p><em>What symbols or icons do they bear that signal they are anointed agents of the divinity? Who leads the group and what led them to this calling?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [
|
||||
|
|
|
|||
|
|
@ -44,12 +44,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -100,7 +97,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -126,7 +123,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -282,7 +280,7 @@
|
|||
"type": "countdown",
|
||||
"_id": "VhqZKDA4032i8zY3",
|
||||
"systemPath": "actions",
|
||||
"description": "<p><strong>Spend a Fear</strong> to manifest the echo of a past disaster that ravaged the city. Activate a <em>Progress Countdown (5)</em> as the disaster replays around the PCs. To complete the countdown and escape the catastrophe, the PCs must overcome threats such as rampaging fires, stampeding civilians, collapsing buildings, or crumbling streets, while recalling history and finding clues to escape the inevitable.</p><section class=\"secret\" id=\"secret-2Ou4kbqfCwCgsG5X\"><p><em>Is this the disaster that led the city to be abandoned? What is known about this disaster and how could that help the PCs escape?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"originItem": {
|
||||
"type": "itemCollection"
|
||||
|
|
|
|||
|
|
@ -46,12 +46,9 @@
|
|||
"src": "systems/daggerheart/assets/icons/documents/actors/forest.svg",
|
||||
"anchorX": 0.5,
|
||||
"anchorY": 0.5,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"fit": "contain",
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"rotation": 0,
|
||||
"tint": "#ffffff",
|
||||
"alphaThreshold": 0.75
|
||||
},
|
||||
|
|
@ -102,7 +99,7 @@
|
|||
"saturation": 0,
|
||||
"contrast": 0
|
||||
},
|
||||
"detectionModes": [],
|
||||
"detectionModes": {},
|
||||
"occludable": {
|
||||
"radius": 0
|
||||
},
|
||||
|
|
@ -128,7 +125,8 @@
|
|||
"flags": {},
|
||||
"randomImg": false,
|
||||
"appendNumber": false,
|
||||
"prependAdjective": false
|
||||
"prependAdjective": false,
|
||||
"depth": 1
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -297,7 +295,7 @@
|
|||
"type": "attack",
|
||||
"_id": "9ipckCFMz9DVw8ab",
|
||||
"systemPath": "actions",
|
||||
"description": "<p><strong>Spend a Fear</strong> to tick down a long-term countdown related to the empire’s agenda by [[/r 1d4]]. If this triggers the countdown, a proclamation related to the agenda is announced at court as the plan is executed.</p><section class=\"secret\" id=\"secret-ThoGDjazxfPoUvJS\"><p><em>What display of power or transfer of wealth was needed to expedite this plan? Whose lives were disrupted or upended to make this happen?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
"type": "damage",
|
||||
"_id": "jVY198vniaTSlgsX",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>A feature or action that clears HP requires spending a Hope to use. If it already costs Hope, a PC must spend an additional Hope.</p><section class=\"secret\" id=\"secret-Ls4rMO6N9zzuR2Ib\"><p><em>What does it feel like to try to heal in a place so antithetical to life?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
"type": "attack",
|
||||
"_id": "M1mOwi4Limw2hRwL",
|
||||
"systemPath": "actions",
|
||||
"description": "<p>All targets within Close range of a point you choose in this environment must succeed on an Agility Reaction Roll or take <strong>4d8+8</strong> physical damage from skeletal shrapnel as part of the ossuary detonates around them.</p><section id=\"secret-xjKFOtdFFWAgx2Cv\" class=\"secret\"><p><em>What ancient skeletal architecture is destroyed? What bones stick in your armor?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [],
|
||||
|
|
@ -421,7 +421,7 @@
|
|||
"type": "effect",
|
||||
"_id": "hFeTdiHWeCYkb8Hg",
|
||||
"systemPath": "actions",
|
||||
"description": "<p><strong>Spend a Fear</strong> to summon [[/r 1d6]] @UUID[Compendium.daggerheart.adversaries.Actor.gP3fWTLzSFnpA8EJ]{Rotted Zombie}, two @UUID[Compendium.daggerheart.adversaries.Actor.CP6iRfHdyFWniTHY]{Perfected Zombie}, or a @UUID[Compendium.daggerheart.adversaries.Actor.YhJrP7rTBiRdX5Fp]{Zombie Legion}, who appear at Close range of a chosen PC.</p><section class=\"secret\" id=\"secret-Du2785Ih29RVrHpG\"><p><em>Who were these people before they became the necromancer’s pawns? What vestiges of those lives remain for the heroes to see?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@
|
|||
"type": "attack",
|
||||
"_id": "1giAFbu3tGqXwi8g",
|
||||
"systemPath": "actions",
|
||||
"description": "<p><strong>Spend a Fear</strong> as a mage from one side uses large-scale destructive magic. Pick a point on the battlefield within Very Far range of the mage. All targets within Close range of that point must make an Agility Reaction Roll. Targets who fail take <strong>3d12+8</strong> magic damage and must mark a Stress.</p><section id=\"secret-jbI9lwrzP59CTRUt\" class=\"secret\"><p><em>What form does the attack take—fireball raining acid a storm of blades? What tactical objective is this attack meant to accomplish and what comes next?</em></p></section>",
|
||||
"description": "",
|
||||
"chatDisplay": true,
|
||||
"actionType": "action",
|
||||
"cost": [
|
||||
|
|
|
|||
|
|
@ -17,6 +17,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
font-size: var(--font-size-20);
|
||||
color: light-dark(@dark, @beige);
|
||||
text-align: center;
|
||||
margin-bottom: -12px;
|
||||
}
|
||||
|
||||
.bonuses {
|
||||
gap: 4px;
|
||||
.critical-chip {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
.chat-log .chat-message {
|
||||
background-image: url('../assets/parchments/dh-parchment-light.png');
|
||||
|
||||
.message-header .message-header-metadata .message-metadata,
|
||||
.message-header .message-header-main .message-sub-header-container {
|
||||
.message-header .message-header-main .message-metadata,
|
||||
.message-header .message-header-main .name {
|
||||
color: @dark;
|
||||
}
|
||||
|
||||
.message-header .message-header-main .message-sub-header-container h4 {
|
||||
.message-header .message-header-main h4 {
|
||||
color: @dark-blue;
|
||||
}
|
||||
|
||||
|
|
@ -42,27 +42,12 @@
|
|||
|
||||
.message-header {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 8px;
|
||||
|
||||
.message-header-metadata {
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.message-metadata {
|
||||
font-family: @font-body;
|
||||
color: @beige;
|
||||
}
|
||||
}
|
||||
|
||||
.message-header-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
padding: 8px;
|
||||
align-items: center;
|
||||
|
||||
.portrait {
|
||||
flex: 0 0 auto;
|
||||
.actor-img {
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
|
|
@ -70,13 +55,20 @@
|
|||
object-fit: cover;
|
||||
object-position: top center;
|
||||
}
|
||||
}
|
||||
|
||||
.message-sub-header-container {
|
||||
flex: 1;
|
||||
.message-header-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: @beige;
|
||||
align-items: center;
|
||||
column-gap: 4px;
|
||||
row-gap: 2px;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
display: grid;
|
||||
grid-template:
|
||||
"title metadata"
|
||||
"subtitle subtitle";
|
||||
|
||||
h4 {
|
||||
font-size: var(--font-size-16);
|
||||
|
|
@ -84,6 +76,39 @@
|
|||
margin-bottom: 0;
|
||||
font-family: @font-subtitle;
|
||||
color: @golden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.message-metadata {
|
||||
font-family: @font-body;
|
||||
color: @beige;
|
||||
white-space: nowrap;
|
||||
align-items: baseline;
|
||||
.message-timestamp {
|
||||
font-size: var(--font-size-11);
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
grid-area: subtitle;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: @beige;
|
||||
gap: 4px;
|
||||
align-items: baseline;
|
||||
line-height: 1;
|
||||
.name {
|
||||
flex: 1;
|
||||
}
|
||||
.whisper-to {
|
||||
color: @color-text-subtle;
|
||||
flex: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,7 +595,86 @@
|
|||
margin-top: 4px;
|
||||
color: light-dark(#14142599, #efe6d850);
|
||||
font-size: var(--font-size-12);
|
||||
padding-left: 3px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
section.gm-notes-section {
|
||||
padding-bottom: var(--spacer-4);
|
||||
header.gm-notes + p {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
header.gm-notes {
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
&::before,
|
||||
&::after {
|
||||
content: " ";
|
||||
flex: 1;
|
||||
border-bottom: 1px solid var(--color-dark-6);
|
||||
}
|
||||
&::before {
|
||||
mask-image: linear-gradient(270deg, black 0%, black calc(100% - 10px), transparent 100%);
|
||||
}
|
||||
&::after {
|
||||
mask-image: linear-gradient(270deg, transparent 0%, black 10px, black 100%);
|
||||
}
|
||||
margin-top: var(--spacer-8);
|
||||
margin-bottom: var(--spacer-4);
|
||||
font-size: var(--font-size-11);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
secret-block {
|
||||
display: block;
|
||||
|
||||
/** A buffer to make the hover behavior work a bit better. The bottom in the button needs to compensate */
|
||||
@buffer: 8px;
|
||||
margin-top: -@buffer;
|
||||
padding-top: @buffer;
|
||||
|
||||
button.reveal {
|
||||
--button-size: 1rem;
|
||||
height: var(--button-size);
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: min-content;
|
||||
padding: 1px 8px 0 8px;
|
||||
bottom: calc(100% - 0.4375rem - 1px);
|
||||
|
||||
background-color: var(--dh-window-button-color-bg); // todo: find a better var name
|
||||
border-color: var(--color-secret-border);
|
||||
color: var(--dh-window-button-color-text);
|
||||
font-size: var(--font-size-10);
|
||||
user-select: none;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
&:hover button.reveal {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The element inside a secret-block.
|
||||
* This is separate since during prosemirror editing, the secret-block container does not exist.
|
||||
*/
|
||||
section.secret {
|
||||
--color-secret-bg: @red-10;
|
||||
--color-revealed-bg: @green-10;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -817,4 +896,8 @@
|
|||
right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.gm-notes {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
.sheet.daggerheart.dh-style.item {
|
||||
.tab.features {
|
||||
padding: 0 10px;
|
||||
padding: 7px 10px;
|
||||
overflow-y: auto;
|
||||
.feature-list {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -111,3 +111,7 @@ body.theme-light,
|
|||
.themed.theme-light {
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
body:not([data-gm=true]) [data-visibility="gm"] {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -163,37 +163,7 @@
|
|||
}
|
||||
.inventory-description {
|
||||
overflow: hidden;
|
||||
|
||||
h1 {
|
||||
font-size: var(--font-size-32);
|
||||
}
|
||||
h2 {
|
||||
font-size: var(--font-size-28);
|
||||
font-weight: 600;
|
||||
}
|
||||
h3 {
|
||||
font-size: var(--font-size-20);
|
||||
font-weight: 600;
|
||||
}
|
||||
h4 {
|
||||
font-size: var(--font-size-16);
|
||||
color: @beige;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin: 1rem 0;
|
||||
padding: 0 0 0 1.25rem;
|
||||
|
||||
li {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: disc;
|
||||
}
|
||||
.typography();
|
||||
}
|
||||
}
|
||||
.item-resources {
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@
|
|||
});
|
||||
|
||||
.application.sheet.daggerheart.dh-style {
|
||||
--portrait-size: 150px;
|
||||
|
||||
.item-sheet-header {
|
||||
display: flex;
|
||||
|
||||
.profile {
|
||||
height: 150px;
|
||||
width: 150px;
|
||||
height: var(--portrait-size);
|
||||
width: var(--portrait-size);
|
||||
object-fit: cover;
|
||||
border-right: 1px solid light-dark(@dark-blue, @golden);
|
||||
border-bottom: 1px solid light-dark(@dark-blue, @golden);
|
||||
|
|
@ -34,14 +36,18 @@
|
|||
text-align: center;
|
||||
width: 80%;
|
||||
|
||||
.item-name input[type='text'] {
|
||||
font-size: var(--font-size-32);
|
||||
height: 42px;
|
||||
.item-name {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 10px 10px 0 10px;
|
||||
input[type='text'] {
|
||||
font-size: var(--font-size-30);
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
width: 100%;
|
||||
transition: all 0.3s ease;
|
||||
outline: 2px solid transparent;
|
||||
border: 1px solid transparent;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&:hover[type='text'],
|
||||
&:focus[type='text'] {
|
||||
|
|
@ -49,6 +55,7 @@
|
|||
outline: 2px solid light-dark(@dark-blue, @golden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-description {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -14,36 +14,7 @@
|
|||
}
|
||||
.editor-content {
|
||||
.with-scroll-shadows();
|
||||
h1 {
|
||||
font-size: var(--font-size-32);
|
||||
}
|
||||
h2 {
|
||||
font-size: var(--font-size-28);
|
||||
font-weight: 600;
|
||||
}
|
||||
h3 {
|
||||
font-size: var(--font-size-20);
|
||||
font-weight: 600;
|
||||
}
|
||||
h4 {
|
||||
font-size: var(--font-size-16);
|
||||
color: light-dark(@dark, @beige);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin: 1rem 0;
|
||||
padding: 0 0 0 1.25rem;
|
||||
|
||||
li {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: disc;
|
||||
}
|
||||
.typography();
|
||||
}
|
||||
// Fixes centering and makes it not render over scrollbar
|
||||
&:hover button.toggle:enabled {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ body.game:is(.performance-low, .noblur) {
|
|||
}
|
||||
|
||||
button {
|
||||
background: light-dark(#e8e6e3, @deep-black);
|
||||
color: light-dark(@dark-blue, @beige);
|
||||
background: var(--dh-window-button-color-bg);
|
||||
color: var(--dh-window-button-color-text);
|
||||
border: 1px solid light-dark(@dark-blue, transparent);
|
||||
padding: 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,80 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow-y: hidden !important;
|
||||
padding-top: 10px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
prose-mirror.active + .artist-attribution {
|
||||
.description-section {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
padding: 12px 16px 4px 16px;
|
||||
.with-scroll-shadows();
|
||||
prose-mirror {
|
||||
button.toggle {
|
||||
top: 0px;
|
||||
right: 0;
|
||||
}
|
||||
button[data-action=editGMNote] {
|
||||
right: calc(var(--button-size) + 4px);
|
||||
}
|
||||
&.inactive {
|
||||
height: unset!important;
|
||||
overflow: unset;
|
||||
.editor-content {
|
||||
position: relative;
|
||||
overflow: unset;
|
||||
|
||||
// Allows content links to peek out
|
||||
margin-top: -4px;
|
||||
padding: 4px 0 0 0;
|
||||
}
|
||||
}
|
||||
&.active {
|
||||
--min-height: 250px;
|
||||
padding: 8px 0 0 16px;
|
||||
button[data-action=editGMNote] {
|
||||
display: none;
|
||||
}
|
||||
.editor-content {
|
||||
padding-right: 16px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Hide editors that are empty when inactive if we need them to be */
|
||||
prose-mirror.inactive.hide-if-inactive {
|
||||
display: none;
|
||||
}
|
||||
&:has(prose-mirror.active) {
|
||||
padding: 0;
|
||||
}
|
||||
/** Description should fill available room (with overriden exceptions) */
|
||||
prose-mirror[name="system.description"] {
|
||||
flex: 1 0;
|
||||
}
|
||||
&:has(prose-mirror[name="system.gmNotes"]:not(.hide-if-inactive)) {
|
||||
prose-mirror.inactive {
|
||||
--min-height: 3rem;
|
||||
&[name="system.description"] {
|
||||
flex: 0 0;
|
||||
}
|
||||
&[name="system.gmNotes"] {
|
||||
flex: 1 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Hide other elements if an editor is open */
|
||||
&:has(prose-mirror.active) {
|
||||
prose-mirror.inactive,
|
||||
header.gm-notes,
|
||||
.artist-attribution {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,10 +93,6 @@
|
|||
padding: 8px 0 0 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.artist-attribution {
|
||||
padding-left: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.search-section {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
.application.sheet.daggerheart.dh-style.beastform {
|
||||
--portrait-size: 130px;
|
||||
|
||||
.settings.tab {
|
||||
.advantage-on-section {
|
||||
display: flex;
|
||||
|
|
@ -9,4 +11,11 @@
|
|||
font-style: italic;
|
||||
}
|
||||
}
|
||||
.tab.features.active {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 8px calc(12px - var(--scrollbar-width)) 4px 12px;
|
||||
.stable-scroll-container();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,9 @@
|
|||
@import '../../utils/fonts.less';
|
||||
|
||||
.application.sheet.daggerheart.dh-style.feature {
|
||||
.item-sheet-header {
|
||||
display: flex;
|
||||
|
||||
.profile {
|
||||
height: 130px;
|
||||
width: 130px;
|
||||
}
|
||||
}
|
||||
--portrait-size: 130px;
|
||||
|
||||
section.tab {
|
||||
height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@import './item-sheet-shared.less';
|
||||
@import './beastform.less';
|
||||
@import './class.less';
|
||||
@import './domain-card.less';
|
||||
@import './feature.less';
|
||||
@import './heritage.less';
|
||||
@import './item-sheet-shared.less';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
.application.sheet.daggerheart.dh-style.item {
|
||||
.item.daggerheart.dh-style:where(.application.sheet) {
|
||||
&.minimized {
|
||||
.attribution-header-label {
|
||||
display: none;
|
||||
|
|
@ -14,4 +14,22 @@
|
|||
button.plain.inline-control {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.tab-navigation {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/** Default tab stylings */
|
||||
.tab.active {
|
||||
padding-top: 8px;
|
||||
.with-scroll-shadows();
|
||||
|
||||
&.effects {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 8px calc(12px - var(--scrollbar-width)) 4px 12px;
|
||||
.stable-scroll-container();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,9 @@
|
|||
}
|
||||
|
||||
.description {
|
||||
padding: 8px;
|
||||
padding: 0;
|
||||
margin: 8px;
|
||||
.typography();
|
||||
}
|
||||
|
||||
.ability-card-footer {
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@
|
|||
--dh-input-color-text: @dark;
|
||||
--dh-trait-color-bg: #b1afb6;
|
||||
--dh-trait-color-border: #8e8d96;
|
||||
--dh-window-button-color-bg: #e8e6e3;
|
||||
--dh-window-button-color-text: @dark-blue;
|
||||
}
|
||||
}
|
||||
@scope (.theme-dark) to (.themed) {
|
||||
|
|
@ -124,6 +126,8 @@
|
|||
--dh-input-color-text: @beige;
|
||||
--dh-trait-color-bg: #50433F;
|
||||
--dh-trait-color-border: #927952;
|
||||
--dh-window-button-color-bg: @deep-black;
|
||||
--dh-window-button-color-text: @beige;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,3 +204,37 @@
|
|||
scrollbar-gutter: stable;
|
||||
.with-scroll-shadows();
|
||||
}
|
||||
|
||||
/** Typography stylings for most longform text, usually item descriptions */
|
||||
.typography() {
|
||||
h1 {
|
||||
font-size: var(--font-size-32);
|
||||
}
|
||||
h2 {
|
||||
font-size: var(--font-size-28);
|
||||
font-weight: 600;
|
||||
}
|
||||
h3 {
|
||||
font-size: var(--font-size-20);
|
||||
font-weight: 600;
|
||||
}
|
||||
h4 {
|
||||
font-size: var(--font-size-16);
|
||||
color: light-dark(@dark, @beige);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin: 0.5rem 0;
|
||||
padding: 0 0 0 1.25rem;
|
||||
|
||||
li {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: disc;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
system.json
24
system.json
|
|
@ -2,7 +2,7 @@
|
|||
"id": "daggerheart",
|
||||
"title": "Daggerheart",
|
||||
"description": "An unofficial implementation of the Daggerheart system",
|
||||
"version": "2.5.2",
|
||||
"version": "2.5.4",
|
||||
"compatibility": {
|
||||
"minimum": "14.364",
|
||||
"verified": "14.364",
|
||||
|
|
@ -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.5.2/system.zip",
|
||||
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.5.4/system.zip",
|
||||
"authors": [
|
||||
{
|
||||
"name": "WBHarry"
|
||||
|
|
@ -256,34 +256,34 @@
|
|||
},
|
||||
"Item": {
|
||||
"ancestry": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"community": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"class": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"subclass": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"feature": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"domainCard": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"loot": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"consumable": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"weapon": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"armor": {
|
||||
"htmlFields": ["description"]
|
||||
"htmlFields": ["description", "gmNotes"]
|
||||
},
|
||||
"beastform": {}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
{{/if}}
|
||||
<div class="nest-inputs">
|
||||
{{formField ../fields.scalable label="DAGGERHEART.GENERAL.scalable" value=cost.scalable name=(concat "cost." index ".scalable") classes="checkbox" localize=true}}
|
||||
{{formField ../fields.key choices=(@root.disableOption index @root.costOptions ../source) label="DAGGERHEART.GENERAL.resource" value=cost.key name=(concat "cost." index ".key") localize=true blank=false}}
|
||||
{{formField ../fields.key choices=(@root.disableOption index @root.costOptions ../source) label="DAGGERHEART.GENERAL.Resource.single" value=cost.key name=(concat "cost." index ".key") localize=true blank=false}}
|
||||
{{formField ../fields.value label="DAGGERHEART.GENERAL.amount" value=cost.value name=(concat "cost." index ".value") localize=true}}
|
||||
{{formField ../fields.step label="DAGGERHEART.GENERAL.step" value=cost.step name=(concat "cost." index ".step") disabled=(not cost.scalable) localize=true}}
|
||||
<a class="btn" data-tooltip="{{localize "CONTROLS.CommonDelete"}}" data-action="removeElement" data-index="{{index}}"><i class="fas fa-trash"></i></a>
|
||||
|
|
|
|||
|
|
@ -1,92 +1,114 @@
|
|||
{{#unless (eq @root.source.type 'healing')}}
|
||||
<fieldset class="one-column">
|
||||
<legend class="with-icon">
|
||||
{{localize "DAGGERHEART.GENERAL.damage"}}
|
||||
{{#if source.main}}
|
||||
<a data-action="removeDamage"><i class="fa-solid fa-trash icon-button"></i></a>
|
||||
{{else}}
|
||||
<a data-action="addDamage"><i class="fa-solid fa-plus icon-button"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
|
||||
{{#if source.main}}
|
||||
<div class="nest-inputs">
|
||||
{{#if @root.hasBaseDamage}}
|
||||
{{formField @root.fields.damage.fields.main.fields.includeBase value=source.main.includeBase name="damage.main.includeBase" classes="checkbox" localize=true }}
|
||||
{{/if}}
|
||||
{{#unless (eq @root.source.type 'healing')}}
|
||||
{{formField baseFields.main.fields.direct value=source.main.direct name=(concat path "damage.main.direct") localize=true classes="checkbox"}}
|
||||
{{/unless}}
|
||||
{{#if (and @root.isNPC (not (eq path 'system.attack.')))}}
|
||||
{{formField baseFields.main.fields.groupAttack value=source.main.groupAttack name=(concat path "damage.main.groupAttack") localize=true classes="select"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{> damageData damage=source.main fields=fields.main.fields basePath=(concat path "damage.main")}}
|
||||
{{#if horde}}
|
||||
{{> hordeDamage source=source.main fields=fields.main.fields basePath=(concat path "damage.main")}}
|
||||
{{/if}}
|
||||
{{#if (ne @root.source.type 'healing')}}
|
||||
{{formField fields.main.fields.type value=source.main.type name=(concat path "damage.main.type") localize=true}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</fieldset>
|
||||
{{/unless}}
|
||||
|
||||
{{#unless (eq path 'system.attack.')}}
|
||||
{{! In the future, consider allowing this even on NPCs}}
|
||||
<fieldset class="one-column">
|
||||
<legend class="with-icon">
|
||||
{{#if (eq @root.source.type 'healing')}}
|
||||
{{localize "DAGGERHEART.GENERAL.healing"}}
|
||||
{{else}}
|
||||
{{localize "DAGGERHEART.GENERAL.damage"}}
|
||||
{{localize "DAGGERHEART.ACTIONS.Config.damage.markResources"}}
|
||||
{{/if}}
|
||||
{{#unless (eq path 'system.attack.')}}<a data-action="addDamage" {{#if @root.allDamageTypesUsed}}disabled{{/if}}><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}}
|
||||
{{#unless @root.allDamageTypesUsed}}<a data-action="addDamageResource"><i class="fa-solid fa-plus icon-button"></i></a>{{/unless}}
|
||||
</legend>
|
||||
{{#each source.resources as |dmg key|}}
|
||||
<div class="nest-inputs">
|
||||
{{#if @root.hasBaseDamage}}
|
||||
{{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase name="damage.includeBase" classes="checkbox" localize=true }}
|
||||
{{/if}}
|
||||
{{#unless (eq @root.source.type 'healing')}}
|
||||
{{formField baseFields.direct value=source.direct name=(concat path "damage.direct") localize=true classes="checkbox"}}
|
||||
{{/unless}}
|
||||
{{#if (and @root.isNPC (not (eq path 'system.attack.')))}}
|
||||
{{formField baseFields.groupAttack value=source.groupAttack name=(concat path "damage.groupAttack") localize=true classes="select"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}}
|
||||
{{#each source.parts as |dmg key|}}
|
||||
<div class="nest-inputs">
|
||||
<fieldset{{#if dmg.base}} disabled{{/if}} class="one-column{{#if ../path}} no-style{{/if}}">
|
||||
<fieldset{{#if dmg.base}} disabled{{/if}} class="one-column">
|
||||
<legend class="with-icon">
|
||||
{{localize (concat "DAGGERHEART.CONFIG.HealingType." dmg.applyTo ".name")}}
|
||||
{{#unless (or dmg.base ../path)}}
|
||||
<a data-action="removeDamage" data-key="{{dmg.applyTo}}"><i class="fas fa-trash"></i></a>
|
||||
<a data-action="removeDamageResource" data-key="{{key}}"><i class="fas fa-trash"></i></a>
|
||||
{{/unless}}
|
||||
</legend>
|
||||
|
||||
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
|
||||
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
|
||||
{{/if}}
|
||||
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
|
||||
<div class="nest-inputs">
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
|
||||
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
|
||||
</fieldset>
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
|
||||
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}}
|
||||
</fieldset>
|
||||
</div>
|
||||
{{else}}
|
||||
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
|
||||
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}}
|
||||
{{/if}}
|
||||
|
||||
{{#if ../horde}}
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
|
||||
<div class="nest-inputs">
|
||||
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
|
||||
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
|
||||
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
|
||||
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
|
||||
</div>
|
||||
</fieldset>
|
||||
{{/if}}
|
||||
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
|
||||
{{> damageData damage=dmg fields=../fields.resources.element.fields basePath=(concat ../path "damage.resources." dmg.applyTo)}}
|
||||
</fieldset>
|
||||
</div>
|
||||
{{/each}}
|
||||
</fieldset>
|
||||
{{/unless}}
|
||||
|
||||
{{#*inline "formula"}}
|
||||
{{#unless dmg.base}}
|
||||
{{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat path "damage.parts." key "." target ".custom.enabled") classes="checkbox" localize=true}}
|
||||
{{#unless isBase}}
|
||||
{{formField fields.custom.fields.enabled value=source.custom.enabled name=(concat basePath ".custom.enabled") classes="checkbox" localize=true}}
|
||||
{{/unless}}
|
||||
{{#if source.custom.enabled}}
|
||||
{{formField fields.custom.fields.formula value=source.custom.formula name=(concat path "damage.parts." key "." target ".custom.formula") localize=true}}
|
||||
{{formField fields.custom.fields.formula value=source.custom.formula name=(concat basePath ".custom.formula") localize=true}}
|
||||
{{else}}
|
||||
<div class="nest-inputs">
|
||||
{{#unless @root.isNPC}}
|
||||
{{formField fields.multiplier value=source.multiplier name=(concat path "damage.parts." key "." target ".multiplier") localize=true}}
|
||||
{{formField fields.multiplier value=source.multiplier name=(concat basePath ".multiplier") localize=true}}
|
||||
{{/unless}}
|
||||
{{#if (eq source.multiplier 'flat')}}{{formField fields.flatMultiplier value=source.flatMultiplier name=(concat path "damage.parts." key "." target ".flatMultiplier") localize=true }}{{/if}}
|
||||
{{formField fields.dice value=source.dice name=(concat path "damage.parts." key "." target ".dice") localize=true}}
|
||||
{{formField fields.bonus value=source.bonus name=(concat path "damage.parts." key "." target ".bonus") localize=true}}
|
||||
{{#if (eq source.multiplier 'flat')}}{{formField fields.flatMultiplier value=source.flatMultiplier name=(concat basePath ".flatMultiplier") localize=true }}{{/if}}
|
||||
{{formField fields.dice value=source.dice name=(concat basePath ".dice") localize=true}}
|
||||
{{formField fields.bonus value=source.bonus name=(concat basePath ".bonus") localize=true}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if @root.isNPC}}
|
||||
<input type="hidden" name="{{path}}damage.parts.{{key}}.{{target}}.multiplier" value="flat">
|
||||
<input type="hidden" name="{{basePath}}.{{target}}.multiplier" value="flat">
|
||||
{{/if}}
|
||||
{{/inline}}
|
||||
|
||||
{{#*inline "damageData"}}
|
||||
{{#if (and (not @root.isNPC) @root.hasRoll (not damage.base))}}
|
||||
{{formField fields.resultBased value=damage.resultBased name=(concat basePath ".resultBased") localize=true classes="checkbox"}}
|
||||
{{/if}}
|
||||
{{#if (and (not @root.isNPC) @root.hasRoll (not damage.base) damage.resultBased)}}
|
||||
<div class="nest-inputs">
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
|
||||
{{> formula key=damage.applyTo fields=fields.value.fields type=fields.type isBase=damage.base source=damage.value basePath=(concat basePath ".value")}}
|
||||
</fieldset>
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
|
||||
{{> formula key=damage.applyTo fields=fields.valueAlt.fields type=fields.type isBase=damage.base source=damage.valueAlt basePath=(concat basePath ".valueAlt")}}
|
||||
</fieldset>
|
||||
</div>
|
||||
{{else}}
|
||||
{{> formula key=damage.applyTo fields=fields.value.fields type=fields.type isBase=damage.base source=damage.value basePath=(concat basePath ".value")}}
|
||||
{{/if}}
|
||||
<input type="hidden" name="{{concat basePath ".base"}}" value="{{damage.base}}">
|
||||
{{/inline}}
|
||||
|
||||
{{#*inline "hordeDamage"}}
|
||||
<fieldset class="one-column">
|
||||
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
|
||||
<div class="nest-inputs">
|
||||
<input type="hidden" name="{{basePath}}.valueAlt.multiplier" value="flat">
|
||||
{{formField fields.valueAlt.fields.flatMultiplier value=source.valueAlt.flatMultiplier name=(concat basePath ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
|
||||
{{formField fields.valueAlt.fields.dice value=source.valueAlt.dice name=(concat basePath ".valueAlt.dice") classes="inline-child" localize=true}}
|
||||
{{formField fields.valueAlt.fields.bonus value=source.valueAlt.bonus name=(concat basePath ".valueAlt.bonus") localize=true classes="inline-child"}}
|
||||
</div>
|
||||
</fieldset>
|
||||
{{/inline}}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
<fieldset class="action-category">
|
||||
<legend class="action-category-label" data-action="toggleSection" data-section="effects">
|
||||
<div>{{localize "DAGGERHEART.GENERAL.resource"}}</div>
|
||||
<div>{{localize "DAGGERHEART.GENERAL.Resource.single"}}</div>
|
||||
</legend>
|
||||
<div class="action-category-data open">
|
||||
<fieldset>
|
||||
|
|
|
|||
|
|
@ -16,33 +16,6 @@
|
|||
</fieldset>
|
||||
{{/if}}
|
||||
|
||||
{{#each @root.formula}}
|
||||
<div class="damage-formula">
|
||||
<span class="damage-resource"><b>{{localize "DAGGERHEART.GENERAL.formula"}}:</b> {{roll.formula}}</span>
|
||||
<span class="damage-details">
|
||||
{{#with (lookup @root.config.GENERAL.healingTypes applyTo)}}
|
||||
{{localize label}}
|
||||
{{/with}}
|
||||
{{#unless @root.hasHealing}}
|
||||
{{#if damageTypes}}
|
||||
{{#each damageTypes as | type | }}
|
||||
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||
<i class="fa-solid {{icon}}"></i>
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bonuses form-group flexrow">
|
||||
<input type="text" value="{{extraFormula}}" name="roll.{{ @index }}.extraFormula" placeholder="{{localize "DAGGERHEART.GENERAL.situationalBonus"}}">
|
||||
<button class="critical-chip" data-action="toggleCritical">
|
||||
<span><i class="{{#if @root.isCritical}}fa-solid{{else}}fa-regular{{/if}} fa-circle"></i></span>
|
||||
<span class="label">{{localize "DAGGERHEART.GENERAL.criticalShort"}}</span>
|
||||
</button>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
{{#if damageOptions.groupAttack}}
|
||||
<fieldset class="group-attack-container">
|
||||
<legend>{{localize "DAGGERHEART.ACTIONS.Settings.groupAttack.label"}}</legend>
|
||||
|
|
@ -60,6 +33,45 @@
|
|||
</fieldset>
|
||||
{{/if}}
|
||||
|
||||
{{#if @root.damageFormula}}
|
||||
{{#with @root.damageFormula}}
|
||||
<div class="damage-formula">
|
||||
<span class="damage-resource"><b>{{localize "DAGGERHEART.GENERAL.formula"}}:</b> {{roll.formula}}</span>
|
||||
<span class="damage-details">
|
||||
{{localize "DAGGERHEART.GENERAL.damage"}}
|
||||
{{#if damageTypes}}
|
||||
{{#each damageTypes as | type | }}
|
||||
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||
<i class="fa-solid {{icon}}"></i>
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bonuses form-group flexrow">
|
||||
<input type="text" value="{{extraFormula}}" name="damageFormula.extraFormula" placeholder="{{localize "DAGGERHEART.GENERAL.situationalBonus"}}">
|
||||
<button class="critical-chip" data-action="toggleCritical">
|
||||
<span><i class="{{#if @root.isCritical}}fa-solid{{else}}fa-regular{{/if}} fa-circle"></i></span>
|
||||
<span class="label">{{localize "DAGGERHEART.GENERAL.criticalShort"}}</span>
|
||||
</button>
|
||||
</div>
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
|
||||
{{#each @root.resourceFormulas}}
|
||||
<div class="damage-formula">
|
||||
<span class="damage-resource"><b>{{localize "DAGGERHEART.GENERAL.formula"}}:</b> {{roll.formula}}</span>
|
||||
<span class="damage-details">
|
||||
{{#with (lookup @root.config.GENERAL.healingTypes applyTo)}}
|
||||
{{localize label}}
|
||||
{{/with}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bonuses form-group flexrow">
|
||||
<input type="text" value="{{extraFormula}}" name={{concat "resourceFormulas." @key ".extraFormula"}} placeholder="{{localize "DAGGERHEART.GENERAL.situationalBonus"}}">
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
{{#unless (empty @root.modifiers)}}
|
||||
<fieldset class="modifier-container two-columns">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.Modifier.plural"}}</legend>
|
||||
|
|
@ -76,6 +88,7 @@
|
|||
{{/each}}
|
||||
</fieldset>
|
||||
{{/unless}}
|
||||
|
||||
<div class="damage-section-controls">
|
||||
{{#if directDamage}}
|
||||
<select class="roll-mode-select" name="selectedMessageMode">
|
||||
|
|
|
|||
|
|
@ -1,25 +1,36 @@
|
|||
{{#each damage as |damage key|}}
|
||||
{{#if damage.main}}
|
||||
{{> damage roll=damage.main label=(localize "DAGGERHEART.GENERAL.damage") memberKey=key}}
|
||||
{{/if}}
|
||||
|
||||
{{#each damage.resources as |roll key|}}
|
||||
{{> damage roll=roll label=(localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")) memberKey=../key isResource="true" }}
|
||||
{{/each}}
|
||||
|
||||
{{#*inline "damage"}}
|
||||
<div class="roll-data {{#if isCritical}}critical{{/if}}">
|
||||
<div class="duality-label">
|
||||
<span>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}:</span>
|
||||
<span>{{damage.total}}</span>
|
||||
<span>{{label}}:</span>
|
||||
<span>{{roll.total}}</span>
|
||||
</div>
|
||||
{{#each damage.parts as |part|}}
|
||||
|
||||
<div class="roll-dice-container">
|
||||
{{#each part.dice as |dice index|}}
|
||||
<a class="roll-dice" data-action="rerollDamageDice" data-member-key="{{../../../key}}" data-damage-key="{{@../../key}}" data-part="{{@../index}}" data-dice="{{index}}">
|
||||
<span class="dice-label">{{dice.total}}</span>
|
||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" dice.dice ".svg"}}" />
|
||||
{{#each roll.dice}}
|
||||
{{#each results as |result index|}}
|
||||
{{#if result.active}}
|
||||
<a class="roll-dice" data-action="rerollDamageDice" data-member-key="{{../../memberKey}}" data-damage-key="{{@../../key}}" {{#if ../../isResource}}data-is-resource="true"{{/if}} data-dice-index="{{@../key}}" data-result-index="{{index}}">
|
||||
<span class="dice-label">{{result.result}}</span>
|
||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" ../denomination ".svg"}}" />
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{#unless @last}}
|
||||
<span class="roll-operator">+</span>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
{{#if part.modifierTotal}}
|
||||
{{#if part.dice.length}}<span class="roll-operator">{{#if (gte part.modifierTotal 0)}}+{{else}}-{{/if}}</span>{{/if}}
|
||||
<span class="roll-value">{{positive part.modifierTotal}}</span>
|
||||
{{#if roll.modifierTotal}}
|
||||
{{#if roll.dice.length}}<span class="roll-operator">{{#if (gte roll.modifierTotal 0)}}+{{else}}-{{/if}}</span>{{/if}}
|
||||
<span class="roll-value">{{positive roll.modifierTotal}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{/inline}}
|
||||
|
|
@ -6,19 +6,19 @@
|
|||
{{#if hintText}}
|
||||
<div class="hint">{{localize hintText}}</div>
|
||||
{{else}}
|
||||
{{#if joinedRoll.roll}}
|
||||
{{#if joinedRoll.rollData}}
|
||||
<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 class="damage-info">{{joinedRoll.rollData.total}}</div>
|
||||
<div>{{localize "DAGGERHEART.GENERAL.withThing" thing=joinedRoll.roll.totalLabel}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if joinedRoll.rollData.options.hasDamage}}
|
||||
{{#if joinedRoll.damageRollData}}
|
||||
<div class="result-container">
|
||||
<span class="result-section-label">{{localize "DAGGERHEART.GENERAL.damage"}}</span>
|
||||
{{#each joinedRoll.rollData.options.damage as |damage key|}}
|
||||
{{#each joinedRoll.damageRollData.types as |damage key|}}
|
||||
<div class="result-info">
|
||||
<div>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}</div>
|
||||
<div class="damage-info">{{damage.total}}</div>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@
|
|||
|
||||
{{#if roll}}
|
||||
<div class="roll-data {{#if roll.withHope}}hope{{else if roll.withFear}}fear{{else}}critical{{/if}}">
|
||||
<div class="duality-label">{{roll.total}} {{localize "DAGGERHEART.GENERAL.withThing" thing=roll.totalLabel}}</div>
|
||||
<div class="duality-label">
|
||||
{{roll.total}}
|
||||
{{#if roll.isCritical}}{{roll.totalLabel}}{{else}}{{localize "DAGGERHEART.GENERAL.withThing" thing=roll.totalLabel}}{{/if}}
|
||||
</div>
|
||||
<div class="roll-dice-container">
|
||||
<a class="roll-dice" data-action="rerollDice" data-member="{{@root.partId}}" data-dice-type="hope">
|
||||
<span class="dice-label">{{roll.dHope.total}}</span>
|
||||
|
|
@ -100,15 +103,12 @@
|
|||
<a class="roll-button" data-action="makeDamageRoll" data-member-key="{{@root.partId}}" {{#unless readyToRoll}}disabled{{/unless}}>
|
||||
<img src="systems/daggerheart/assets/icons/dice/hope/d20.svg" />
|
||||
</a>
|
||||
|
||||
{{#if damage}}
|
||||
<a class="delete-button" data-action="removeDamageRoll" data-member-key="{{@root.partId}}" {{#unless rollData.options.damage}}disabled{{/unless}}>
|
||||
<a class="delete-button" data-action="removeDamageRoll" data-member-key="{{@root.partId}}" {{#unless damage.active}}disabled{{/unless}}>
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</span>
|
||||
{{#if damage}}
|
||||
{{#if damage.active}}
|
||||
{{#if useCritDamage}}
|
||||
{{> "systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs" damage=critDamage isCritical=true }}
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
>
|
||||
{{#if fields.roll}}{{> 'systems/daggerheart/templates/actionTypes/roll.hbs' fields=fields.roll.fields source=source.roll}}{{/if}}
|
||||
{{#if fields.save}}{{> 'systems/daggerheart/templates/actionTypes/save.hbs' fields=fields.save.fields source=source.save}}{{/if}}
|
||||
{{#if fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=fields.damage.fields.parts.element.fields source=source.damage baseFields=fields.damage.fields }}{{/if}}
|
||||
{{#if fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=fields.damage.fields source=source.damage baseFields=fields.damage.fields }}{{/if}}
|
||||
{{#if fields.macro}}{{> 'systems/daggerheart/templates/actionTypes/macro.hbs' fields=fields.macro source=source.macro}}{{/if}}
|
||||
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
||||
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@
|
|||
</div>
|
||||
{{formGroup systemFields.criticalThreshold value=document._source.system.criticalThreshold label="DAGGERHEART.ACTIONS.Settings.criticalThreshold" name="system.criticalThreshold" localize=true}}
|
||||
</fieldset>
|
||||
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields.parts.element.fields source=document.system.attack.damage path="system.attack." baseFields=systemFields.attack.fields.damage.fields horde=(eq document._source.system.type 'horde')}}
|
||||
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields source=document.system.attack.damage path="system.attack." baseFields=systemFields.attack.fields.damage.fields horde=(eq document._source.system.type 'horde')}}
|
||||
</section>
|
||||
|
|
@ -3,8 +3,22 @@
|
|||
data-tab='{{tabs.description.id}}'
|
||||
data-group='{{tabs.description.group}}'
|
||||
>
|
||||
<div class="description-section">
|
||||
{{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}}
|
||||
|
||||
{{#if (and systemFields.gmNotes @root.user.isGM)}}
|
||||
<section class="gm-notes-section">
|
||||
{{#if enrichedGMNotes}}
|
||||
<header class="gm-notes">{{localize "DAGGERHEART.ITEMS.FIELDS.gmNotes.label"}}</header>
|
||||
{{/if}}
|
||||
<prose-mirror
|
||||
name="system.gmNotes"
|
||||
{{#unless enrichedGMNotes}}class="hide-if-inactive"{{/unless}}
|
||||
toggled="true"
|
||||
value="{{document.system.gmNotes}}"
|
||||
>{{{enrichedGMNotes}}}</prose-mirror>
|
||||
</section>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if (and showAttribution document.system.attribution.artist)}}
|
||||
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -18,25 +18,25 @@
|
|||
</fieldset>
|
||||
|
||||
<fieldset class="two-columns">
|
||||
{{#with systemFields.attack.fields.damage.fields.parts.element.fields as | fields | }}
|
||||
{{#with ../document.system.attack.damage.parts.hitPoints as | source | }}
|
||||
{{#with systemFields.attack.fields.damage.fields.main.fields as | fields | }}
|
||||
{{#with ../document.system.attack.damage.main as | source | }}
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.damage"}}</legend>
|
||||
<span>{{localize "DAGGERHEART.ACTIONS.Config.general.customFormula"}}</span>
|
||||
{{formInput fields.value.fields.custom.fields.enabled value=source.value.custom.enabled name="system.attack.damage.parts.hitPoints.value.custom.enabled"}}
|
||||
{{formInput fields.value.fields.custom.fields.enabled value=source.value.custom.enabled name="system.attack.damage.main.value.custom.enabled"}}
|
||||
{{#if source.value.custom.enabled}}
|
||||
<span>{{localize "DAGGERHEART.ACTIONS.Config.general.formula"}}</span>
|
||||
{{formInput fields.value.fields.custom.fields.formula value=source.value.custom.formula name="system.attack.damage.parts.hitPoints.value.custom.formula"}}
|
||||
{{formInput fields.value.fields.custom.fields.formula value=source.value.custom.formula name="system.attack.damage.main.value.custom.formula"}}
|
||||
{{else}}
|
||||
<span>{{localize "DAGGERHEART.GENERAL.Dice.single"}}</span>
|
||||
{{formInput fields.value.fields.dice value=source.value.dice name="system.attack.damage.parts.hitPoints.value.dice"}}
|
||||
{{formInput fields.value.fields.dice value=source.value.dice name="system.attack.damage.main.value.dice"}}
|
||||
<span>{{localize "DAGGERHEART.GENERAL.bonus"}}</span>
|
||||
{{formInput fields.value.fields.bonus value=source.value.bonus name="system.attack.damage.parts.hitPoints.value.bonus" localize=true}}
|
||||
{{formInput fields.value.fields.bonus value=source.value.bonus name="system.attack.damage.main.value.bonus" localize=true}}
|
||||
{{/if}}
|
||||
<span>{{localize "DAGGERHEART.GENERAL.type"}}</span>
|
||||
{{formInput fields.type value=source.type name="system.attack.damage.parts.hitPoints.type" localize=true}}
|
||||
{{formInput fields.type value=source.type name="system.attack.damage.main.type" localize=true}}
|
||||
<span>{{localize "DAGGERHEART.CONFIG.DamageType.direct.name"}}</span>
|
||||
{{formInput @root.systemFields.attack.fields.damage.fields.direct value=@root.document.system.attack.damage.direct name="system.attack.damage.direct" localize=true}}
|
||||
<input type="hidden" name="system.attack.damage.parts.hitPoints.value.multiplier" value="{{source.value.multiplier}}">
|
||||
{{formInput @root.systemFields.attack.fields.damage.fields.main.fields.direct value=@root.document.system.attack.damage.main.direct name="system.attack.damage.main.direct" localize=true}}
|
||||
<input type="hidden" name="system.attack.damage.main.value.multiplier" value="{{source.value.multiplier}}">
|
||||
{{/with}}
|
||||
{{/with}}
|
||||
</fieldset>
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
{{#each action.summon}}
|
||||
<div class="summon-container">
|
||||
<div class="summon-label-container">
|
||||
<img src="{{this.actor.img}}" />
|
||||
<label>{{this.actor.name}}</label>
|
||||
<img src="{{this.data.img}}" />
|
||||
<label>{{this.data.name}}</label>
|
||||
</div>
|
||||
<span># {{this.rolledCount}}</span>
|
||||
<span># {{this.quantity}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,18 @@
|
|||
<li class="chat-message message flexcol {{cssClass}}" data-message-id="{{message._id}}"
|
||||
{{#if borderColor}}style="border-color:{{borderColor}}"{{/if}}>
|
||||
<header class="message-header flexrow">
|
||||
<div class="message-header-main">
|
||||
<div class="portrait">
|
||||
<img class="actor-img" src="{{actor.img}}" />
|
||||
<div class="message-sub-header-container">
|
||||
</div>
|
||||
<div class="message-header-main">
|
||||
{{#if message.title}}
|
||||
<h4>{{message.title}}</h4>
|
||||
<div>{{alias}} {{#if author.isGM}}(GM){{/if}}</div>
|
||||
{{else}}
|
||||
{{#unless actor.name}}
|
||||
{{else if (not actor.name)}}
|
||||
<h4>{{author.name}}</h4>
|
||||
{{else}}
|
||||
<h4>{{alias}}</h4>
|
||||
<div>{{author.name}}</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="message-header-metadata">
|
||||
|
||||
<span class="message-metadata">
|
||||
<time class="message-timestamp">{{timeSince message.timestamp}}</time>
|
||||
{{#if canDelete}}
|
||||
|
|
@ -32,10 +27,20 @@
|
|||
{{/if}}
|
||||
</span>
|
||||
|
||||
<div class="subtitle">
|
||||
<div class="name">
|
||||
{{#if message.title}}
|
||||
{{alias}} {{#if author.isGM}}(GM){{/if}}
|
||||
{{else if (not actor.name)}}
|
||||
{{author.name}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if isWhisper}}
|
||||
<span class="whisper-to">{{localize 'CHAT.To'}}: {{whisperTo}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="message-content">
|
||||
{{{message.content}}}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
<div class="roll-buttons">
|
||||
{{#if areas.length}}<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>{{/if}}
|
||||
{{#if hasDamage}}
|
||||
{{#unless (empty damage)}}
|
||||
{{#if damage.active}}
|
||||
<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.damageRoll.dealDamage"}}</button>
|
||||
{{else}}
|
||||
<button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollDamage"}}</button>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if hasHealing}}
|
||||
{{#unless (empty damage)}}
|
||||
{{#if damage.active}}
|
||||
<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.healingRoll.applyHealing"}}</button>
|
||||
{{else}}
|
||||
<button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollHealing"}}</button>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if (and hasEffect)}}<button class="duality-action-effect">{{localize "DAGGERHEART.UI.Chat.attackRoll.applyEffect"}}</button>{{/if}}
|
||||
</div>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="roll-part damage-section dice-roll" data-action="expandRoll"{{#if (empty damage)}} hidden{{/if}}>
|
||||
<div class="roll-part damage-section dice-roll" data-action="expandRoll"{{#unless damage.active}} hidden{{/unless}}>
|
||||
<div class="roll-part-header">
|
||||
<div>
|
||||
{{#if hasHealing}}
|
||||
|
|
@ -10,60 +10,79 @@
|
|||
</div>
|
||||
<div class="roll-part-extra on-reduced">
|
||||
<div class="wrapper">
|
||||
{{#each damage as | roll index | }}
|
||||
<div class="roll-formula">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}}: {{total}}</div>
|
||||
{{#if damage.main}}
|
||||
{{> formula roll=damage.main label=(localize "DAGGERHEART.GENERAL.damage") }}
|
||||
{{/if}}
|
||||
{{#each damage.resources as | roll index | }}
|
||||
{{> formula roll=roll label=(ifThen ../hasHealing (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')) (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll'))) }}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="roll-part-content dice-result">
|
||||
<div class="dice-tooltip">
|
||||
<div class="wrapper">
|
||||
{{#each damage as | roll index | }}
|
||||
{{#if damage.main}}
|
||||
{{> damage label=(localize "DAGGERHEART.GENERAL.damage") roll=damage.main isDirect=isDirect }}
|
||||
{{/if}}
|
||||
|
||||
{{#each damage.resources as | roll index | }}
|
||||
{{> damage
|
||||
label=(ifThen ../hasHealing (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')) (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')))
|
||||
roll=roll
|
||||
isResource=true
|
||||
}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#*inline "formula"}}
|
||||
<div class="roll-formula">{{label}}: {{roll.total}}</div>
|
||||
{{/inline}}
|
||||
|
||||
{{#*inline "damage"}}
|
||||
<fieldset>
|
||||
<legend>
|
||||
{{#if ../hasHealing}}{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}}{{else}}{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}}{{/if}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints") ../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
|
||||
{{label}}
|
||||
<div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if isDirect}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
|
||||
</legend>
|
||||
{{#each roll.parts}}
|
||||
{{#if (and (not @root.hasHealing) damageTypes.length)}}
|
||||
{{#if (and (not @root.hasHealing) roll.options.damageTypes.length)}}
|
||||
<label class="roll-part-header"><span>
|
||||
{{#each damageTypes}}
|
||||
{{#each roll.options.damageTypes}}
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.ArmorFeature.' this '.name')}}
|
||||
{{#unless @last}}/{{/unless}}
|
||||
{{/each}}
|
||||
<div class="roll-formula">{{total}}</div></span></label>
|
||||
<div class="roll-formula">{{roll.total}}</div></span></label>
|
||||
{{/if}}
|
||||
<div class="roll-dice">
|
||||
{{#if dice.length}}
|
||||
{{#each dice}}
|
||||
{{#if roll.dice.length}}
|
||||
{{#each roll.dice}}
|
||||
{{#each results}}
|
||||
{{#unless discarded}}
|
||||
{{#if active}}
|
||||
<div class="roll-die{{#unless @../first}} has-plus{{/unless}}">
|
||||
<div
|
||||
class="dice reroll-button {{ifThen denomination denomination ../dice}}"
|
||||
data-die-index="0" data-type="damage" data-damage-type="{{@../../../key}}" data-part="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}"
|
||||
class="dice reroll-button {{ifThen denomination denomination ../denomination}}"
|
||||
data-type="damage" data-damage-type="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}" {{#if ../../isResource}}data-is-resource="true"{{/if}}
|
||||
>
|
||||
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
||||
{{result}}
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
{{#if modifierTotal}}
|
||||
<div class="roll-die{{#if (gt modifierTotal 0)}} has-plus{{/if}}">
|
||||
<div class="font-20">{{modifierTotal}}</div>
|
||||
|
||||
{{#if roll.modifierTotal}}
|
||||
<div class="roll-die{{#if (gt roll.modifierTotal 0)}} has-plus{{/if}}">
|
||||
<div class="font-20">{{roll.modifierTotal}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<div class="roll-die">
|
||||
<div class="font-20">{{total}}</div>
|
||||
<div class="font-20">{{roll.total}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</fieldset>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/inline}}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
<div class="tag">
|
||||
<span>{{{damageFormula attack}}} {{{damageSymbols attack.damage.parts}}}</span>
|
||||
<span>{{{damageFormula attack}}} {{{damageSymbols attack.damage.main}}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{#if description}}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
{{/with}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
<span>{{{damageFormula item.system.attack}}} {{{damageSymbols item.system.attack.damage.parts}}}</span>
|
||||
<span>{{{damageFormula item.system.attack}}} {{{damageSymbols item.system.attack.damage.main}}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{#if description}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue