Added in a temp attack button, because why not

This commit is contained in:
WBHarry 2025-06-08 22:42:04 +02:00
parent 52484bd818
commit 9fe29e5136
7 changed files with 26 additions and 29 deletions

View file

@ -1,12 +1,8 @@
import { DualityRollColor } from '../data/settings/Appearance.mjs';
import DHDualityRoll from "../data/chat-message/dualityRoll.mjs";
import DHDualityRoll from '../data/chat-message/dualityRoll.mjs';
export default class DhpChatMessage extends foundry.documents.ChatMessage {
async renderHTML() {
if (this.type === 'dualityRoll' || this.type === 'adversaryRoll' || this.type === 'abilityUse') {
this.content = await foundry.applications.handlebars.renderTemplate(this.content, this.system);
}
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
const html = await super.renderHTML();

View file

@ -86,9 +86,8 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
cls.create(msg.toObject());
}
static async attackRoll(event, button) {
const modifier = Number.parseInt(button.dataset.value);
static async attackRoll() {
const { modifier, damage, name: attackName } = this.actor.system.attack;
const { roll, dice, advantageState, modifiers } = await this.actor.diceRoll(
{ title: `${this.actor.name} - Attack Roll`, value: modifier },
event.shiftKey
@ -104,7 +103,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
const cls = getDocumentClass('ChatMessage');
const systemData = {
title: button.dataset.name,
title: attackName,
origin: this.document.id,
roll: roll._formula,
advantageState,
@ -112,7 +111,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
modifiers: modifiers,
dice: dice,
targets: targets,
damage: { value: button.dataset.damage, type: button.dataset.damageType }
damage: { value: damage.value, type: damage.type }
};
const msg = new cls({
type: 'adversaryRoll',

View file

@ -27,8 +27,10 @@ export default class DhpAdversary extends foundry.abstract.TypeDataModel {
major: new fields.NumberField({ required: true, initial: 0, integer: true }),
severe: new fields.NumberField({ required: true, initial: 0, integer: true })
}),
hitPoints: resourceField(),
stress: resourceField(),
resources: new fields.SchemaField({
hitPoints: resourceField(),
stress: resourceField()
}),
attack: new fields.SchemaField({
name: new fields.StringField({}),
modifier: new fields.NumberField({ required: true, integer: true, initial: 0 }),

View file

@ -346,10 +346,7 @@ export default class DhpActor extends Actor {
: 0;
const update = {
'system.resources.hitPoints.value': Math.min(
this.system.resources.hitPoints.value + hpDamage,
this.system.resources.hitPoints.max
)
'system.resources.hitPoints.value': Math.max(this.system.resources.hitPoints.value - hpDamage, 0)
};
if (game.user.isGM) {