mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 23:26:28 +01:00
Added in a temp attack button, because why not
This commit is contained in:
parent
52484bd818
commit
9fe29e5136
7 changed files with 26 additions and 29 deletions
16
lang/en.json
16
lang/en.json
|
|
@ -1017,13 +1017,15 @@
|
|||
"major": { "label": "Major" },
|
||||
"severe": { "label": "Severe" }
|
||||
},
|
||||
"hitPoints": {
|
||||
"value": { "label": "Current" },
|
||||
"max": { "label": "Max" }
|
||||
},
|
||||
"stress": {
|
||||
"value": { "label": "Current" },
|
||||
"max": { "label": "Max" }
|
||||
"resources": {
|
||||
"hitPoints": {
|
||||
"value": { "label": "Current" },
|
||||
"max": { "label": "Max" }
|
||||
},
|
||||
"stress": {
|
||||
"value": { "label": "Current" },
|
||||
"max": { "label": "Max" }
|
||||
}
|
||||
},
|
||||
"experiences": {
|
||||
"element": {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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 }),
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
<div class="flexrow">
|
||||
<button class="roll-damage-button" data-value="{{this.total.normal}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>Roll Damage</span></button>
|
||||
<button class="duality-action" data-value="{{this.total.normal}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>Roll Damage</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -20,15 +20,15 @@
|
|||
<fieldset>
|
||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.HitPoints"}}</legend>
|
||||
|
||||
{{formGroup systemFields.hitPoints.fields.value value=source.system.hitPoints.value}}
|
||||
{{formGroup systemFields.hitPoints.fields.max value=source.system.hitPoints.max}}
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.value value=source.system.resources.hitPoints.value}}
|
||||
{{formGroup systemFields.resources.fields.hitPoints.fields.max value=source.system.resources.hitPoints.max}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.Stress"}}</legend>
|
||||
|
||||
{{formGroup systemFields.stress.fields.value value=source.system.stress.value}}
|
||||
{{formGroup systemFields.stress.fields.max value=source.system.stress.max}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.value value=source.system.resources.stress.value}}
|
||||
{{formGroup systemFields.resources.fields.stress.fields.max value=source.system.resources.stress.max}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
|
|
@ -48,7 +48,8 @@
|
|||
<fieldset class="two-columns even">
|
||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.Attack"}}</legend>
|
||||
|
||||
<div class=full-width>{{formGroup systemFields.attack.fields.name value=source.system.attack.name}}</div>
|
||||
{{formGroup systemFields.attack.fields.name value=source.system.attack.name}}
|
||||
<button data-action="attackRoll">Attack</button>
|
||||
{{formGroup systemFields.attack.fields.modifier value=source.system.attack.modifier}}
|
||||
{{formGroup systemFields.attack.fields.range value=source.system.attack.range localize=true}}
|
||||
{{formGroup systemFields.attack.fields.damage.fields.value value=source.system.attack.damage.value}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue