mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge pull request #42 from Foundryborne/#24/Updating-Adversaries
Updating adversaries
This commit is contained in:
commit
ad1e968888
87 changed files with 5588 additions and 5069 deletions
|
|
@ -349,7 +349,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
static async attackRoll(event, button) {
|
||||
const modifier = Number.parseInt(button.dataset.value);
|
||||
|
||||
const { roll, diceResults, modifiers } = await this.actor.diceRoll(
|
||||
const { roll, dice, advantageState, modifiers } = await this.actor.diceRoll(
|
||||
{ title: `${this.actor.name} - Attack Roll`, value: modifier },
|
||||
event.shiftKey
|
||||
);
|
||||
|
|
@ -365,11 +365,15 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = new cls({
|
||||
type: 'adversaryRoll',
|
||||
sound: CONFIG.sounds.dice,
|
||||
system: {
|
||||
title: button.dataset.name,
|
||||
origin: this.document.id,
|
||||
roll: roll._formula,
|
||||
advantageState,
|
||||
total: roll._total,
|
||||
modifiers: modifiers,
|
||||
diceResults: diceResults,
|
||||
dice: dice,
|
||||
targets: targets,
|
||||
damage: { value: button.dataset.damage, type: button.dataset.damageType }
|
||||
},
|
||||
|
|
@ -381,16 +385,15 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
}
|
||||
|
||||
static async addExperience() {
|
||||
const experienceId = foundry.utils.randomID();
|
||||
await this.document.update({
|
||||
'system.experiences': [...this.document.system.experiences, { name: 'Experience', value: 1 }]
|
||||
[`system.experiences.${experienceId}`]: { id: experienceId, name: 'Experience', value: 1 }
|
||||
});
|
||||
}
|
||||
|
||||
static async removeExperience(_, button) {
|
||||
await this.document.update({
|
||||
'system.experiences': this.document.system.experiences.filter(
|
||||
(_, index) => index !== Number.parseInt(button.dataset.experience)
|
||||
)
|
||||
[`system.experiences.-=${button.dataset.experience}`]: null
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import DhpDowntime from '../downtime.mjs';
|
|||
import DhpLevelup from '../levelup.mjs';
|
||||
import AncestrySelectionDialog from '../ancestrySelectionDialog.mjs';
|
||||
import DaggerheartSheet from './daggerheart-sheet.mjs';
|
||||
import { abilities } from '../../config/actorConfig.mjs';
|
||||
|
||||
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||
const { TextEditor } = foundry.applications.ux;
|
||||
|
|
@ -481,9 +482,9 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
this.render();
|
||||
}
|
||||
|
||||
static async rollAttribute(event, target) {
|
||||
static async rollAttribute(event, button) {
|
||||
const { roll, hope, fear, advantage, disadvantage, modifiers } = await this.document.dualityRoll(
|
||||
{ title: 'Attribute Bonus', value: event.target.dataset.value },
|
||||
{ title: 'Attribute Bonus', value: button.dataset.value },
|
||||
event.shiftKey
|
||||
);
|
||||
|
||||
|
|
@ -491,6 +492,10 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const msgData = {
|
||||
type: 'dualityRoll',
|
||||
system: {
|
||||
title: game.i18n.format('DAGGERHEART.Chat.DualityRoll.AbilityCheckTitle', {
|
||||
ability: game.i18n.localize(abilities[button.dataset.attribute].label)
|
||||
}),
|
||||
origin: this.document.id,
|
||||
roll: roll._formula,
|
||||
modifiers: modifiers,
|
||||
hope: hope,
|
||||
|
|
@ -551,8 +556,8 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
await this.document.update({ [update]: newValue });
|
||||
}
|
||||
|
||||
static async attackRoll(_, event) {
|
||||
const weapon = await fromUuid(event.currentTarget.dataset.weapon);
|
||||
static async attackRoll(event, button) {
|
||||
const weapon = await fromUuid(button.dataset.weapon);
|
||||
const damage = {
|
||||
value: `${this.document.system.proficiency.value}${weapon.system.damage.value}`,
|
||||
type: weapon.system.damage.type,
|
||||
|
|
@ -580,7 +585,10 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = new cls({
|
||||
type: 'dualityRoll',
|
||||
sound: CONFIG.sounds.dice,
|
||||
system: {
|
||||
title: weapon.name,
|
||||
origin: this.document.id,
|
||||
roll: roll._formula,
|
||||
modifiers: modifiers,
|
||||
hope: hope,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue