mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Added fall and collision damage buttons in the GM Menu (#1756)
This commit is contained in:
parent
e2b13d6717
commit
dbd5ef8bb0
8 changed files with 90 additions and 19 deletions
|
|
@ -450,7 +450,8 @@
|
||||||
},
|
},
|
||||||
"DaggerheartMenu": {
|
"DaggerheartMenu": {
|
||||||
"title": "GM Tools",
|
"title": "GM Tools",
|
||||||
"refreshFeatures": "Refresh Features"
|
"refreshFeatures": "Refresh Features",
|
||||||
|
"fallingAndCollision": "Falling And Collision Damage"
|
||||||
},
|
},
|
||||||
"DeleteConfirmation": {
|
"DeleteConfirmation": {
|
||||||
"title": "Delete {type} - {name}",
|
"title": "Delete {type} - {name}",
|
||||||
|
|
@ -1155,6 +1156,12 @@
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fallAndCollision": {
|
||||||
|
"veryClose": { "label": "Very Close", "chatTitle": "Fall Damage: Very Close" },
|
||||||
|
"close": { "label": "Close", "chatTitle": "Fall Damage: Close" },
|
||||||
|
"far": { "label": "Far", "chatTitle": "Fall Damage: Far" },
|
||||||
|
"collision": { "label": "Collision", "chatTitle": "Dangerous Collision" }
|
||||||
|
},
|
||||||
"FeatureForm": {
|
"FeatureForm": {
|
||||||
"label": "Feature Form",
|
"label": "Feature Form",
|
||||||
"passive": "Passive",
|
"passive": "Passive",
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,6 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
'systems/daggerheart/templates/ui/chat/action.hbs',
|
'systems/daggerheart/templates/ui/chat/action.hbs',
|
||||||
systemData
|
systemData
|
||||||
),
|
),
|
||||||
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'),
|
|
||||||
speaker: cls.getSpeaker(),
|
speaker: cls.getSpeaker(),
|
||||||
flags: {
|
flags: {
|
||||||
daggerheart: {
|
daggerheart: {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
selectRefreshable: DaggerheartMenu.#selectRefreshable,
|
selectRefreshable: DaggerheartMenu.#selectRefreshable,
|
||||||
refreshActors: DaggerheartMenu.#refreshActors
|
refreshActors: DaggerheartMenu.#refreshActors,
|
||||||
|
createFallCollisionDamage: DaggerheartMenu.#createFallCollisionDamage
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -50,6 +51,7 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract
|
||||||
const context = await super._prepareContext(options);
|
const context = await super._prepareContext(options);
|
||||||
context.refreshables = this.refreshSelections;
|
context.refreshables = this.refreshSelections;
|
||||||
context.disableRefresh = Object.values(this.refreshSelections).every(x => !x.selected);
|
context.disableRefresh = Object.values(this.refreshSelections).every(x => !x.selected);
|
||||||
|
context.fallAndCollision = CONFIG.DH.GENERAL.fallAndCollisionDamage;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
@ -71,4 +73,22 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract
|
||||||
this.refreshSelections = DaggerheartMenu.defaultRefreshSelections();
|
this.refreshSelections = DaggerheartMenu.defaultRefreshSelections();
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async #createFallCollisionDamage(_event, button) {
|
||||||
|
const data = CONFIG.DH.GENERAL.fallAndCollisionDamage[button.dataset.key];
|
||||||
|
const roll = new Roll(data.damageFormula);
|
||||||
|
await roll.evaluate();
|
||||||
|
|
||||||
|
/* class BaseRoll needed to get rendered by foundryRoll.hbs */
|
||||||
|
const rollJSON = roll.toJSON();
|
||||||
|
rollJSON.class = 'BaseRoll';
|
||||||
|
|
||||||
|
foundry.documents.ChatMessage.implementation.create({
|
||||||
|
title: game.i18n.localize(data.chatTitle),
|
||||||
|
author: game.user.id,
|
||||||
|
speaker: foundry.documents.ChatMessage.implementation.getSpeaker(),
|
||||||
|
rolls: [rollJSON],
|
||||||
|
sound: CONFIG.sounds.dice
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1057,3 +1057,30 @@ export const activeEffectDurations = {
|
||||||
label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.custom'
|
label: 'DAGGERHEART.CONFIG.ActiveEffectDuration.custom'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const fallAndCollisionDamage = {
|
||||||
|
veryClose: {
|
||||||
|
id: 'veryClose',
|
||||||
|
label: 'DAGGERHEART.CONFIG.fallAndCollision.veryClose.label',
|
||||||
|
chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.veryClose.chatTitle',
|
||||||
|
damageFormula: '1d10 + 3'
|
||||||
|
},
|
||||||
|
close: {
|
||||||
|
id: 'veryClose',
|
||||||
|
label: 'DAGGERHEART.CONFIG.fallAndCollision.close.label',
|
||||||
|
chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.close.chatTitle',
|
||||||
|
damageFormula: '1d20 + 5'
|
||||||
|
},
|
||||||
|
far: {
|
||||||
|
id: 'veryClose',
|
||||||
|
label: 'DAGGERHEART.CONFIG.fallAndCollision.far.label',
|
||||||
|
chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.far.chatTitle',
|
||||||
|
damageFormula: '1d100 + 15'
|
||||||
|
},
|
||||||
|
collision: {
|
||||||
|
id: 'veryClose',
|
||||||
|
label: 'DAGGERHEART.CONFIG.fallAndCollision.collision.label',
|
||||||
|
chatTitle: 'DAGGERHEART.CONFIG.fallAndCollision.collision.chatTitle',
|
||||||
|
damageFormula: '1d20 + 5'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,6 @@ export default class DHItem extends foundry.documents.Item {
|
||||||
actor: item.parent,
|
actor: item.parent,
|
||||||
speaker: cls.getSpeaker(),
|
speaker: cls.getSpeaker(),
|
||||||
system: systemData,
|
system: systemData,
|
||||||
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'),
|
|
||||||
content: await foundry.applications.handlebars.renderTemplate(
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||||
systemData
|
systemData
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,17 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-refresh-container {
|
.menu-options-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
.menu-refresh-inner-container {
|
.menu-options-inner-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
.experience-chip {
|
.option-chip {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "DAGGERHEART.APPLICATIONS.DaggerheartMenu.refreshFeatures"}}</legend>
|
<legend>{{localize "DAGGERHEART.APPLICATIONS.DaggerheartMenu.refreshFeatures"}}</legend>
|
||||||
|
|
||||||
<div class="menu-refresh-container">
|
<div class="menu-options-container">
|
||||||
<div class="menu-refresh-inner-container">
|
<div class="menu-options-inner-container">
|
||||||
{{#each refreshables as |type key|}}
|
{{#each refreshables as |type key|}}
|
||||||
<div class="experience-chip {{#if type.selected}}selected{{/if}}" data-action="selectRefreshable" data-type="{{key}}">
|
<div class="option-chip {{#if type.selected}}selected{{/if}}" data-action="selectRefreshable" data-type="{{key}}">
|
||||||
{{#if type.selected}}
|
{{#if type.selected}}
|
||||||
<span><i class="fa-solid fa-circle"></i></span>
|
<span><i class="fa-solid fa-circle"></i></span>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -21,4 +21,18 @@
|
||||||
<button data-action="refreshActors" {{disabled disableRefresh}}>{{localize "DAGGERHEART.GENERAL.refresh"}}</button>
|
<button data-action="refreshActors" {{disabled disableRefresh}}>{{localize "DAGGERHEART.GENERAL.refresh"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{{localize "DAGGERHEART.APPLICATIONS.DaggerheartMenu.fallingAndCollision"}} <i class="fa-solid fa-explosion fa-fw"></i></legend>
|
||||||
|
|
||||||
|
<div class="menu-options-container">
|
||||||
|
<div class="menu-options-inner-container">
|
||||||
|
{{#each fallAndCollision as |data key|}}
|
||||||
|
<button data-action="createFallCollisionDamage" data-key="{{key}}">
|
||||||
|
{{localize data.label}}
|
||||||
|
</button>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
<div class="message-header-main">
|
<div class="message-header-main">
|
||||||
<img class="actor-img" src="{{actor.img}}" />
|
<img class="actor-img" src="{{actor.img}}" />
|
||||||
<div class="message-sub-header-container">
|
<div class="message-sub-header-container">
|
||||||
|
{{#if message.title}}
|
||||||
|
<h4>{{message.title}}</h4>
|
||||||
|
<div>{{actor.name}} {{#if author.isGM}}(GM){{/if}}</div>
|
||||||
|
{{else}}
|
||||||
{{#unless actor.name}}
|
{{#unless actor.name}}
|
||||||
<h4>{{author.name}}</h4>
|
<h4>{{author.name}}</h4>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -11,10 +15,11 @@
|
||||||
<h4>{{actor.name}}</h4>
|
<h4>{{actor.name}}</h4>
|
||||||
<div>{{author.name}}</div>
|
<div>{{author.name}}</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<h4>{{ifThen message.title message.title alias}}</h4>
|
<h4>{{alias}}</h4>
|
||||||
<div>{{actor.name}} {{#if author.isGM}}(GM){{/if}}</div>
|
<div>{{actor.name}} {{#if author.isGM}}(GM){{/if}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="message-header-metadata">
|
<div class="message-header-metadata">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue