mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-24 08:23:38 +02:00
Compare commits
2 commits
42144acfe4
...
5ee86e258b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ee86e258b | ||
|
|
98a28ac7b9 |
12 changed files with 52 additions and 72 deletions
|
|
@ -108,7 +108,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
partContext.traitOptions = CONFIG.DH.ACTOR.abilities;
|
||||
|
||||
const selectedRoll = Object.values(this.party.system.tagTeam.members).find(member => member.selected);
|
||||
const critSelected = !selectedRoll ? undefined : (selectedRoll?.rollData?.options?.isCritical ?? false);
|
||||
const critSelected = !selectedRoll
|
||||
? undefined
|
||||
: (selectedRoll?.rollData?.options?.roll?.isCritical ?? false);
|
||||
|
||||
partContext.members = {};
|
||||
for (const actorId in this.party.system.tagTeam.members) {
|
||||
|
|
@ -153,7 +155,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
damage: damage,
|
||||
critDamage: critHitPointsDamage,
|
||||
useCritDamage:
|
||||
critSelected || (critSelected === undefined && data.rollData?.options?.isCritical)
|
||||
critSelected || (critSelected === undefined && data.rollData?.options?.roll?.isCritical)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -342,7 +344,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
if (!actor) return;
|
||||
|
||||
const memberData = this.party.system.tagTeam.members[memberKey];
|
||||
return await actor.traitDiceRoll(memberData.rollChoice, {
|
||||
return await actor.rollTrait(memberData.rollChoice, {
|
||||
skips: {
|
||||
createMessage: true,
|
||||
resources: true,
|
||||
|
|
@ -390,7 +392,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
});
|
||||
}
|
||||
|
||||
static async #makeDamageRoll(_, button) {
|
||||
static async #makeDamageRoll(event, button) {
|
||||
const { memberKey } = button.dataset;
|
||||
const actor = game.actors.find(x => x.id === memberKey);
|
||||
if (!actor) return;
|
||||
|
|
@ -399,6 +401,9 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
const action = await foundry.utils.fromUuid(memberData.rollChoice);
|
||||
const config = {
|
||||
...memberData.rollData.options,
|
||||
dialog: {
|
||||
configure: !event.shiftKey
|
||||
},
|
||||
skips: {
|
||||
createMessage: true,
|
||||
resources: true,
|
||||
|
|
@ -409,7 +414,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
await action.workflow.get('damage').execute(config, null, true);
|
||||
if (!config.damage) return;
|
||||
|
||||
const damage = config.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage;
|
||||
// const damage = config.roll.isCritical ? await this.getNonCriticalDamage(config, actor) : config.damage;
|
||||
|
||||
const current = this.party.system.tagTeam.members[memberKey].rollData;
|
||||
await this.updatePartyData({
|
||||
|
|
@ -417,7 +422,7 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
...current,
|
||||
options: {
|
||||
...current.options,
|
||||
damage: damage
|
||||
damage: config.damage
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -719,8 +719,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
* Rolls an attribute check based on the clicked button's dataset attribute.
|
||||
* @type {ApplicationClickAction}
|
||||
*/
|
||||
static async #rollAttribute(event, button) {
|
||||
const result = await this.document.traitDiceRoll(button.dataset.attribute);
|
||||
static async #rollAttribute(_event, button) {
|
||||
const result = await this.document.rollTrait(button.dataset.attribute);
|
||||
if (!result) return;
|
||||
|
||||
/* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ export default class DamageField extends fields.SchemaField {
|
|||
formulas = DamageField.formatFormulas.call(this, formulas, config);
|
||||
|
||||
const damageConfig = {
|
||||
dialog: {},
|
||||
...config,
|
||||
roll: formulas,
|
||||
dialog: {},
|
||||
data: this.getRollData()
|
||||
};
|
||||
delete damageConfig.evaluate;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import DamageDialog from '../applications/dialogs/damageDialog.mjs';
|
||||
import { parseRallyDice } from '../helpers/utils.mjs';
|
||||
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
|
||||
import DHRoll from './dhRoll.mjs';
|
||||
|
||||
export default class DamageRoll extends DHRoll {
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ export default class DhpActor extends Actor {
|
|||
return await rollClass.build(config);
|
||||
}
|
||||
|
||||
async traitDiceRoll(trait, options = {}) {
|
||||
async rollTrait(trait, options = {}) {
|
||||
const abilityLabel = game.i18n.localize(abilities[trait].label);
|
||||
const config = {
|
||||
event: event,
|
||||
|
|
|
|||
|
|
@ -528,7 +528,8 @@ export function expireActiveEffects(actor, allowedTypes = null) {
|
|||
|
||||
export async function getCritDamageBonus(formula) {
|
||||
const critRoll = new Roll(formula);
|
||||
return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.number, 0);
|
||||
await critRoll.evaluate();
|
||||
return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.results.filter(r => r.active).length, 0);
|
||||
}
|
||||
|
||||
export function htmlToText(html) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export const preloadHandlebarsTemplates = async function () {
|
|||
'systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs',
|
||||
'systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs',
|
||||
'systems/daggerheart/templates/dialogs/downtime/activities.hbs',
|
||||
'systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs',
|
||||
'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/description-part.hbs',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.intiator-container {
|
||||
.initiator-container {
|
||||
margin-top: 8px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@
|
|||
}
|
||||
|
||||
&::before {
|
||||
background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, @golden 100%);
|
||||
background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, light-dark(@dark-blue, @golden) 100%);
|
||||
}
|
||||
|
||||
&::after {
|
||||
background: linear-gradient(90deg, @golden 0%, rgba(0, 0, 0, 0) 100%);
|
||||
background: linear-gradient(90deg, light-dark(@dark-blue, @golden) 0%, rgba(0, 0, 0, 0) 100%);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,37 +104,6 @@
|
|||
filter: drop-shadow(0 0 8px var(--golden));
|
||||
}
|
||||
}
|
||||
|
||||
// width: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: space-evenly;
|
||||
|
||||
// .roll-button {
|
||||
// position: relative;
|
||||
// display: flex;
|
||||
// justify-content: center;
|
||||
|
||||
// .roll-label {
|
||||
// position: absolute;
|
||||
// top: 8px;
|
||||
// width: 60px;
|
||||
// text-align: center;
|
||||
// padding: 2px;
|
||||
// background: light-dark(darkblue, gold);
|
||||
// color: light-dark(white, black);
|
||||
// border-radius: 6px;
|
||||
// border: 1px solid light-dark(white, black);
|
||||
// }
|
||||
|
||||
// img {
|
||||
// height: 80px;
|
||||
// }
|
||||
// }
|
||||
|
||||
// .delete-button i {
|
||||
// font-size: 40px;
|
||||
// }
|
||||
}
|
||||
|
||||
.roll-data {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
|
||||
<div class="intiator-container {{#if initiatorDisabled}}inactive{{/if}}">
|
||||
<div class="initiator-container {{#if initiatorDisabled}}inactive{{/if}}">
|
||||
<div class="form-group">
|
||||
<label>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.FIELDS.initiator.memberId.label"}}</label>
|
||||
<div class="form-fields">
|
||||
|
|
|
|||
25
templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs
Normal file
25
templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{{#each damage as |damage key|}}
|
||||
<div class="roll-data {{#if isCritical}}critical{{/if}}">
|
||||
<div class="duality-label">
|
||||
<span>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}:</span>
|
||||
<span>{{damage.total}}</span>
|
||||
</div>
|
||||
{{#each damage.parts as |part|}}
|
||||
<div class="roll-dice-container">
|
||||
{{#each part.dice as |dice index|}}
|
||||
<a class="roll-dice" data-action="rerollDamageDice" data-member-key="{{@../../../key}}" data-damage-key="{{@../../key}}" data-part="{{@../index}}" data-dice="{{index}}">
|
||||
<span class="dice-label">{{dice.total}}</span>
|
||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" dice.dice ".svg"}}" />
|
||||
</a>
|
||||
{{#unless @last}}
|
||||
<span class="roll-operator">+</span>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
{{#if part.modifierTotal}}
|
||||
<span class="roll-operator">{{#if (gte part.modifierTotal 0)}}+{{else}}-{{/if}}</span>
|
||||
<span class="roll-value">{{positive part.modifierTotal}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
|
|
@ -107,31 +107,11 @@
|
|||
</div>
|
||||
</span>
|
||||
{{#if damage}}
|
||||
{{#each damage as |damage key|}}
|
||||
<div class="roll-data {{#if ../useCritDamage}}critical{{/if}}">
|
||||
<div class="duality-label">
|
||||
<span>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}:</span>
|
||||
<span>{{#if ../useCritDamage}}{{lookup (lookup ../critDamage key) 'total'}}{{else}}{{damage.total}}{{/if}}</span>
|
||||
</div>
|
||||
{{#each damage.parts as |part|}}
|
||||
<div class="roll-dice-container">
|
||||
{{#each part.dice as |dice index|}}
|
||||
<a class="roll-dice" data-action="rerollDamageDice" data-member-key="{{@../../../key}}" data-damage-key="{{@../../key}}" data-part="{{@../index}}" data-dice="{{index}}">
|
||||
<span class="dice-label">{{dice.total}}</span>
|
||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" dice.dice ".svg"}}" />
|
||||
</a>
|
||||
{{#unless @last}}
|
||||
<span class="roll-operator">+</span>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
{{#if part.modifierTotal}}
|
||||
<span class="roll-operator">{{#if (gte part.modifierTotal 0)}}+{{else}}-{{/if}}</span>
|
||||
<span class="roll-value">{{positive part.modifierTotal}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#if useCritDamage}}
|
||||
{{> "systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs" damage=critDamage isCritical=true }}
|
||||
{{else}}
|
||||
{{> "systems/daggerheart/templates/dialogs/tagTeamDialog/parts/tagTeamDamageParts.hbs" damage=damage }}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class="hint">{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.makeYourRoll"}}</span>
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue