mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Feature/165 action save (#231)
* Roll All Save button + Merge Attack & Roll Chat message * Fix conflicts again
This commit is contained in:
parent
b7e4169079
commit
8b834036fa
18 changed files with 369 additions and 140 deletions
|
|
@ -324,7 +324,7 @@ const preloadHandlebarsTemplates = async function () {
|
||||||
'systems/daggerheart/templates/views/actionTypes/range-target.hbs',
|
'systems/daggerheart/templates/views/actionTypes/range-target.hbs',
|
||||||
'systems/daggerheart/templates/views/actionTypes/effect.hbs',
|
'systems/daggerheart/templates/views/actionTypes/effect.hbs',
|
||||||
'systems/daggerheart/templates/settings/components/settings-item-line.hbs',
|
'systems/daggerheart/templates/settings/components/settings-item-line.hbs',
|
||||||
|
'systems/daggerheart/templates/chat/parts/damage-chat.hbs',
|
||||||
'systems/daggerheart/templates/chat/parts/target-chat.hbs'
|
'systems/daggerheart/templates/chat/parts/target-chat.hbs'
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1063,7 +1063,10 @@
|
||||||
"DamageRoll": {
|
"DamageRoll": {
|
||||||
"Title": "Damage - {damage}",
|
"Title": "Damage - {damage}",
|
||||||
"DealDamageToTargets": "Damage Hit Targets",
|
"DealDamageToTargets": "Damage Hit Targets",
|
||||||
"DealDamage": "Deal Damage"
|
"DealDamage": "Deal Damage",
|
||||||
|
"RollDamage": "Roll Damage",
|
||||||
|
"HitTarget": "Hit Targets",
|
||||||
|
"SelectedTarget": "Selected"
|
||||||
},
|
},
|
||||||
"ApplyEffect": {
|
"ApplyEffect": {
|
||||||
"Title": "Apply Effects - {name}"
|
"Title": "Apply Effects - {name}"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import DHDamageRoll from '../data/chat-message/damageRoll.mjs';
|
||||||
import D20RollDialog from '../dialogs/d20RollDialog.mjs';
|
import D20RollDialog from '../dialogs/d20RollDialog.mjs';
|
||||||
import DamageDialog from '../dialogs/damageDialog.mjs';
|
import DamageDialog from '../dialogs/damageDialog.mjs';
|
||||||
|
|
||||||
|
|
@ -53,12 +54,13 @@ export class DHRoll extends Roll {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async buildPost(roll, config, message) {
|
static async buildPost(roll, config, message) {
|
||||||
|
console.log(config)
|
||||||
for (const hook of config.hooks) {
|
for (const hook of config.hooks) {
|
||||||
if (Hooks.call(`${SYSTEM.id}.postRoll${hook.capitalize()}`, config, message) === false) return null;
|
if (Hooks.call(`${SYSTEM.id}.postRoll${hook.capitalize()}`, config, message) === false) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Chat Message
|
// Create Chat Message
|
||||||
if (message.data) {
|
if (config.source?.message) {
|
||||||
} else {
|
} else {
|
||||||
const messageData = {};
|
const messageData = {};
|
||||||
config.message = await this.toMessage(roll, config);
|
config.message = await this.toMessage(roll, config);
|
||||||
|
|
@ -393,7 +395,6 @@ export class DualityRoll extends D20Roll {
|
||||||
total: roll.dHope.total + roll.dFear.total,
|
total: roll.dHope.total + roll.dFear.total,
|
||||||
label: roll.totalLabel
|
label: roll.totalLabel
|
||||||
};
|
};
|
||||||
console.log(roll, config);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,5 +410,9 @@ export class DamageRoll extends DHRoll {
|
||||||
static async postEvaluate(roll, config = {}) {
|
static async postEvaluate(roll, config = {}) {
|
||||||
super.postEvaluate(roll, config);
|
super.postEvaluate(roll, config);
|
||||||
config.roll.type = config.type;
|
config.roll.type = config.type;
|
||||||
|
if(config.source?.message) {
|
||||||
|
const chatMessage = ui.chat.collection.get(config.source.message);
|
||||||
|
chatMessage.update({'system.damage': config});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -342,39 +342,53 @@ export const refreshTypes = {
|
||||||
export const abilityCosts = {
|
export const abilityCosts = {
|
||||||
hope: {
|
hope: {
|
||||||
id: 'hope',
|
id: 'hope',
|
||||||
label: 'Hope'
|
label: 'Hope',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
stress: {
|
stress: {
|
||||||
id: 'stress',
|
id: 'stress',
|
||||||
label: 'DAGGERHEART.HealingType.Stress.Name'
|
label: 'DAGGERHEART.HealingType.Stress.Name',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
armor: {
|
armor: {
|
||||||
id: 'armor',
|
id: 'armor',
|
||||||
label: 'Armor Stack'
|
label: 'Armor Stack',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
hp: {
|
hp: {
|
||||||
id: 'hp',
|
id: 'hp',
|
||||||
label: 'DAGGERHEART.HealingType.HitPoints.Name'
|
label: 'DAGGERHEART.HealingType.HitPoints.Name',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
prayer: {
|
prayer: {
|
||||||
id: 'prayer',
|
id: 'prayer',
|
||||||
label: 'Prayer Dice'
|
label: 'Prayer Dice',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
favor: {
|
favor: {
|
||||||
id: 'favor',
|
id: 'favor',
|
||||||
label: 'Favor Points'
|
label: 'Favor Points',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
slayer: {
|
slayer: {
|
||||||
id: 'slayer',
|
id: 'slayer',
|
||||||
label: 'Slayer Dice'
|
label: 'Slayer Dice',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
tide: {
|
tide: {
|
||||||
id: 'tide',
|
id: 'tide',
|
||||||
label: 'Tide'
|
label: 'Tide',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
},
|
},
|
||||||
chaos: {
|
chaos: {
|
||||||
id: 'chaos',
|
id: 'chaos',
|
||||||
label: 'Chaos'
|
label: 'Chaos',
|
||||||
|
group: 'TYPES.Actor.character'
|
||||||
|
},
|
||||||
|
fear: {
|
||||||
|
id: 'fear',
|
||||||
|
label: 'Fear',
|
||||||
|
group: 'TYPES.Actor.adversary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,14 +320,14 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
prepareTarget() {
|
prepareTarget() {
|
||||||
let targets;
|
let targets;
|
||||||
if (this.target?.type === SYSTEM.ACTIONS.targetTypes.self.id)
|
if (this.target?.type === SYSTEM.ACTIONS.targetTypes.self.id)
|
||||||
targets = this.formatTarget(this.actor.token ?? this.actor.prototypeToken);
|
targets = this.constructor.formatTarget(this.actor.token ?? this.actor.prototypeToken);
|
||||||
targets = Array.from(game.user.targets);
|
targets = Array.from(game.user.targets);
|
||||||
// foundry.CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
// foundry.CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
||||||
if (this.target?.type && this.target.type !== SYSTEM.ACTIONS.targetTypes.any.id) {
|
if (this.target?.type && this.target.type !== SYSTEM.ACTIONS.targetTypes.any.id) {
|
||||||
targets = targets.filter(t => this.isTargetFriendly(t));
|
targets = targets.filter(t => this.isTargetFriendly(t));
|
||||||
if (this.target.amount && targets.length > this.target.amount) targets = [];
|
if (this.target.amount && targets.length > this.target.amount) targets = [];
|
||||||
}
|
}
|
||||||
targets = targets.map(t => this.formatTarget(t));
|
targets = targets.map(t => this.constructor.formatTarget(t));
|
||||||
return targets;
|
return targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -400,11 +400,13 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasCost(costs) {
|
hasCost(costs) {
|
||||||
const realCosts = this.getRealCosts(costs);
|
const realCosts = this.getRealCosts(costs),
|
||||||
return realCosts.reduce(
|
hasFearCost = realCosts.findIndex(c => c.type === 'fear');
|
||||||
(a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value),
|
if(hasFearCost > -1) {
|
||||||
true
|
const fearCost = realCosts.splice(hasFearCost, 1);
|
||||||
);
|
if(!game.user.isGM || fearCost[0].total > game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear)) return false;
|
||||||
|
}
|
||||||
|
return realCosts.reduce((a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), true);
|
||||||
}
|
}
|
||||||
/* COST */
|
/* COST */
|
||||||
|
|
||||||
|
|
@ -435,7 +437,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatTarget(actor) {
|
static formatTarget(actor) {
|
||||||
return {
|
return {
|
||||||
id: actor.id,
|
id: actor.id,
|
||||||
actorId: actor.actor.uuid,
|
actorId: actor.actor.uuid,
|
||||||
|
|
@ -452,10 +454,11 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
/* RANGE */
|
/* RANGE */
|
||||||
|
|
||||||
/* EFFECTS */
|
/* EFFECTS */
|
||||||
async applyEffects(event, data, force = false) {
|
async applyEffects(event, data, targets) {
|
||||||
if (!this.effects?.length || !data.system.targets.length) return;
|
targets ??= data.system.targets;
|
||||||
|
if (!this.effects?.length || !targets.length) return;
|
||||||
let effects = this.effects;
|
let effects = this.effects;
|
||||||
data.system.targets.forEach(async token => {
|
targets.forEach(async token => {
|
||||||
if (!token.hit && !force) return;
|
if (!token.hit && !force) return;
|
||||||
if (this.hasSave && token.saved.success === true) {
|
if (this.hasSave && token.saved.success === true) {
|
||||||
effects = this.effects.filter(e => e.onSave === true);
|
effects = this.effects.filter(e => e.onSave === true);
|
||||||
|
|
@ -495,25 +498,19 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
/* SAVE */
|
/* SAVE */
|
||||||
async rollSave(target, event, message) {
|
async rollSave(target, event, message) {
|
||||||
if (!target?.actor) return;
|
if(!target?.actor) return;
|
||||||
target.actor
|
return target.actor.diceRoll({
|
||||||
.diceRoll({
|
event,
|
||||||
event,
|
title: 'Roll Save',
|
||||||
title: 'Roll Save',
|
roll: {
|
||||||
roll: {
|
trait: this.save.trait,
|
||||||
trait: this.save.trait,
|
difficulty: this.save.difficulty,
|
||||||
difficulty: this.save.difficulty,
|
type: "reaction"
|
||||||
type: 'reaction'
|
},
|
||||||
},
|
data: target.actor.getRollData()
|
||||||
data: target.actor.getRollData()
|
}).then(async (result) => {
|
||||||
})
|
if(result) this.updateChatMessage(message, target.id, {result: result.roll.total, success: result.roll.success});
|
||||||
.then(async result => {
|
})
|
||||||
if (result)
|
|
||||||
this.updateChatMessage(message, target.id, {
|
|
||||||
result: result.roll.total,
|
|
||||||
success: result.roll.success
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateChatMessage(message, targetId, changes, chain = true) {
|
async updateChatMessage(message, targetId, changes, chain = true) {
|
||||||
|
|
@ -539,13 +536,6 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
export class DHDamageAction extends DHBaseAction {
|
export class DHDamageAction extends DHBaseAction {
|
||||||
static extraSchemas = ['damage', 'target', 'effects'];
|
static extraSchemas = ['damage', 'target', 'effects'];
|
||||||
|
|
||||||
/* async use(event, ...args) {
|
|
||||||
const config = await super.use(event, args);
|
|
||||||
if (!config || ['error', 'warning'].includes(config.type)) return;
|
|
||||||
if (!this.directDamage) return;
|
|
||||||
return await this.rollDamage(event, config);
|
|
||||||
} */
|
|
||||||
|
|
||||||
getFormulaValue(part, data) {
|
getFormulaValue(part, data) {
|
||||||
let formulaValue = part.value;
|
let formulaValue = part.value;
|
||||||
if (this.hasRoll && part.resultBased && data.system.roll.result.duality === -1) return part.valueAlt;
|
if (this.hasRoll && part.resultBased && data.system.roll.result.duality === -1) return part.valueAlt;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
|
import { DHBaseAction } from "../action/action.mjs";
|
||||||
|
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: new fields.StringField(),
|
title: new fields.StringField(),
|
||||||
roll: new fields.DataField(),
|
roll: new fields.DataField(),
|
||||||
|
|
@ -20,6 +22,7 @@ export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
targetSelection: new fields.BooleanField({ initial: true }),
|
||||||
hasDamage: new fields.BooleanField({ initial: false }),
|
hasDamage: new fields.BooleanField({ initial: false }),
|
||||||
hasHealing: new fields.BooleanField({ initial: false }),
|
hasHealing: new fields.BooleanField({ initial: false }),
|
||||||
hasEffect: new fields.BooleanField({ initial: false }),
|
hasEffect: new fields.BooleanField({ initial: false }),
|
||||||
|
|
@ -28,11 +31,17 @@ export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
|
||||||
actor: new fields.StringField(),
|
actor: new fields.StringField(),
|
||||||
item: new fields.StringField(),
|
item: new fields.StringField(),
|
||||||
action: new fields.StringField()
|
action: new fields.StringField()
|
||||||
})
|
}),
|
||||||
|
damage: new fields.ObjectField()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get messageTemplate() {
|
get messageTemplate() {
|
||||||
return 'systems/daggerheart/templates/chat/adversary-roll.hbs';
|
return 'systems/daggerheart/templates/chat/adversary-roll.hbs';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareDerivedData() {
|
||||||
|
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||||
|
this.currentTargets = this.targetSelection !== true ? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t)) : this.targets;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export default class DHDamageRoll extends foundry.abstract.TypeDataModel {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
targetSelection: new fields.BooleanField({ initial: true }),
|
||||||
hasSave: new fields.BooleanField({ initial: false }),
|
hasSave: new fields.BooleanField({ initial: false }),
|
||||||
onSave: new fields.StringField(),
|
onSave: new fields.StringField(),
|
||||||
source: new fields.SchemaField({
|
source: new fields.SchemaField({
|
||||||
|
|
@ -34,4 +35,9 @@ export default class DHDamageRoll extends foundry.abstract.TypeDataModel {
|
||||||
get messageTemplate() {
|
get messageTemplate() {
|
||||||
return `systems/daggerheart/templates/chat/${this.messageType}-roll.hbs`;
|
return `systems/daggerheart/templates/chat/${this.messageType}-roll.hbs`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareDerivedData() {
|
||||||
|
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
|
||||||
|
this.currentTargets = this.targetSelection !== true ? Array.from(game.user.targets).map(t => DHBaseAction.formatTarget(t)) : this.targets;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,6 @@
|
||||||
const fields = foundry.data.fields;
|
import DHAdversaryRoll from "./adversaryRoll.mjs";
|
||||||
|
|
||||||
export default class DHDualityRoll extends foundry.abstract.TypeDataModel {
|
|
||||||
static dualityResult = {
|
|
||||||
hope: 1,
|
|
||||||
fear: 2,
|
|
||||||
critical: 3
|
|
||||||
};
|
|
||||||
|
|
||||||
static defineSchema() {
|
|
||||||
return {
|
|
||||||
title: new fields.StringField(),
|
|
||||||
roll: new fields.DataField({}),
|
|
||||||
targets: new fields.ArrayField(
|
|
||||||
new fields.SchemaField({
|
|
||||||
id: new fields.StringField({}),
|
|
||||||
actorId: new fields.StringField({}),
|
|
||||||
name: new fields.StringField({}),
|
|
||||||
img: new fields.StringField({}),
|
|
||||||
difficulty: new fields.NumberField({ integer: true, nullable: true }),
|
|
||||||
evasion: new fields.NumberField({ integer: true }),
|
|
||||||
hit: new fields.BooleanField({ initial: false }),
|
|
||||||
saved: new fields.SchemaField({
|
|
||||||
result: new fields.NumberField(),
|
|
||||||
success: new fields.BooleanField({ nullable: true, initial: null })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
),
|
|
||||||
costs: new fields.ArrayField(new fields.ObjectField()),
|
|
||||||
hasDamage: new fields.BooleanField({ initial: false }),
|
|
||||||
hasHealing: new fields.BooleanField({ initial: false }),
|
|
||||||
hasEffect: new fields.BooleanField({ initial: false }),
|
|
||||||
hasSave: new fields.BooleanField({ initial: false }),
|
|
||||||
source: new fields.SchemaField({
|
|
||||||
actor: new fields.StringField(),
|
|
||||||
item: new fields.StringField(),
|
|
||||||
action: new fields.StringField()
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class DHDualityRoll extends DHAdversaryRoll {
|
||||||
get messageTemplate() {
|
get messageTemplate() {
|
||||||
return 'systems/daggerheart/templates/chat/duality-roll.hbs';
|
return 'systems/daggerheart/templates/chat/duality-roll.hbs';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
0
module/data/chat-message/hitRoll.mjs
Normal file
0
module/data/chat-message/hitRoll.mjs
Normal file
|
|
@ -484,6 +484,9 @@ export default class DhpActor extends Actor {
|
||||||
let updates = { actor: { target: this, resources: {} }, armor: { target: this.system.armor, resources: {} } };
|
let updates = { actor: { target: this, resources: {} }, armor: { target: this.system.armor, resources: {} } };
|
||||||
resources.forEach(r => {
|
resources.forEach(r => {
|
||||||
switch (r.type) {
|
switch (r.type) {
|
||||||
|
case 'fear':
|
||||||
|
ui.resources.updateFear(game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear) + r.value);
|
||||||
|
break;
|
||||||
case 'armorStack':
|
case 'armorStack':
|
||||||
updates.armor.resources['system.marks.value'] = Math.max(
|
updates.armor.resources['system.marks.value'] = Math.max(
|
||||||
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
|
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
|
||||||
|
|
@ -502,7 +505,6 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.values(updates).forEach(async u => {
|
Object.values(updates).forEach(async u => {
|
||||||
console.log(updates, u);
|
|
||||||
if (Object.keys(u.resources).length > 0) {
|
if (Object.keys(u.resources).length > 0) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
await u.target.update(u.resources);
|
await u.target.update(u.resources);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
html.querySelectorAll('.target-save-container').forEach(element =>
|
html.querySelectorAll('.target-save-container').forEach(element =>
|
||||||
element.addEventListener('click', event => this.onRollSave(event, data.message))
|
element.addEventListener('click', event => this.onRollSave(event, data.message))
|
||||||
);
|
);
|
||||||
|
html.querySelectorAll('.roll-all-save-button').forEach(element =>
|
||||||
|
element.addEventListener('click', event => this.onRollAllSave(event, data.message))
|
||||||
|
);
|
||||||
html.querySelectorAll('.duality-action-effect').forEach(element =>
|
html.querySelectorAll('.duality-action-effect').forEach(element =>
|
||||||
element.addEventListener('click', event => this.onApplyEffect(event, data.message))
|
element.addEventListener('click', event => this.onApplyEffect(event, data.message))
|
||||||
);
|
);
|
||||||
|
|
@ -33,6 +36,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
element.addEventListener('mouseleave', this.unhoverTarget);
|
element.addEventListener('mouseleave', this.unhoverTarget);
|
||||||
element.addEventListener('click', this.clickTarget);
|
element.addEventListener('click', this.clickTarget);
|
||||||
});
|
});
|
||||||
|
html.querySelectorAll('.button-target-selection').forEach(element => {
|
||||||
|
element.addEventListener('click', event => this.onTargetSelection(event, data.message))
|
||||||
|
});
|
||||||
html.querySelectorAll('.damage-button').forEach(element =>
|
html.querySelectorAll('.damage-button').forEach(element =>
|
||||||
element.addEventListener('click', event => this.onDamage(event, data.message))
|
element.addEventListener('click', event => this.onDamage(event, data.message))
|
||||||
);
|
);
|
||||||
|
|
@ -107,7 +113,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
tokenId = event.target.closest('[data-token]')?.dataset.token,
|
tokenId = event.target.closest('[data-token]')?.dataset.token,
|
||||||
token = game.canvas.tokens.get(tokenId);
|
token = game.canvas.tokens.get(tokenId);
|
||||||
if (!token?.actor || !token.isOwner) return true;
|
if (!token?.actor || !token.isOwner) return true;
|
||||||
console.log(token.actor.canUserModify(game.user, 'update'));
|
|
||||||
if (message.system.source.item && message.system.source.action) {
|
if (message.system.source.item && message.system.source.action) {
|
||||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||||
if (!action || !action?.hasSave) return;
|
if (!action || !action?.hasSave) return;
|
||||||
|
|
@ -115,6 +120,14 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onRollAllSave = async (event, message) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
const targets = event.target.parentElement.querySelectorAll('.target-section > [data-token] .target-save-container');
|
||||||
|
targets.forEach((el) => {
|
||||||
|
el.dispatchEvent(new PointerEvent("click", { shiftKey: true}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onApplyEffect = async (event, message) => {
|
onApplyEffect = async (event, message) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const actor = await this.getActor(message.system.source.actor);
|
const actor = await this.getActor(message.system.source.actor);
|
||||||
|
|
@ -122,10 +135,30 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
if (message.system.source.item && message.system.source.action) {
|
if (message.system.source.item && message.system.source.action) {
|
||||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||||
if (!action || !action?.applyEffects) return;
|
if (!action || !action?.applyEffects) return;
|
||||||
await action.applyEffects(event, message);
|
const { isHit, targets } = this.getTargetList(event, message);
|
||||||
|
if (targets.length === 0)
|
||||||
|
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||||
|
await action.applyEffects(event, message, targets);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onTargetSelection = async (event, message) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
const targetSelection = Boolean(event.target.dataset.targetHit),
|
||||||
|
msg = ui.chat.collection.get(message._id);
|
||||||
|
if(msg.system.targetSelection === targetSelection) return;
|
||||||
|
if(targetSelection !== true && !Array.from(game.user.targets).length) return ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
|
||||||
|
msg.system.targetSelection = targetSelection;
|
||||||
|
msg.system.prepareDerivedData();
|
||||||
|
ui.chat.updateMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
getTargetList = (event, message) => {
|
||||||
|
const targetSelection = event.target.closest('.message-content').querySelector('.button-target-selection.target-selected'),
|
||||||
|
isHit = Boolean(targetSelection.dataset.targetHit);
|
||||||
|
return {isHit, targets: isHit ? message.system.targets.filter(t => t.hit === true).map(target => game.canvas.tokens.get(target.id)) : Array.from(game.user.targets)};
|
||||||
|
}
|
||||||
|
|
||||||
hoverTarget = event => {
|
hoverTarget = event => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const token = canvas.tokens.get(event.currentTarget.dataset.token);
|
const token = canvas.tokens.get(event.currentTarget.dataset.token);
|
||||||
|
|
@ -150,15 +183,11 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
|
|
||||||
onDamage = async (event, message) => {
|
onDamage = async (event, message) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const targets = event.currentTarget.dataset.targetHit
|
const { isHit, targets } = this.getTargetList(event, message);
|
||||||
? message.system.targets.map(target => game.canvas.tokens.get(target.id))
|
|
||||||
: Array.from(game.user.targets);
|
|
||||||
|
|
||||||
if (message.system.onSave && event.currentTarget.dataset.targetHit) {
|
if(message.system.onSave && isHit) {
|
||||||
const pendingingSaves = message.system.targets.filter(
|
const pendingingSaves = message.system.targets.filter(target => target.hit && target.saved.success === null);
|
||||||
target => target.hit && target.saved.success === null
|
if(pendingingSaves.length) {
|
||||||
);
|
|
||||||
if (pendingingSaves.length) {
|
|
||||||
const confirm = await foundry.applications.api.DialogV2.confirm({
|
const confirm = await foundry.applications.api.DialogV2.confirm({
|
||||||
window: { title: 'Pending Reaction Rolls found' },
|
window: { title: 'Pending Reaction Rolls found' },
|
||||||
content: `<p>Some Tokens still need to roll their Reaction Roll.</p><p>Are you sure you want to continue ?</p><p><i>Undone reaction rolls will be considered as failed</i></p>`
|
content: `<p>Some Tokens still need to roll their Reaction Roll.</p><p>Are you sure you want to continue ?</p><p><i>Undone reaction rolls will be considered as failed</i></p>`
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,23 @@ fieldset.daggerheart.chat {
|
||||||
border-left-width: 0;
|
border-left-width: 0;
|
||||||
border-right-width: 0;
|
border-right-width: 0;
|
||||||
border-bottom-width: 0;
|
border-bottom-width: 0;
|
||||||
|
legend {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
&:before, &:after {
|
||||||
|
content: '\f0d8';
|
||||||
|
font-family: "Font Awesome 6 Pro";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.expanded {
|
||||||
|
legend:before, legend:after {
|
||||||
|
content: '\f0d7';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.daggerheart.chat {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.daggerheart.chat {
|
.daggerheart.chat {
|
||||||
|
|
@ -209,6 +226,28 @@ fieldset.daggerheart.chat {
|
||||||
margin: -@fullMargin 0;
|
margin: -@fullMargin 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.target-selection {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
input[type="radio"] {
|
||||||
|
display: none;
|
||||||
|
&:checked + label {
|
||||||
|
text-shadow: 0px 0px 4px #CE5937;
|
||||||
|
}
|
||||||
|
&:not(:checked) + label {
|
||||||
|
opacity: .75;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: .75;
|
||||||
|
&.target-selected {
|
||||||
|
text-shadow: 0px 0px 4px #CE5937;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.target-section {
|
.target-section {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|
||||||
|
|
@ -284,6 +323,10 @@ fieldset.daggerheart.chat {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:not(.expanded) .dice-tooltip {
|
||||||
|
grid-template-rows: 0fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.domain-card {
|
&.domain-card {
|
||||||
|
|
@ -337,6 +380,17 @@ fieldset.daggerheart.chat {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
button {
|
||||||
|
&.inner-button {
|
||||||
|
--button-size: 1.25rem;
|
||||||
|
--input-height: 1.25rem;
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
margin: 5px 1px -4px auto;
|
||||||
|
&.inner-button-right {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[data-use-perm='false'] {
|
[data-use-perm='false'] {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
@ -359,6 +413,11 @@ fieldset.daggerheart.chat {
|
||||||
fieldset.daggerheart.chat {
|
fieldset.daggerheart.chat {
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
display: contents;
|
display: contents;
|
||||||
|
legend {
|
||||||
|
&:before, &:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.message-header {
|
.message-header {
|
||||||
color: var(--color-light-3);
|
color: var(--color-light-3);
|
||||||
|
|
@ -434,7 +493,7 @@ fieldset.daggerheart.chat {
|
||||||
align-items: end;
|
align-items: end;
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
.dice {
|
.dice {
|
||||||
.dice-rolls {
|
.dice-rolls.duality {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
li {
|
li {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -457,6 +516,11 @@ fieldset.daggerheart.chat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.target-selection {
|
||||||
|
label {
|
||||||
|
color: var(--color-light-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
.target-section {
|
.target-section {
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
border: 2px solid;
|
border: 2px solid;
|
||||||
|
|
@ -500,6 +564,31 @@ fieldset.daggerheart.chat {
|
||||||
margin-right: -8px;
|
margin-right: -8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.duality-result {
|
||||||
|
display: flex;
|
||||||
|
color: var(--color-light-1);
|
||||||
|
text-shadow: 0 0 1px black;
|
||||||
|
font-weight: bold;
|
||||||
|
background: var(--color-dark-1);
|
||||||
|
padding: 4px;
|
||||||
|
border-color: black;
|
||||||
|
min-height: unset;
|
||||||
|
height: 26px;
|
||||||
|
flex: unset;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
align-self: center;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
&.inner-button {
|
||||||
|
color: var(--color-light-1);
|
||||||
|
text-shadow: 0 0 1px black;
|
||||||
|
font-weight: bold;
|
||||||
|
background: var(--color-dark-1);
|
||||||
|
border-color: black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1406,6 +1406,23 @@ fieldset.daggerheart.chat {
|
||||||
border-right-width: 0;
|
border-right-width: 0;
|
||||||
border-bottom-width: 0;
|
border-bottom-width: 0;
|
||||||
}
|
}
|
||||||
|
fieldset.daggerheart.chat legend {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
fieldset.daggerheart.chat legend:before,
|
||||||
|
fieldset.daggerheart.chat legend:after {
|
||||||
|
content: '\f0d8';
|
||||||
|
font-family: "Font Awesome 6 Pro";
|
||||||
|
}
|
||||||
|
fieldset.daggerheart.chat.expanded legend:before,
|
||||||
|
fieldset.daggerheart.chat.expanded legend:after {
|
||||||
|
content: '\f0d7';
|
||||||
|
}
|
||||||
|
fieldset.daggerheart.chat .daggerheart.chat {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
.daggerheart.chat.downtime {
|
.daggerheart.chat.downtime {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -1538,6 +1555,27 @@ fieldset.daggerheart.chat {
|
||||||
font-variant: all-small-caps;
|
font-variant: all-small-caps;
|
||||||
margin: -8px 0;
|
margin: -8px 0;
|
||||||
}
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection input[type="radio"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection input[type="radio"]:checked + label {
|
||||||
|
text-shadow: 0px 0px 4px #CE5937;
|
||||||
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection input[type="radio"]:not(:checked) + label {
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection label {
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
.daggerheart.chat.roll .target-selection label.target-selected {
|
||||||
|
text-shadow: 0px 0px 4px #CE5937;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
.daggerheart.chat.roll .target-section {
|
.daggerheart.chat.roll .target-section {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
@ -1599,6 +1637,9 @@ fieldset.daggerheart.chat {
|
||||||
.daggerheart.chat.roll .dice-result .duality-action {
|
.daggerheart.chat.roll .dice-result .duality-action {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
.daggerheart.chat.roll:not(.expanded) .dice-tooltip {
|
||||||
|
grid-template-rows: 0fr;
|
||||||
|
}
|
||||||
.daggerheart.chat.domain-card {
|
.daggerheart.chat.domain-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -1642,6 +1683,15 @@ fieldset.daggerheart.chat {
|
||||||
.daggerheart.chat.domain-card img {
|
.daggerheart.chat.domain-card img {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
.daggerheart.chat button.inner-button {
|
||||||
|
--button-size: 1.25rem;
|
||||||
|
--input-height: 1.25rem;
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
margin: 5px 1px -4px auto;
|
||||||
|
}
|
||||||
|
.daggerheart.chat button.inner-button.inner-button-right {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
.daggerheart.chat [data-use-perm='false'] {
|
.daggerheart.chat [data-use-perm='false'] {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
|
|
@ -1660,6 +1710,10 @@ fieldset.daggerheart.chat {
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
display: contents;
|
display: contents;
|
||||||
}
|
}
|
||||||
|
.theme-colorful .chat-message.duality fieldset.daggerheart.chat legend:before,
|
||||||
|
.theme-colorful .chat-message.duality fieldset.daggerheart.chat legend:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.theme-colorful .chat-message.duality .message-header {
|
.theme-colorful .chat-message.duality .message-header {
|
||||||
color: var(--color-light-3);
|
color: var(--color-light-3);
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
|
@ -1732,10 +1786,10 @@ fieldset.daggerheart.chat {
|
||||||
align-items: end;
|
align-items: end;
|
||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
}
|
}
|
||||||
.theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls {
|
.theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls.duality {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls li {
|
.theme-colorful .chat-message.duality .message-content .dice-result .dice-tooltip .wrapper .tooltip-part .dice .dice-rolls.duality li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
@ -1751,6 +1805,9 @@ fieldset.daggerheart.chat {
|
||||||
text-shadow: 0 0 1px black;
|
text-shadow: 0 0 1px black;
|
||||||
font-size: var(--font-size-16);
|
font-size: var(--font-size-16);
|
||||||
}
|
}
|
||||||
|
.theme-colorful .chat-message.duality .message-content .dice-result .target-selection label {
|
||||||
|
color: var(--color-light-1);
|
||||||
|
}
|
||||||
.theme-colorful .chat-message.duality .message-content .dice-result .target-section {
|
.theme-colorful .chat-message.duality .message-content .dice-result .target-section {
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
border: 2px solid;
|
border: 2px solid;
|
||||||
|
|
@ -1794,6 +1851,29 @@ fieldset.daggerheart.chat {
|
||||||
border-radius: 6px 0 0 0;
|
border-radius: 6px 0 0 0;
|
||||||
margin-right: -8px;
|
margin-right: -8px;
|
||||||
}
|
}
|
||||||
|
.theme-colorful .chat-message.duality .message-content .dice-result .duality-result {
|
||||||
|
display: flex;
|
||||||
|
color: var(--color-light-1);
|
||||||
|
text-shadow: 0 0 1px black;
|
||||||
|
font-weight: bold;
|
||||||
|
background: var(--color-dark-1);
|
||||||
|
padding: 4px;
|
||||||
|
border-color: black;
|
||||||
|
min-height: unset;
|
||||||
|
height: 26px;
|
||||||
|
flex: unset;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
align-self: center;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.theme-colorful .chat-message.duality button.inner-button {
|
||||||
|
color: var(--color-light-1);
|
||||||
|
text-shadow: 0 0 1px black;
|
||||||
|
font-weight: bold;
|
||||||
|
background: var(--color-dark-1);
|
||||||
|
border-color: black;
|
||||||
|
}
|
||||||
.daggerheart.sheet.feature .editable {
|
.daggerheart.sheet.feature .editable {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,30 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<fieldset class="dice-roll daggerheart chat roll expanded{{#unless damage.roll}} hidden{{/unless}}" data-action="expandRoll">
|
||||||
|
<legend class="dice-flavor">Damage</legend>
|
||||||
|
<div class="dice-result">
|
||||||
|
<div class="dice-tooltip">
|
||||||
|
<div class="wrapper">
|
||||||
|
{{> 'systems/daggerheart/templates/chat/parts/damage-chat.hbs' damage=damage noTitle=true}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
||||||
{{#if hasDamage}}
|
{{#if hasDamage}}
|
||||||
<div class="dice-roll daggerheart chat roll">
|
<div class="dice-roll daggerheart chat roll">
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="flexrow">
|
{{#if damage.roll}}
|
||||||
<button class="duality-action duality-action-damage" data-value="{{roll.total}}"><span>Roll Damage</span></button>
|
<div class="dice-actions">
|
||||||
|
{{!-- <button class="damage-button" data-target-hit="true" {{#if (eq targets.length 0)}}disabled{{/if}}>{{localize "DAGGERHEART.Chat.DamageRoll.DealDamageToTargets"}}</button> --}}
|
||||||
|
<button class="damage-button">{{localize "DAGGERHEART.Chat.DamageRoll.DealDamage"}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<button class="duality-action duality-action-damage" data-value="{{roll.total}}"><span>{{localize "DAGGERHEART.Chat.DamageRoll.RollDamage"}}</span></button>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -1,29 +1,4 @@
|
||||||
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
{{> 'systems/daggerheart/templates/chat/parts/damage-chat.hbs' damage=this}}
|
||||||
<div class="dice-flavor">{{title}}</div>
|
|
||||||
<div class="dice-result">
|
|
||||||
<div class="dice-formula">{{roll.formula}}</div>
|
|
||||||
<div class="dice-tooltip">
|
|
||||||
<div class="wrapper">
|
|
||||||
<section class="tooltip-part">
|
|
||||||
{{#each roll.dice}}
|
|
||||||
<div class="dice">
|
|
||||||
<header class="part-header flexrow">
|
|
||||||
<span class="part-formula">{{formula}}</span>
|
|
||||||
<span class="part-total">{{total}}</span>
|
|
||||||
</header>
|
|
||||||
<ol class="dice-rolls">
|
|
||||||
{{#each results}}
|
|
||||||
<li class="roll die {{../denomination}} min">{{result}}</li>
|
|
||||||
{{/each}}
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="dice-total">{{roll.total}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
||||||
<div class="dice-roll daggerheart chat roll">
|
<div class="dice-roll daggerheart chat roll">
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
|
|
|
||||||
|
|
@ -94,12 +94,26 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<fieldset class="dice-roll daggerheart chat roll expanded{{#unless damage.roll}} hidden{{/unless}}" data-action="expandRoll">
|
||||||
|
<legend class="dice-flavor">Damage</legend>
|
||||||
|
<div class="dice-result">
|
||||||
|
<div class="dice-tooltip">
|
||||||
|
<div class="wrapper">
|
||||||
|
{{> 'systems/daggerheart/templates/chat/parts/damage-chat.hbs' damage=damage noTitle=true}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
{{> 'systems/daggerheart/templates/chat/parts/target-chat.hbs'}}
|
||||||
<div class="dice-roll daggerheart chat roll">
|
<div class="dice-roll daggerheart chat roll">
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="dice-actions{{#unless (or hasDamage hasHealing)}} duality-alone{{/unless}}">
|
<div class="dice-actions{{#unless (or hasDamage hasHealing)}} duality-alone{{/unless}}">
|
||||||
{{#if hasDamage}}
|
{{#if hasDamage}}
|
||||||
|
{{#if damage.roll}}
|
||||||
|
<button class="duality-action damage-button" data-target-hit="true" data-value="{{roll.total}}"><span>Deal Damage</span></button>
|
||||||
|
{{else}}
|
||||||
<button class="duality-action duality-action-damage" data-value="{{roll.total}}"><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollDamage"}}</span></button>
|
<button class="duality-action duality-action-damage" data-value="{{roll.total}}"><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollDamage"}}</span></button>
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if hasHealing}}
|
{{#if hasHealing}}
|
||||||
<button class="duality-action duality-action-healing" data-value="{{roll.total}}"><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollHealing"}}</span></button>
|
<button class="duality-action duality-action-healing" data-value="{{roll.total}}"><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollHealing"}}</span></button>
|
||||||
|
|
|
||||||
27
templates/chat/parts/damage-chat.hbs
Normal file
27
templates/chat/parts/damage-chat.hbs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<div class="dice-roll daggerheart chat roll" data-action="expandRoll">
|
||||||
|
{{#unless noTitle}}<div class="dice-flavor">{{damage.title}}</div>{{/unless}}
|
||||||
|
<div class="dice-result">
|
||||||
|
<div class="dice-formula">{{damage.roll.formula}}</div>
|
||||||
|
<div class="dice-tooltip">
|
||||||
|
<div class="wrapper">
|
||||||
|
<section class="tooltip-part">
|
||||||
|
{{#each damage.roll.dice}}
|
||||||
|
<div class="dice">
|
||||||
|
<header class="part-header flexrow">
|
||||||
|
<span class="part-formula">{{formula}}</span>
|
||||||
|
<span class="part-total">{{total}}</span>
|
||||||
|
</header>
|
||||||
|
<ol class="dice-rolls">
|
||||||
|
{{#each results}}
|
||||||
|
<li class="roll die {{../dice}} min">{{result}}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
<div class="duality-result">Total: {{damage.roll.total}}</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dice-total">{{damage.roll.total}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1,22 +1,29 @@
|
||||||
{{#if (gt targets.length 0)}}
|
{{#if (gt currentTargets.length 0)}}
|
||||||
<fieldset class="dice-roll daggerheart chat roll expanded" data-action="expandRoll">
|
<fieldset class="dice-roll daggerheart chat roll expanded" data-action="expandRoll">
|
||||||
<legend class="dice-flavor">Targets</legend>
|
<legend class="dice-flavor">Targets</legend>
|
||||||
<div class="dice-result">
|
<div class="dice-result">
|
||||||
<div class="dice-tooltip">
|
<div class="dice-tooltip">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
<div class="target-selection">
|
||||||
|
<label class="button-target-selection{{#if @root.targetSelection}} target-selected{{/if}}" data-target-hit="true">{{localize "DAGGERHEART.Chat.DamageRoll.HitTarget"}}</label>
|
||||||
|
<label class="button-target-selection{{#unless @root.targetSelection}} target-selected{{/unless}}">{{localize "DAGGERHEART.Chat.DamageRoll.SelectedTarget"}}</label>
|
||||||
|
</div>
|
||||||
|
{{#if (and hasSave @root.targetSelection @root.hasHitTarget)}}
|
||||||
|
<button class="inner-button inner-button-right roll-all-save-button">Roll All <i class="fa-solid fa-shield"></i></button>
|
||||||
|
{{/if}}
|
||||||
<div class="target-section">
|
<div class="target-section">
|
||||||
{{#each targets as |target|}}
|
{{#each currentTargets as |target|}}
|
||||||
<div class="dice-total target-container {{#if target.hit}}hit{{else}}{{#if (not ../total.alternate)}}miss{{/if}}{{/if}}" data-token="{{target.id}}">
|
<div class="dice-total target-container {{#if target.hit}}hit{{else}}{{#if (not ../total.alternate)}}miss{{/if}}{{/if}}" data-token="{{target.id}}">
|
||||||
<img src="{{target.img}}" />
|
<img src="{{target.img}}" />
|
||||||
<div class="target-inner-container">
|
<div class="target-inner-container">
|
||||||
{{#if ../directDamage}}
|
{{#if (or ../directDamage (not @root.targetSelection))}}
|
||||||
<div data-perm-id="{{target.actorId}}"><span>{{target.name}}</span></div>
|
<div data-perm-id="{{target.actorId}}"><span>{{target.name}}</span></div>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}}
|
{{#if target.hit}}{{localize "Hit"}}{{else}}{{#if (not ../total.alternate)}}{{localize "Miss"}}{{else}}?{{/if}}{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{#if ../hasSave}}
|
{{#if (and ../hasSave target.hit @root.targetSelection)}}
|
||||||
<button class="target-save-container{{#if target.saved.result includeZero=true}} is-rolled{{/if}}"{{#unless target.hit}} style="visibility: hidden;"{{/unless}} data-perm-id="{{target.actorId}}">
|
<button class="target-save-container{{#if target.saved.result includeZero=true}} is-rolled{{/if}}" data-perm-id="{{target.actorId}}">
|
||||||
{{!-- {{target.saved.result}} --}}
|
{{!-- {{target.saved.result}} --}}
|
||||||
<i class="fa-solid {{#if target.saved.result includeZero=true}}{{#if target.saved.success}}fa-check{{else}}fa-xmark{{/if}}{{else}}fa-shield{{/if}}">
|
<i class="fa-solid {{#if target.saved.result includeZero=true}}{{#if target.saved.success}}fa-check{{else}}fa-xmark{{/if}}{{else}}fa-shield{{/if}}">
|
||||||
</i>
|
</i>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue