mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Compare commits
No commits in common. "d3141059acfef63db29b7f22060977a5f362a551" and "2bc1c04c932d91f9d66bc65321813a3756270c23" have entirely different histories.
d3141059ac
...
2bc1c04c93
10 changed files with 121 additions and 125 deletions
|
|
@ -106,12 +106,7 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
|
|
||||||
context.isGM = game.user.isGM;
|
context.isGM = game.user.isGM;
|
||||||
context.isEditable =
|
context.isEditable = this.getIsEditable();
|
||||||
game.user.isGM ||
|
|
||||||
this.party.system.partyMembers.some(actor => {
|
|
||||||
const selected = Boolean(this.party.system.groupRoll.participants[actor.id]);
|
|
||||||
return selected && actor.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER);
|
|
||||||
});
|
|
||||||
context.fields = this.party.system.schema.fields.groupRoll.fields;
|
context.fields = this.party.system.schema.fields.groupRoll.fields;
|
||||||
context.data = this.party.system.groupRoll;
|
context.data = this.party.system.groupRoll;
|
||||||
context.traitOptions = CONFIG.DH.ACTOR.abilities;
|
context.traitOptions = CONFIG.DH.ACTOR.abilities;
|
||||||
|
|
@ -270,6 +265,13 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIsEditable() {
|
||||||
|
return this.party.system.partyMembers.some(actor => {
|
||||||
|
const selected = Boolean(this.party.system.groupRoll.participants[actor.id]);
|
||||||
|
return selected && actor.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
groupRollRefresh = ({ refreshType, action, parts }) => {
|
groupRollRefresh = ({ refreshType, action, parts }) => {
|
||||||
if (refreshType !== RefreshType.GroupRoll) return;
|
if (refreshType !== RefreshType.GroupRoll) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,12 +116,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
context.isEditable =
|
context.isEditable = this.getIsEditable();
|
||||||
game.user.isGM ||
|
|
||||||
this.party.system.partyMembers.some(actor => {
|
|
||||||
const selected = Boolean(this.party.system.tagTeam.members[actor.id]);
|
|
||||||
return selected && actor.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER);
|
|
||||||
});
|
|
||||||
context.fields = this.party.system.schema.fields.tagTeam.fields;
|
context.fields = this.party.system.schema.fields.tagTeam.fields;
|
||||||
context.data = this.party.system.tagTeam;
|
context.data = this.party.system.tagTeam;
|
||||||
context.rollTypes = CONFIG.DH.GENERAL.tagTeamRollTypes;
|
context.rollTypes = CONFIG.DH.GENERAL.tagTeamRollTypes;
|
||||||
|
|
@ -184,56 +179,57 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(this.party.system.tagTeam.members).includes(partId)) {
|
if (Object.keys(this.party.system.tagTeam.members).includes(partId)) {
|
||||||
const data = await this.#prepareMemberContext(partId);
|
const data = this.party.system.tagTeam.members[partId];
|
||||||
partContext.hasDamage |= Boolean(data?.damage);
|
|
||||||
partContext.members[partId] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return partContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
async #prepareMemberContext(partId) {
|
|
||||||
const data = this.party.system.tagTeam.members[partId] ?? {};
|
|
||||||
const actor = game.actors.get(partId);
|
const actor = game.actors.get(partId);
|
||||||
if (!actor) console.error(`Failed to get actor ${partId}`);
|
|
||||||
|
|
||||||
const rollOptions = [];
|
const rollOptions = [];
|
||||||
const damageRollOptions = [];
|
const damageRollOptions = [];
|
||||||
for (const item of actor?.items ?? []) {
|
for (const item of actor.items) {
|
||||||
if (!item.system.metadata.hasActions) continue;
|
if (item.system.metadata.hasActions) {
|
||||||
const actions = [...item.system.actions, ...(item.system.attack ? [item.system.attack] : [])];
|
const actions = [...item.system.actions, ...(item.system.attack ? [item.system.attack] : [])];
|
||||||
for (const action of actions) {
|
for (const action of actions) {
|
||||||
if (action.hasRoll) {
|
if (action.hasRoll) {
|
||||||
const collection = action.hasDamage ? damageRollOptions : rollOptions;
|
const actionItem = {
|
||||||
collection.push({
|
|
||||||
value: action.uuid,
|
value: action.uuid,
|
||||||
label: action.name,
|
label: action.name,
|
||||||
group: item.name,
|
group: item.name,
|
||||||
baseAction: action.baseAction
|
baseAction: action.baseAction
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (action.hasDamage) damageRollOptions.push(actionItem);
|
||||||
|
else rollOptions.push(actionItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
||||||
const critSelected = !selectedRoll ? undefined : (selectedRoll?.rollData?.options?.roll?.isCritical ?? false);
|
const critSelected = !selectedRoll
|
||||||
const damage = data.rollData?.options?.damage;
|
? undefined
|
||||||
|
: (selectedRoll?.rollData?.options?.roll?.isCritical ?? false);
|
||||||
|
|
||||||
return {
|
const damage = data.rollData?.options?.damage;
|
||||||
|
partContext.hasDamage |= Boolean(damage);
|
||||||
|
const critHitPointsDamage = await this.getCriticalDamage(damage);
|
||||||
|
|
||||||
|
partContext.members[partId] = {
|
||||||
...data,
|
...data,
|
||||||
roll: data.roll,
|
roll: data.roll,
|
||||||
isEditable: actor?.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER),
|
isEditable: actor.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER),
|
||||||
key: partId,
|
key: partId,
|
||||||
readyToRoll: Boolean(data.rollChoice),
|
readyToRoll: Boolean(data.rollChoice),
|
||||||
hasRolled: Boolean(data.rollData),
|
hasRolled: Boolean(data.rollData),
|
||||||
rollOptions,
|
rollOptions,
|
||||||
damageRollOptions,
|
damageRollOptions,
|
||||||
damage: damage,
|
damage: damage,
|
||||||
critDamage: await this.getCriticalDamage(damage),
|
critDamage: critHitPointsDamage,
|
||||||
useCritDamage: critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical)
|
useCritDamage: critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return partContext;
|
||||||
|
}
|
||||||
|
|
||||||
getUpdatingParts(target) {
|
getUpdatingParts(target) {
|
||||||
const { initialization, rollSelection, result } = this.constructor.PARTS;
|
const { initialization, rollSelection, result } = this.constructor.PARTS;
|
||||||
const isInitialization = this.tabGroups.application === initialization.id;
|
const isInitialization = this.tabGroups.application === initialization.id;
|
||||||
|
|
@ -277,6 +273,13 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIsEditable() {
|
||||||
|
return this.party.system.partyMembers.some(actor => {
|
||||||
|
const selected = Boolean(this.party.system.tagTeam.members[actor.id]);
|
||||||
|
return selected && actor.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
tagTeamRefresh = ({ refreshType, action, parts }) => {
|
tagTeamRefresh = ({ refreshType, action, parts }) => {
|
||||||
if (refreshType !== RefreshType.TagTeamRoll) return;
|
if (refreshType !== RefreshType.TagTeamRoll) return;
|
||||||
|
|
||||||
|
|
@ -646,11 +649,10 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
async getJoinedRoll({ overrideIsCritical, displayVersion } = {}) {
|
async getJoinedRoll({ overrideIsCritical, displayVersion } = {}) {
|
||||||
try {
|
|
||||||
const memberValues = Object.values(this.party.system.tagTeam.members);
|
const memberValues = Object.values(this.party.system.tagTeam.members);
|
||||||
const selectedRoll = memberValues.find(x => x.selected);
|
const selectedRoll = memberValues.find(x => x.selected);
|
||||||
const baseMainRoll = selectedRoll ?? memberValues[0];
|
let baseMainRoll = selectedRoll ?? memberValues[0];
|
||||||
const baseSecondaryRoll = selectedRoll
|
let baseSecondaryRoll = selectedRoll
|
||||||
? memberValues.find(x => !x.selected)
|
? memberValues.find(x => !x.selected)
|
||||||
: memberValues.length > 1
|
: memberValues.length > 1
|
||||||
? memberValues[1]
|
? memberValues[1]
|
||||||
|
|
@ -669,16 +671,13 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
? await this.getCriticalDamage(secondaryRollData.options.damage)
|
? await this.getCriticalDamage(secondaryRollData.options.damage)
|
||||||
: secondaryRollData.options.damage;
|
: secondaryRollData.options.damage;
|
||||||
if (systemData.damage) {
|
if (systemData.damage) {
|
||||||
for (const [key, damage] of Object.entries(secondaryDamage ?? {})) {
|
for (const key in secondaryDamage) {
|
||||||
if (key in systemData.damage) {
|
const damage = secondaryDamage[key];
|
||||||
systemData.damage[key].formula = [systemData.damage[key]?.formula, damage.formula]
|
systemData.damage[key].formula = [systemData.damage[key].formula, damage.formula]
|
||||||
.filter(x => x)
|
.filter(x => x)
|
||||||
.join(' + ');
|
.join(' + ');
|
||||||
systemData.damage[key].total += damage.total;
|
systemData.damage[key].total += damage.total;
|
||||||
systemData.damage[key].parts.push(...damage.parts);
|
systemData.damage[key].parts.push(...damage.parts);
|
||||||
} else {
|
|
||||||
systemData.damage[key] = damage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
systemData.damage = secondaryDamage;
|
systemData.damage = secondaryDamage;
|
||||||
|
|
@ -686,10 +685,6 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
return mainRoll;
|
return mainRoll;
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #onCancelRoll(_event, _button, options = { confirm: true }) {
|
static async #onCancelRoll(_event, _button, options = { confirm: true }) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
@import './features.less';
|
|
||||||
@import './header.less';
|
|
||||||
@import './sheet.less';
|
|
||||||
@import './sidebar.less';
|
|
||||||
@import './effects.less';
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
@import './biography.less';
|
|
||||||
@import './effects.less';
|
|
||||||
@import './features.less';
|
|
||||||
@import './header.less';
|
|
||||||
@import './inventory.less';
|
|
||||||
@import './loadout.less';
|
|
||||||
@import './sheet.less';
|
|
||||||
@import './sidebar.less';
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
@import './details.less';
|
|
||||||
@import './header.less';
|
|
||||||
@import './sheet.less';
|
|
||||||
@import './effects.less';
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
@import './features.less';
|
|
||||||
@import './header.less';
|
|
||||||
@import './potentialAdversaries.less';
|
|
||||||
@import './sheet.less';
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
@import './header.less';
|
|
||||||
@import './party-members.less';
|
|
||||||
@import './sheet.less';
|
|
||||||
@import './inventory.less';
|
|
||||||
|
|
@ -2,11 +2,35 @@
|
||||||
|
|
||||||
@import './actors/actor-sheet-shared.less';
|
@import './actors/actor-sheet-shared.less';
|
||||||
|
|
||||||
@import './actors/adversary/index.less';
|
@import './actors/adversary/actions.less';
|
||||||
@import './actors/character/index.less';
|
@import './actors/adversary/header.less';
|
||||||
@import './actors/companion/index.less';
|
@import './actors/adversary/sheet.less';
|
||||||
@import './actors/environment/index.less';
|
@import './actors/adversary/sidebar.less';
|
||||||
@import './actors/party/index.less';
|
@import './actors/adversary/effects.less';
|
||||||
|
|
||||||
|
@import './actors/character/biography.less';
|
||||||
|
@import './actors/character/effects.less';
|
||||||
|
@import './actors/character/features.less';
|
||||||
|
@import './actors/character/header.less';
|
||||||
|
@import './actors/character/inventory.less';
|
||||||
|
@import './actors/character/loadout.less';
|
||||||
|
@import './actors/character/sheet.less';
|
||||||
|
@import './actors/character/sidebar.less';
|
||||||
|
|
||||||
|
@import './actors/companion/details.less';
|
||||||
|
@import './actors/companion/header.less';
|
||||||
|
@import './actors/companion/sheet.less';
|
||||||
|
@import './actors/companion/effects.less';
|
||||||
|
|
||||||
|
@import './actors/environment/actions.less';
|
||||||
|
@import './actors/environment/header.less';
|
||||||
|
@import './actors/environment/potentialAdversaries.less';
|
||||||
|
@import './actors/environment/sheet.less';
|
||||||
|
|
||||||
|
@import './actors/party/header.less';
|
||||||
|
@import './actors/party/party-members.less';
|
||||||
|
@import './actors/party/sheet.less';
|
||||||
|
@import './actors/party/inventory.less';
|
||||||
|
|
||||||
@import './items/beastform.less';
|
@import './items/beastform.less';
|
||||||
@import './items/class.less';
|
@import './items/class.less';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue