mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +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" },
|
"major": { "label": "Major" },
|
||||||
"severe": { "label": "Severe" }
|
"severe": { "label": "Severe" }
|
||||||
},
|
},
|
||||||
"hitPoints": {
|
"resources": {
|
||||||
"value": { "label": "Current" },
|
"hitPoints": {
|
||||||
"max": { "label": "Max" }
|
"value": { "label": "Current" },
|
||||||
},
|
"max": { "label": "Max" }
|
||||||
"stress": {
|
},
|
||||||
"value": { "label": "Current" },
|
"stress": {
|
||||||
"max": { "label": "Max" }
|
"value": { "label": "Current" },
|
||||||
|
"max": { "label": "Max" }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"experiences": {
|
"experiences": {
|
||||||
"element": {
|
"element": {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
import { DualityRollColor } from '../data/settings/Appearance.mjs';
|
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 {
|
export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
async renderHTML() {
|
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. */
|
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
||||||
const html = await super.renderHTML();
|
const html = await super.renderHTML();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,8 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
static async attackRoll(event, button) {
|
static async attackRoll() {
|
||||||
const modifier = Number.parseInt(button.dataset.value);
|
const { modifier, damage, name: attackName } = this.actor.system.attack;
|
||||||
|
|
||||||
const { roll, dice, advantageState, modifiers } = await this.actor.diceRoll(
|
const { roll, dice, advantageState, modifiers } = await this.actor.diceRoll(
|
||||||
{ title: `${this.actor.name} - Attack Roll`, value: modifier },
|
{ title: `${this.actor.name} - Attack Roll`, value: modifier },
|
||||||
event.shiftKey
|
event.shiftKey
|
||||||
|
|
@ -104,7 +103,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const systemData = {
|
const systemData = {
|
||||||
title: button.dataset.name,
|
title: attackName,
|
||||||
origin: this.document.id,
|
origin: this.document.id,
|
||||||
roll: roll._formula,
|
roll: roll._formula,
|
||||||
advantageState,
|
advantageState,
|
||||||
|
|
@ -112,7 +111,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
modifiers: modifiers,
|
modifiers: modifiers,
|
||||||
dice: dice,
|
dice: dice,
|
||||||
targets: targets,
|
targets: targets,
|
||||||
damage: { value: button.dataset.damage, type: button.dataset.damageType }
|
damage: { value: damage.value, type: damage.type }
|
||||||
};
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'adversaryRoll',
|
type: 'adversaryRoll',
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@ export default class DhpAdversary extends foundry.abstract.TypeDataModel {
|
||||||
major: new fields.NumberField({ required: true, initial: 0, integer: true }),
|
major: new fields.NumberField({ required: true, initial: 0, integer: true }),
|
||||||
severe: new fields.NumberField({ required: true, initial: 0, integer: true })
|
severe: new fields.NumberField({ required: true, initial: 0, integer: true })
|
||||||
}),
|
}),
|
||||||
hitPoints: resourceField(),
|
resources: new fields.SchemaField({
|
||||||
stress: resourceField(),
|
hitPoints: resourceField(),
|
||||||
|
stress: resourceField()
|
||||||
|
}),
|
||||||
attack: new fields.SchemaField({
|
attack: new fields.SchemaField({
|
||||||
name: new fields.StringField({}),
|
name: new fields.StringField({}),
|
||||||
modifier: new fields.NumberField({ required: true, integer: true, initial: 0 }),
|
modifier: new fields.NumberField({ required: true, integer: true, initial: 0 }),
|
||||||
|
|
|
||||||
|
|
@ -346,10 +346,7 @@ export default class DhpActor extends Actor {
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
const update = {
|
const update = {
|
||||||
'system.resources.hitPoints.value': Math.min(
|
'system.resources.hitPoints.value': Math.max(this.system.resources.hitPoints.value - hpDamage, 0)
|
||||||
this.system.resources.hitPoints.value + hpDamage,
|
|
||||||
this.system.resources.hitPoints.max
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="flexrow">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -20,15 +20,15 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.HitPoints"}}</legend>
|
<legend>{{localize "DAGGERHEART.Sheets.Adversary.HitPoints"}}</legend>
|
||||||
|
|
||||||
{{formGroup systemFields.hitPoints.fields.value value=source.system.hitPoints.value}}
|
{{formGroup systemFields.resources.fields.hitPoints.fields.value value=source.system.resources.hitPoints.value}}
|
||||||
{{formGroup systemFields.hitPoints.fields.max value=source.system.hitPoints.max}}
|
{{formGroup systemFields.resources.fields.hitPoints.fields.max value=source.system.resources.hitPoints.max}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.Stress"}}</legend>
|
<legend>{{localize "DAGGERHEART.Sheets.Adversary.Stress"}}</legend>
|
||||||
|
|
||||||
{{formGroup systemFields.stress.fields.value value=source.system.stress.value}}
|
{{formGroup systemFields.resources.fields.stress.fields.value value=source.system.resources.stress.value}}
|
||||||
{{formGroup systemFields.stress.fields.max value=source.system.stress.max}}
|
{{formGroup systemFields.resources.fields.stress.fields.max value=source.system.resources.stress.max}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
@ -48,7 +48,8 @@
|
||||||
<fieldset class="two-columns even">
|
<fieldset class="two-columns even">
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Adversary.Attack"}}</legend>
|
<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.modifier value=source.system.attack.modifier}}
|
||||||
{{formGroup systemFields.attack.fields.range value=source.system.attack.range localize=true}}
|
{{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}}
|
{{formGroup systemFields.attack.fields.damage.fields.value value=source.system.attack.damage.value}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue