166 - Damage Reduction (#180)

* Temp

* Fixed Stress Reductions

* Changed from index based to object
This commit is contained in:
WBHarry 2025-06-24 23:36:02 +02:00 committed by GitHub
parent e1dd59454c
commit 5dafdaafcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1688 additions and 1013 deletions

View file

@ -16,7 +16,7 @@ import Resources from './module/applications/resources.mjs';
import { NarrativeCountdowns, registerCountdownApplicationHooks } from './module/applications/countdowns.mjs'; import { NarrativeCountdowns, registerCountdownApplicationHooks } from './module/applications/countdowns.mjs';
import DHDualityRoll from './module/data/chat-message/dualityRoll.mjs'; import DHDualityRoll from './module/data/chat-message/dualityRoll.mjs';
import { DualityRollColor } from './module/data/settings/Appearance.mjs'; import { DualityRollColor } from './module/data/settings/Appearance.mjs';
import { DHRoll, DualityRoll, D20Roll, DamageRoll, DualityDie } from './module/applications/roll.mjs' import { DHRoll, DualityRoll, D20Roll, DamageRoll, DualityDie } from './module/applications/roll.mjs';
import { DhMeasuredTemplate } from './module/placeables/_module.mjs'; import { DhMeasuredTemplate } from './module/placeables/_module.mjs';
import { renderDualityButton } from './module/enrichers/DualityRollEnricher.mjs'; import { renderDualityButton } from './module/enrichers/DualityRollEnricher.mjs';
import { renderMeasuredTemplate } from './module/enrichers/TemplateEnricher.mjs'; import { renderMeasuredTemplate } from './module/enrichers/TemplateEnricher.mjs';

View file

@ -207,6 +207,12 @@
"Session": "Session", "Session": "Session",
"Shortrest": "Short Rest", "Shortrest": "Short Rest",
"Longrest": "Long Rest" "Longrest": "Long Rest"
},
"Damage": {
"Severe": "Severe",
"Major": "Major",
"Minor": "Minor",
"None": "None"
} }
}, },
"ActionType": { "ActionType": {
@ -1084,6 +1090,20 @@
"Title": "Ownership Selection - {name}", "Title": "Ownership Selection - {name}",
"Default": "Default Ownership" "Default": "Default Ownership"
}, },
"DamageReduction": {
"Title": "Damage Reduction",
"ArmorMarks": "Armor Marks",
"UsedMarks": "Used Marks",
"Stress": "Stress",
"ArmorWithStress": "Spend 1 stress to use an extra mark",
"UnncessaryStress": "You don't need to expend stress",
"StressReduction": "Reduce By Stress",
"Notifications": {
"DamageAlreadyNone": "The damage has already been reduced to none",
"NoAvailableArmorMarks": "You have no more available armor marks",
"DamageIgnore": "{character} did not take damage"
}
},
"Sheets": { "Sheets": {
"PC": { "PC": {
"Name": "Name", "Name": "Name",

View file

@ -60,11 +60,12 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
context.tabs = this._getTabs(); context.tabs = this._getTabs();
context.config = SYSTEM; context.config = SYSTEM;
if (!!this.action.effects) context.effects = this.action.effects.map(e => this.action.item.effects.get(e._id)); if (!!this.action.effects) context.effects = this.action.effects.map(e => this.action.item.effects.get(e._id));
if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack') context.hasBaseDamage = !!this.action.parent.damage; if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack')
context.hasBaseDamage = !!this.action.parent.damage;
context.getRealIndex = this.getRealIndex.bind(this); context.getRealIndex = this.getRealIndex.bind(this);
context.disableOption = this.disableOption.bind(this); context.disableOption = this.disableOption.bind(this);
context.isNPC = this.action.actor.type !== 'character'; context.isNPC = this.action.actor.type !== 'character';
return context; return context;
} }
@ -76,9 +77,9 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
disableOption(index, options, choices) { disableOption(index, options, choices) {
const filtered = foundry.utils.deepClone(options); const filtered = foundry.utils.deepClone(options);
Object.keys(filtered).forEach(o => { Object.keys(filtered).forEach(o => {
if(choices.find((c, idx) => c.type === o && index !== idx)) delete filtered[o]; if (choices.find((c, idx) => c.type === o && index !== idx)) delete filtered[o];
}); });
return filtered return filtered;
} }
getRealIndex(index) { getRealIndex(index) {
@ -99,14 +100,16 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
data = foundry.utils.expandObject(foundry.utils.mergeObject(this.action.toObject(), submitData)), data = foundry.utils.expandObject(foundry.utils.mergeObject(this.action.toObject(), submitData)),
container = foundry.utils.getProperty(this.action.parent, this.action.systemPath); container = foundry.utils.getProperty(this.action.parent, this.action.systemPath);
let newActions; let newActions;
if(Array.isArray(container)) { if (Array.isArray(container)) {
newActions = foundry.utils.getProperty(this.action.parent, this.action.systemPath).map(x => x.toObject()); // Find better way newActions = foundry.utils.getProperty(this.action.parent, this.action.systemPath).map(x => x.toObject()); // Find better way
if (!newActions.findSplice(x => x._id === data._id, data)) newActions.push(data); if (!newActions.findSplice(x => x._id === data._id, data)) newActions.push(data);
} else newActions = data; } else newActions = data;
const updates = await this.action.parent.parent.update({ [`system.${this.action.systemPath}`]: newActions }); const updates = await this.action.parent.parent.update({ [`system.${this.action.systemPath}`]: newActions });
if (!updates) return; if (!updates) return;
this.action = Array.isArray(container) ? foundry.utils.getProperty(updates.system, this.action.systemPath)[this.action.index] : foundry.utils.getProperty(updates.system, this.action.systemPath); this.action = Array.isArray(container)
? foundry.utils.getProperty(updates.system, this.action.systemPath)[this.action.index]
: foundry.utils.getProperty(updates.system, this.action.systemPath);
this.render(); this.render();
} }

View file

@ -42,7 +42,7 @@ export default class CostSelectionDialog extends HandlebarsApplicationMixin(Appl
} }
async _prepareContext(_options) { async _prepareContext(_options) {
console.log(this.costs) console.log(this.costs);
const updatedCosts = this.action.calcCosts(this.costs), const updatedCosts = this.action.calcCosts(this.costs),
updatedUses = this.action.calcUses(this.uses); updatedUses = this.action.calcUses(this.uses);
return { return {
@ -56,12 +56,12 @@ export default class CostSelectionDialog extends HandlebarsApplicationMixin(Appl
const data = foundry.utils.expandObject(formData.object); const data = foundry.utils.expandObject(formData.object);
this.costs = foundry.utils.mergeObject(this.costs, data.costs); this.costs = foundry.utils.mergeObject(this.costs, data.costs);
this.uses = foundry.utils.mergeObject(this.uses, data.uses); this.uses = foundry.utils.mergeObject(this.uses, data.uses);
this.render(true) this.render(true);
} }
static sendCost(event) { static sendCost(event) {
event.preventDefault(); event.preventDefault();
this.resolve({ costs: this.action.getRealCosts(this.costs), uses: this.uses}); this.resolve({ costs: this.action.getRealCosts(this.costs), uses: this.uses });
this.close(); this.close();
} }
} }

View file

@ -0,0 +1,202 @@
import { damageKeyToNumber, getDamageLabel } from '../helpers/utils.mjs';
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
export default class DamageReductionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(resolve, reject, actor, damage) {
super({});
this.resolve = resolve;
this.reject = reject;
this.actor = actor;
this.damage = damage;
const maxArmorMarks = Math.min(
actor.system.armorScore - actor.system.armor.system.marks.value,
actor.system.rules.maxArmorMarked.total
);
const armor = [...Array(maxArmorMarks).keys()].reduce((acc, _) => {
acc[foundry.utils.randomID()] = { selected: false };
return acc;
}, {});
const stress = [...Array(actor.system.rules.maxArmorMarked.stressExtra ?? 0).keys()].reduce((acc, _) => {
acc[foundry.utils.randomID()] = { selected: false };
return acc;
}, {});
this.marks = { armor, stress };
this.availableStressReductions = Object.keys(actor.system.rules.stressDamageReduction).reduce((acc, key) => {
const dr = actor.system.rules.stressDamageReduction[key];
if (dr.enabled) {
if (acc === null) acc = {};
const damage = damageKeyToNumber(key);
acc[damage] = {
cost: dr.cost,
selected: false,
from: getDamageLabel(damage),
to: getDamageLabel(damage - 1)
};
}
return acc;
}, null);
}
get title() {
return game.i18n.localize('DAGGERHEART.DamageReduction.Title');
}
static DEFAULT_OPTIONS = {
tag: 'form',
classes: ['daggerheart', 'views', 'damage-reduction'],
position: {
width: 240,
height: 'auto'
},
actions: {
setMarks: this.setMarks,
useStressReduction: this.useStressReduction,
takeDamage: this.takeDamage
},
form: {
handler: this.updateData,
submitOnChange: true,
closeOnSubmit: false
}
};
/** @override */
static PARTS = {
damageSelection: {
id: 'damageReduction',
template: 'systems/daggerheart/templates/views/damageReduction.hbs'
}
};
/* -------------------------------------------- */
/** @inheritDoc */
get title() {
return `Damage Options`;
}
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
const { selectedArmorMarks, selectedStressMarks, stressReductions, currentMarks, currentDamage } =
this.getDamageInfo();
context.armorScore = this.actor.system.armorScore;
context.armorMarks = currentMarks;
context.basicMarksUsed = selectedArmorMarks.length === this.actor.system.rules.maxArmorMarked.total;
const stressReductionStress = this.availableStressReductions
? stressReductions.reduce((acc, red) => acc + red.cost, 0)
: 0;
context.stress =
selectedStressMarks.length > 0 || this.availableStressReductions
? {
value:
this.actor.system.resources.stress.value + selectedStressMarks.length + stressReductionStress,
maxTotal: this.actor.system.resources.stress.maxTotal
}
: null;
context.marks = this.marks;
context.availableStressReductions = this.availableStressReductions;
context.damage = getDamageLabel(this.damage);
context.reducedDamage = currentDamage !== this.damage ? getDamageLabel(currentDamage) : null;
context.currentDamage = context.reducedDamage ?? context.damage;
return context;
}
static updateData(event, _, formData) {
const form = foundry.utils.expandObject(formData.object);
this.render(true);
}
getDamageInfo = () => {
const selectedArmorMarks = Object.values(this.marks.armor).filter(x => x.selected);
const selectedStressMarks = Object.values(this.marks.stress).filter(x => x.selected);
const stressReductions = Object.values(this.availableStressReductions).filter(red => red.selected);
const currentMarks =
this.actor.system.armor.system.marks.value + selectedArmorMarks.length + selectedStressMarks.length;
const currentDamage =
this.damage - selectedArmorMarks.length - selectedStressMarks.length - stressReductions.length;
return { selectedArmorMarks, selectedStressMarks, stressReductions, currentMarks, currentDamage };
};
static setMarks(_, target) {
const currentMark = this.marks[target.dataset.type][target.dataset.key];
const { selectedStressMarks, stressReductions, currentMarks, currentDamage } = this.getDamageInfo();
if (!currentMark.selected && currentDamage === 0) {
ui.notifications.info(game.i18n.localize('DAGGERHEART.DamageReduction.Notifications.DamageAlreadyNone'));
return;
}
if (!currentMark.selected && currentMarks === this.actor.system.armorScore) {
ui.notifications.info(
game.i18n.localize('DAGGERHEART.DamageReduction.Notifications.NoAvailableArmorMarks')
);
return;
}
if (currentMark.selected) {
const currentDamageLabel = getDamageLabel(currentDamage);
for (let reduction of stressReductions) {
if (reduction.selected && reduction.to === currentDamageLabel) {
reduction.selected = false;
}
}
if (target.dataset.type === 'armor' && selectedStressMarks.length > 0) {
selectedStressMarks.forEach(mark => (mark.selected = false));
}
}
currentMark.selected = !currentMark.selected;
this.render();
}
static useStressReduction(_, target) {
const damageValue = Number(target.dataset.reduction);
const stressReduction = this.availableStressReductions[damageValue];
const { currentDamage } = this.getDamageInfo();
if (stressReduction.selected) {
stressReduction.selected = false;
this.render();
} else {
const reducedDamage = currentDamage !== this.damage ? getDamageLabel(currentDamage) : null;
const currentDamageLabel = reducedDamage ?? getDamageLabel(this.damage);
if (stressReduction.from !== currentDamageLabel) return;
stressReduction.selected = true;
this.render();
}
}
static async takeDamage() {
const { selectedArmorMarks, selectedStressMarks, stressReductions, currentDamage } = this.getDamageInfo();
const armorSpent = selectedArmorMarks.length + selectedStressMarks.length;
const stressSpent = selectedStressMarks.length + stressReductions.reduce((acc, red) => acc + red.cost, 0);
this.resolve({ modifiedDamage: currentDamage, armorSpent, stressSpent });
await this.close(true);
}
async close(fromSave) {
if (!fromSave) {
this.reject();
}
await super.close({});
}
}

View file

@ -11,61 +11,65 @@ export class DHRoll extends Roll {
super(formula, data, options); super(formula, data, options);
} }
static async build(config={}, message={}) { static async build(config = {}, message = {}) {
const roll = await this.buildConfigure(config, message); const roll = await this.buildConfigure(config, message);
if(!roll) return; if (!roll) return;
await this.buildEvaluate(roll, config, message={}); await this.buildEvaluate(roll, config, (message = {}));
await this.buildPost(roll, config, message={}); await this.buildPost(roll, config, (message = {}));
return roll; return roll;
} }
static async buildConfigure(config={}, message={}) { static async buildConfigure(config = {}, message = {}) {
config.hooks = [...(config.hooks ?? []), ""]; config.hooks = [...(config.hooks ?? []), ''];
config.dialog ??= {}; config.dialog ??= {};
for ( const hook of config.hooks ) { for (const hook of config.hooks) {
if ( Hooks.call(`${SYSTEM.id}.preRoll${hook.capitalize()}`, config, message) === false ) return null; if (Hooks.call(`${SYSTEM.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;
} }
this.applyKeybindings(config); this.applyKeybindings(config);
if(config.dialog.configure !== false) { // let roll;
// if(config.dialog?.configure === false) {
// roll = new this('', config.actor, config);
// } else {
if (config.dialog.configure !== false) {
// Open Roll Dialog // Open Roll Dialog
const DialogClass = config.dialog?.class ?? this.DefaultDialog; const DialogClass = config.dialog?.class ?? this.DefaultDialog;
config = await DialogClass.configure(config, message); config = await DialogClass.configure(config, message);
if(!config) return; if (!config) return;
} }
let roll = new this(config.formula, config.data, config); let roll = new this(config.formula, config.data, config);
for ( const hook of config.hooks ) { for (const hook of config.hooks) {
if ( Hooks.call(`${SYSTEM.id}.post${hook.capitalize()}RollConfiguration`, roll, config, message) === false ) return []; if (Hooks.call(`${SYSTEM.id}.post${hook.capitalize()}RollConfiguration`, roll, config, message) === false)
return [];
} }
return roll; return roll;
} }
static async buildEvaluate(roll, config={}, message={}) { static async buildEvaluate(roll, config = {}, message = {}) {
if(config.evaluate !== false) await roll.evaluate(); if (config.evaluate !== false) await roll.evaluate();
this.postEvaluate(roll, config); this.postEvaluate(roll, config);
} }
static async buildPost(roll, config, message) {
for ( const hook of config.hooks ) {
if ( Hooks.call(`${SYSTEM.id}.postRoll${hook.capitalize()}`, config, message) === false ) return null;
}
// Create Chat Message
if(message.data) {
static async buildPost(roll, config, message) {
for (const hook of config.hooks) {
if (Hooks.call(`${SYSTEM.id}.postRoll${hook.capitalize()}`, config, message) === false) return null;
}
// Create Chat Message
if (message.data) {
} else { } else {
const messageData = {}; const messageData = {};
await this.toMessage(roll, config); await this.toMessage(roll, config);
} }
} }
static async postEvaluate(roll, config={}) {} static async postEvaluate(roll, config = {}) {}
static async toMessage(roll, config) { static async toMessage(roll, config) {
const cls = getDocumentClass("ChatMessage"), const cls = getDocumentClass('ChatMessage'),
msg = { msg = {
type: this.messageType, type: this.messageType,
user: game.user.id, user: game.user.id,
@ -89,13 +93,13 @@ export class DHRoll extends Roll {
// D20Die // D20Die
export class DualityDie extends foundry.dice.terms.Die { export class DualityDie extends foundry.dice.terms.Die {
constructor({ number=1, faces=12, ...args }={}) { constructor({ number = 1, faces = 12, ...args } = {}) {
super({ number, faces, ...args }); super({ number, faces, ...args });
} }
} }
export class D20Roll extends DHRoll { export class D20Roll extends DHRoll {
constructor(formula, data={}, options={}) { constructor(formula, data = {}, options = {}) {
super(formula, data, options); super(formula, data, options);
this.createBaseDice(); this.createBaseDice();
this.configureModifiers(); this.configureModifiers();
@ -113,21 +117,21 @@ export class D20Roll extends DHRoll {
// static messageTemplate = 'systems/daggerheart/templates/chat/adversary-roll.hbs'; // static messageTemplate = 'systems/daggerheart/templates/chat/adversary-roll.hbs';
static messageTemplate = async (config) => { static messageTemplate = async config => {
return 'systems/daggerheart/templates/chat/adversary-roll.hbs'; return 'systems/daggerheart/templates/chat/adversary-roll.hbs';
} };
static CRITICAL_TRESHOLD = 20; static CRITICAL_TRESHOLD = 20;
static DefaultDialog = D20RollDialog; static DefaultDialog = D20RollDialog;
get d20() { get d20() {
if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) this.createBaseDice(); if (!(this.terms[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.terms[0]; return this.terms[0];
} }
set d20(faces) { set d20(faces) {
if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) this.createBaseDice(); if (!(this.terms[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
this.terms[0].faces = faces; this.terms[0].faces = faces;
} }
@ -136,7 +140,7 @@ export class D20Roll extends DHRoll {
} }
get isCritical() { get isCritical() {
if ( !this.d20._evaluated ) return; if (!this.d20._evaluated) return;
return this.d20.total >= this.constructor.CRITICAL_TRESHOLD; return this.d20.total >= this.constructor.CRITICAL_TRESHOLD;
} }
@ -154,75 +158,78 @@ export class D20Roll extends DHRoll {
advantage: config.event.altKey, advantage: config.event.altKey,
disadvantage: config.event.ctrlKey disadvantage: config.event.ctrlKey
}; };
// Should the roll configuration dialog be displayed? // Should the roll configuration dialog be displayed?
config.dialog.configure ??= !Object.values(keys).some(k => k); config.dialog.configure ??= !Object.values(keys).some(k => k);
// Determine advantage mode // Determine advantage mode
const advantage = config.advantage || keys.advantage; const advantage = config.advantage || keys.advantage;
const disadvantage = config.disadvantage || keys.disadvantage; const disadvantage = config.disadvantage || keys.disadvantage;
if ( advantage && !disadvantage ) config.advantage = this.ADV_MODE.ADVANTAGE; if (advantage && !disadvantage) config.advantage = this.ADV_MODE.ADVANTAGE;
else if ( !advantage && disadvantage ) config.advantage = this.ADV_MODE.DISADVANTAGE; else if (!advantage && disadvantage) config.advantage = this.ADV_MODE.DISADVANTAGE;
else config.advantage = this.ADV_MODE.NORMAL; else config.advantage = this.ADV_MODE.NORMAL;
} }
createBaseDice() { createBaseDice() {
if ( this.terms[0] instanceof foundry.dice.terms.Die ) return; if (this.terms[0] instanceof foundry.dice.terms.Die) return;
this.terms[0] = new foundry.dice.terms.Die({ faces: 20 }); this.terms[0] = new foundry.dice.terms.Die({ faces: 20 });
} }
applyAdvantage() { applyAdvantage() {
this.d20.modifiers.findSplice(m => ["kh", "kl"].includes(m)); this.d20.modifiers.findSplice(m => ['kh', 'kl'].includes(m));
if ( !this.hasAdvantage && !this.hasAdvantage ) this.number = 1; if (!this.hasAdvantage && !this.hasAdvantage) this.number = 1;
else { else {
this.d20.number = 2; this.d20.number = 2;
this.d20.modifiers.push(this.hasAdvantage ? "kh" : "kl"); this.d20.modifiers.push(this.hasAdvantage ? 'kh' : 'kl');
} }
} }
// Trait bonus != Adversary // Trait bonus != Adversary
configureModifiers() { configureModifiers() {
this.applyAdvantage(); this.applyAdvantage();
this.applyBaseBonus(); this.applyBaseBonus();
this.options.experiences?.forEach(m => { this.options.experiences?.forEach(m => {
if(this.options.data.experiences?.[m]) this.options.roll.modifiers.push( if (this.options.data.experiences?.[m])
{ this.options.roll.modifiers.push({
label: this.options.data.experiences[m].description, label: this.options.data.experiences[m].description,
value: this.options.data.experiences[m].total value: this.options.data.experiences[m].total
} });
); });
})
this.options.roll.modifiers?.forEach(m => { this.options.roll.modifiers?.forEach(m => {
this.terms.push(...this.formatModifier(m.value)); this.terms.push(...this.formatModifier(m.value));
}) });
if(this.options.extraFormula) this.terms.push(new foundry.dice.terms.OperatorTerm({operator: '+'}), ...this.constructor.parse(this.options.extraFormula, this.getRollData())); if (this.options.extraFormula)
this.terms.push(
new foundry.dice.terms.OperatorTerm({ operator: '+' }),
...this.constructor.parse(this.options.extraFormula, this.getRollData())
);
// this.resetFormula(); // this.resetFormula();
} }
applyBaseBonus() { applyBaseBonus() {
if(this.options.type === "attack") this.terms.push(...this.formatModifier(this.options.data.attack.roll.bonus)); if (this.options.type === 'attack')
this.terms.push(...this.formatModifier(this.options.data.attack.roll.bonus));
} }
static async postEvaluate(roll, config={}) { static async postEvaluate(roll, config = {}) {
if (config.targets?.length) { if (config.targets?.length) {
config.targets.forEach(target => { config.targets.forEach(target => {
const difficulty = config.roll.difficulty ?? target.difficulty ?? target.evasion const difficulty = config.roll.difficulty ?? target.difficulty ?? target.evasion;
target.hit = roll.total >= difficulty; target.hit = roll.total >= difficulty;
}) });
} else if(config.roll.difficulty) roll.success = roll.total >= config.roll.difficulty; } else if (config.roll.difficulty) roll.success = roll.total >= config.roll.difficulty;
config.roll.total = roll.total; config.roll.total = roll.total;
config.roll.formula = roll.formula; config.roll.formula = roll.formula;
config.roll.advantage = { config.roll.advantage = {
type: config.advantage, type: config.advantage,
dice: roll.dAdvantage?.denomination, dice: roll.dAdvantage?.denomination,
value: roll.dAdvantage?.total value: roll.dAdvantage?.total
} };
config.roll.modifierTotal = config.roll.modifiers.reduce((a,c) => a + c.value, 0); config.roll.modifierTotal = config.roll.modifiers.reduce((a, c) => a + c.value, 0);
config.roll.dice = []; config.roll.dice = [];
roll.dice.forEach(d => { roll.dice.forEach(d => {
config.roll.dice.push({ config.roll.dice.push({
@ -230,8 +237,8 @@ export class D20Roll extends DHRoll {
total: d.total, total: d.total,
formula: d.formula, formula: d.formula,
results: d.results results: d.results
}) });
}) });
} }
getRollData() { getRollData() {
@ -240,51 +247,54 @@ export class D20Roll extends DHRoll {
formatModifier(modifier) { formatModifier(modifier) {
const numTerm = modifier < 0 ? '-' : '+'; const numTerm = modifier < 0 ? '-' : '+';
return [new foundry.dice.terms.OperatorTerm({operator: numTerm}), new foundry.dice.terms.NumericTerm({number: Math.abs(modifier)})]; return [
new foundry.dice.terms.OperatorTerm({ operator: numTerm }),
new foundry.dice.terms.NumericTerm({ number: Math.abs(modifier) })
];
} }
resetFormula() { resetFormula() {
return this._formula = this.constructor.getFormula(this.terms); return (this._formula = this.constructor.getFormula(this.terms));
} }
} }
export class DualityRoll extends D20Roll { export class DualityRoll extends D20Roll {
constructor(formula, data={}, options={}) { constructor(formula, data = {}, options = {}) {
super(formula, data, options); super(formula, data, options);
} }
static messageType = 'dualityRoll'; static messageType = 'dualityRoll';
// static messageTemplate = 'systems/daggerheart/templates/chat/duality-roll.hbs'; // static messageTemplate = 'systems/daggerheart/templates/chat/duality-roll.hbs';
static messageTemplate = async (config) => { static messageTemplate = async config => {
return 'systems/daggerheart/templates/chat/duality-roll.hbs'; return 'systems/daggerheart/templates/chat/duality-roll.hbs';
} };
static DefaultDialog = D20RollDialog; static DefaultDialog = D20RollDialog;
get dHope() { get dHope() {
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return; // if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
if ( !(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.createBaseDice(); if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
return this.dice[0]; return this.dice[0];
// return this.#hopeDice; // return this.#hopeDice;
} }
set dHope(faces) { set dHope(faces) {
if ( !(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.createBaseDice(); if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
this.terms[0].faces = faces; this.terms[0].faces = faces;
// this.#hopeDice = `d${face}`; // this.#hopeDice = `d${face}`;
} }
get dFear() { get dFear() {
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return; // if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
if ( !(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.createBaseDice(); if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
return this.dice[1]; return this.dice[1];
// return this.#fearDice; // return this.#fearDice;
} }
set dFear(faces) { set dFear(faces) {
if ( !(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.createBaseDice(); if (!(this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();
this.dice[1].faces = faces; this.dice[1].faces = faces;
// this.#fearDice = `d${face}`; // this.#fearDice = `d${face}`;
} }
@ -294,17 +304,17 @@ export class DualityRoll extends D20Roll {
} }
get isCritical() { get isCritical() {
if ( !this.dHope._evaluated || !this.dFear._evaluated ) return; if (!this.dHope._evaluated || !this.dFear._evaluated) return;
return this.dHope.total === this.dFear.total; return this.dHope.total === this.dFear.total;
} }
get withHope() { get withHope() {
if(!this._evaluated) return; if (!this._evaluated) return;
return this.dHope.total > this.dFear.total; return this.dHope.total > this.dFear.total;
} }
get withFear() { get withFear() {
if(!this._evaluated) return; if (!this._evaluated) return;
return this.dHope.total < this.dFear.total; return this.dHope.total < this.dFear.total;
} }
@ -312,94 +322,99 @@ export class DualityRoll extends D20Roll {
return null; return null;
} }
get totalLabel() { get totalLabel() {
const label = const label = this.withHope
this.withHope ? 'DAGGERHEART.General.Hope'
? 'DAGGERHEART.General.Hope' : this.withFear
: this.withFear ? 'DAGGERHEART.General.Fear'
? 'DAGGERHEART.General.Fear' : 'DAGGERHEART.General.CriticalSuccess';
: 'DAGGERHEART.General.CriticalSuccess';
return game.i18n.localize(label); return game.i18n.localize(label);
} }
createBaseDice() { createBaseDice() {
if ( this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie && this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie ) return; if (
if ( !(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.terms[0] = new CONFIG.Dice.daggerheart.DualityDie(); this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie &&
this.terms[1] = new foundry.dice.terms.OperatorTerm({operator:'+'}); this.dice[1] instanceof CONFIG.Dice.daggerheart.DualityDie
if ( !(this.dice[2] instanceof CONFIG.Dice.daggerheart.DualityDie) ) this.terms[2] = new CONFIG.Dice.daggerheart.DualityDie(); )
return;
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie))
this.terms[0] = new CONFIG.Dice.daggerheart.DualityDie();
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
if (!(this.dice[2] instanceof CONFIG.Dice.daggerheart.DualityDie))
this.terms[2] = new CONFIG.Dice.daggerheart.DualityDie();
} }
applyAdvantage() { applyAdvantage() {
const dieFaces = 6, const dieFaces = 6,
bardRallyFaces = this.hasBarRally, bardRallyFaces = this.hasBarRally,
advDie = new foundry.dice.terms.Die({faces: dieFaces}); advDie = new foundry.dice.terms.Die({ faces: dieFaces });
if(this.hasAdvantage || this.hasDisadvantage || bardRallyFaces) this.terms.push(new foundry.dice.terms.OperatorTerm({operator:'+'})); if (this.hasAdvantage || this.hasDisadvantage || bardRallyFaces)
if(bardRallyFaces) { this.terms.push(new foundry.dice.terms.OperatorTerm({ operator: '+' }));
const rallyDie = new foundry.dice.terms.Die({faces: bardRallyFaces}); if (bardRallyFaces) {
if(this.hasAdvantage) { const rallyDie = new foundry.dice.terms.Die({ faces: bardRallyFaces });
this.terms.push(new foundry.dice.terms.PoolTerm({ if (this.hasAdvantage) {
terms: [advDie.formula, rallyDie.formula], this.terms.push(
modifiers: ["kh"] new foundry.dice.terms.PoolTerm({
})) terms: [advDie.formula, rallyDie.formula],
} else if(this.hasDisadvantage){ modifiers: ['kh']
this.terms.push(advDie, new foundry.dice.terms.OperatorTerm({operator:'+'}), rallyDie); })
);
} else if (this.hasDisadvantage) {
this.terms.push(advDie, new foundry.dice.terms.OperatorTerm({ operator: '+' }), rallyDie);
} }
} else if(this.hasAdvantage || this.hasDisadvantage) this.terms.push(advDie); } else if (this.hasAdvantage || this.hasDisadvantage) this.terms.push(advDie);
} }
applyBaseBonus() { applyBaseBonus() {
if(!this.options.roll.modifiers) this.options.roll.modifiers = []; if (!this.options.roll.modifiers) this.options.roll.modifiers = [];
if(this.options.roll?.trait) this.options.roll.modifiers.push( if (this.options.roll?.trait)
{ this.options.roll.modifiers.push({
label: `DAGGERHEART.Abilities.${this.options.roll.trait}.name`, label: `DAGGERHEART.Abilities.${this.options.roll.trait}.name`,
value: this.options.data.traits[this.options.roll.trait].total value: this.options.data.traits[this.options.roll.trait].total
} });
);
} }
static async postEvaluate(roll, config={}) { static async postEvaluate(roll, config = {}) {
super.postEvaluate(roll, config); super.postEvaluate(roll, config);
config.roll.hope = { config.roll.hope = {
dice: roll.dHope.denomination, dice: roll.dHope.denomination,
value: roll.dHope.total value: roll.dHope.total
} };
config.roll.fear = { config.roll.fear = {
dice: roll.dFear.denomination, dice: roll.dFear.denomination,
value: roll.dFear.total value: roll.dFear.total
} };
config.roll.result = { config.roll.result = {
duality: roll.withHope ? 1 : roll.withFear ? -1 : 0, duality: roll.withHope ? 1 : roll.withFear ? -1 : 0,
total: roll.dHope.total + roll.dFear.total, total: roll.dHope.total + roll.dFear.total,
label: roll.totalLabel label: roll.totalLabel
} };
} }
} }
export class DamageRoll extends DHRoll { export class DamageRoll extends DHRoll {
constructor(formula, data={}, options={}) { constructor(formula, data = {}, options = {}) {
super(formula, data, options) super(formula, data, options);
} }
static messageType = 'damageRoll'; static messageType = 'damageRoll';
// static messageTemplate = 'systems/daggerheart/templates/chat/damage-roll.hbs'; // static messageTemplate = 'systems/daggerheart/templates/chat/damage-roll.hbs';
static messageTemplate = async (config) => { static messageTemplate = async config => {
return await foundry.applications.handlebars.renderTemplate( return await foundry.applications.handlebars.renderTemplate(
config.messageTemplate ?? 'systems/daggerheart/templates/chat/damage-roll.hbs', config.messageTemplate ?? 'systems/daggerheart/templates/chat/damage-roll.hbs',
config config
) );
} };
static DefaultDialog = DamageDialog; static DefaultDialog = DamageDialog;
static async postEvaluate(roll, config={}) { static async postEvaluate(roll, config = {}) {
config.roll = { config.roll = {
result: roll.total, result: roll.total,
dice: roll.dice dice: roll.dice
} };
if(roll.healing) config.roll.type = roll.healing.type if (roll.healing) config.roll.type = roll.healing.type;
} }
} }

View file

@ -55,7 +55,7 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
context.tabs = super._getTabs(this.constructor.TABS); context.tabs = super._getTabs(this.constructor.TABS);
context.systemFields.attack.fields = this.document.system.attack.schema.fields; context.systemFields.attack.fields = this.document.system.attack.schema.fields;
context.isNPC = true; context.isNPC = true;
console.log(context) console.log(context);
return context; return context;
} }

View file

@ -372,7 +372,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
trait: button.dataset.attribute trait: button.dataset.attribute
/* label: abilityLabel, /* label: abilityLabel,
modifier: button.dataset.value */ modifier: button.dataset.value */
}, }
/* chatMessage: { /* chatMessage: {
template: 'systems/daggerheart/templates/chat/duality-roll.hbs' template: 'systems/daggerheart/templates/chat/duality-roll.hbs'
} */ } */

View file

@ -87,7 +87,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
range: new fields.StringField({ range: new fields.StringField({
choices: SYSTEM.GENERAL.range, choices: SYSTEM.GENERAL.range,
required: false, required: false,
blank: true, blank: true
// initial: null // initial: null
}), }),
...this.defineExtraSchema() ...this.defineExtraSchema()
@ -111,7 +111,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
type: new fields.StringField({ type: new fields.StringField({
choices: SYSTEM.ACTIONS.targetTypes, choices: SYSTEM.ACTIONS.targetTypes,
initial: SYSTEM.ACTIONS.targetTypes.any.id, initial: SYSTEM.ACTIONS.targetTypes.any.id,
nullable: true, initial: null nullable: true,
initial: null
}), }),
amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }) amount: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 })
}), }),
@ -132,8 +133,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
}) })
}, },
extraSchemas = {}; extraSchemas = {};
this.extraSchemas.forEach(s => extraSchemas[s] = extraFields[s]); this.extraSchemas.forEach(s => (extraSchemas[s] = extraFields[s]));
return extraSchemas; return extraSchemas;
} }
@ -172,8 +173,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
trait: parent.system.trait trait: parent.system.trait
}; };
} }
if(parent?.type === 'weapon' && !!this.schema.fields.damage) { if (parent?.type === 'weapon' && !!this.schema.fields.damage) {
updateSource['damage'] = {includeBase: true}; updateSource['damage'] = { includeBase: true };
} }
if (parent?.system?.range) { if (parent?.system?.range) {
updateSource['range'] = parent?.system?.range; updateSource['range'] = parent?.system?.range;
@ -187,9 +188,14 @@ export class DHBaseAction extends foundry.abstract.DataModel {
...actorData.toObject(), ...actorData.toObject(),
prof: actorData.proficiency?.value ?? 1, prof: actorData.proficiency?.value ?? 1,
cast: actorData.spellcast?.value ?? 1, cast: actorData.spellcast?.value ?? 1,
scale: this.cost.length ? this.cost.reduce((a,c) => {a[c.type] = c.value; return a},{}) : 1, scale: this.cost.length
? this.cost.reduce((a, c) => {
a[c.type] = c.value;
return a;
}, {})
: 1,
roll: {} roll: {}
} };
} }
async use(event, ...args) { async use(event, ...args) {
@ -208,26 +214,27 @@ export class DHBaseAction extends foundry.abstract.DataModel {
}; };
// this.proceedChatDisplay(config); // this.proceedChatDisplay(config);
// Filter selected targets based on Target parameters // Filter selected targets based on Target parameters
config.targets = await this.getTarget(config); config.targets = await this.getTarget(config);
if(!config.targets) return ui.notifications.warn("Too many targets selected for that actions."); if (!config.targets) return ui.notifications.warn('Too many targets selected for that actions.');
// Filter selected targets based on Range parameters // Filter selected targets based on Range parameters
config.range = await this.checkRange(config); config.range = await this.checkRange(config);
if(!config.range.hasRange) return ui.notifications.warn("No Target within range."); if (!config.range.hasRange) return ui.notifications.warn('No Target within range.');
// Display Uses/Costs Dialog & Check if Actor get enough resources // Display Uses/Costs Dialog & Check if Actor get enough resources
config = { config = {
...config, ...config,
...await this.getCost(config) ...(await this.getCost(config))
} };
if(!this.hasRoll() && (!config.costs.hasCost || !this.hasUses(config.uses))) return ui.notifications.warn("You don't have the resources to use that action."); if (!this.hasRoll() && (!config.costs.hasCost || !this.hasUses(config.uses)))
return ui.notifications.warn("You don't have the resources to use that action.");
// Proceed with Roll // Proceed with Roll
config = await this.proceedRoll(config); config = await this.proceedRoll(config);
if(this.roll && !config.roll.result) return; if (this.roll && !config.roll.result) return;
// Update Actor resources based on Action Cost configuration // Update Actor resources based on Action Cost configuration
this.spendCost(config.costs.values); this.spendCost(config.costs.values);
this.spendUses(config.uses); this.spendUses(config.uses);
@ -254,7 +261,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
type: this.actionType, type: this.actionType,
difficulty: this.roll?.difficulty difficulty: this.roll?.difficulty
} }
} };
// config = await this.actor.diceRoll(config, this); // config = await this.actor.diceRoll(config, this);
return this.actor.diceRoll(config, this); return this.actor.diceRoll(config, this);
} }
@ -262,20 +269,20 @@ export class DHBaseAction extends foundry.abstract.DataModel {
/* COST */ /* COST */
async getCost(config) { async getCost(config) {
let costs = this.cost?.length ? foundry.utils.deepClone(this.cost) : {values: [], hasCost: true}; let costs = this.cost?.length ? foundry.utils.deepClone(this.cost) : { values: [], hasCost: true };
let uses = this.getUses(); let uses = this.getUses();
if (!config.event.shiftKey && !this.hasRoll()) { if (!config.event.shiftKey && !this.hasRoll()) {
const dialogClosed = new Promise((resolve, _) => { const dialogClosed = new Promise((resolve, _) => {
new CostSelectionDialog(costs, uses, this, resolve).render(true); new CostSelectionDialog(costs, uses, this, resolve).render(true);
}); });
({costs, uses} = await dialogClosed); ({ costs, uses } = await dialogClosed);
} }
return {costs, uses}; return { costs, uses };
} }
getRealCosts(costs) { getRealCosts(costs) {
const realCosts = costs?.length ? costs.filter(c => c.enabled) : []; const realCosts = costs?.length ? costs.filter(c => c.enabled) : [];
return {values: realCosts, hasCost: this.hasCost(realCosts)} return { values: realCosts, hasCost: this.hasCost(realCosts) };
} }
calcCosts(costs) { calcCosts(costs) {
@ -284,32 +291,32 @@ export class DHBaseAction extends foundry.abstract.DataModel {
c.step = c.step ?? 1; c.step = c.step ?? 1;
c.total = c.value * c.scale * c.step; c.total = c.value * c.scale * c.step;
c.enabled = c.hasOwnProperty('enabled') ? c.enabled : true; c.enabled = c.hasOwnProperty('enabled') ? c.enabled : true;
return c return c;
}) });
} }
hasCost(costs) { hasCost(costs) {
return costs.reduce((a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), true) return costs.reduce((a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), true);
} }
async spendCost(config) { async spendCost(config) {
if(!config.costs?.values?.length) return; if (!config.costs?.values?.length) return;
return await this.actor.modifyResource(config.costs.values); return await this.actor.modifyResource(config.costs.values);
} }
/* COST */ /* COST */
/* USES */ /* USES */
async spendUses(config) { async spendUses(config) {
if(!this.uses.max || config.enabled === false) return; if (!this.uses.max || config.enabled === false) return;
const newActions = foundry.utils.getProperty(this.item.system, this.systemPath).map(x => x.toObject()); const newActions = foundry.utils.getProperty(this.item.system, this.systemPath).map(x => x.toObject());
newActions[this.index].uses.value++; newActions[this.index].uses.value++;
await this.item.update({ [`system.${this.systemPath}`]: newActions }); await this.item.update({ [`system.${this.systemPath}`]: newActions });
} }
getUses() { getUses() {
if(!this.uses) return {hasUse: true} if (!this.uses) return { hasUse: true };
const uses = foundry.utils.deepClone(this.uses); const uses = foundry.utils.deepClone(this.uses);
if(!uses.value) uses.value = 0; if (!uses.value) uses.value = 0;
return uses; return uses;
} }
@ -325,23 +332,28 @@ export class DHBaseAction extends foundry.abstract.DataModel {
} }
/* USES */ /* USES */
/* TARGET */ /* TARGET */
async getTarget(config) { async getTarget(config) {
if(this.target?.type === SYSTEM.ACTIONS.targetTypes.self.id) return this.formatTarget(this.actor.token ?? this.actor.prototypeToken); if (this.target?.type === SYSTEM.ACTIONS.targetTypes.self.id)
return this.formatTarget(this.actor.token ?? this.actor.prototypeToken);
let targets = Array.from(game.user.targets); let 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) return false; if (this.target.amount && targets.length > this.target.amount) return false;
} }
return targets.map(t => this.formatTarget(t)); return targets.map(t => this.formatTarget(t));
} }
isTargetFriendly(target) { isTargetFriendly(target) {
const actorDisposition = this.actor.token ? this.actor.token.disposition : this.actor.prototypeToken.disposition, const actorDisposition = this.actor.token
? this.actor.token.disposition
: this.actor.prototypeToken.disposition,
targetDisposition = target.document.disposition; targetDisposition = target.document.disposition;
return (this.target.type === SYSTEM.ACTIONS.targetTypes.friendly.id && actorDisposition === targetDisposition) || (this.target.type === SYSTEM.ACTIONS.targetTypes.hostile.id && (actorDisposition + targetDisposition === 0)) return (
(this.target.type === SYSTEM.ACTIONS.targetTypes.friendly.id && actorDisposition === targetDisposition) ||
(this.target.type === SYSTEM.ACTIONS.targetTypes.hostile.id && actorDisposition + targetDisposition === 0)
);
} }
formatTarget(actor) { formatTarget(actor) {
@ -351,56 +363,57 @@ export class DHBaseAction extends foundry.abstract.DataModel {
img: actor.actor.img, img: actor.actor.img,
difficulty: actor.actor.system.difficulty, difficulty: actor.actor.system.difficulty,
evasion: actor.actor.system.evasion?.total evasion: actor.actor.system.evasion?.total
} };
} }
/* TARGET */ /* TARGET */
/* RANGE */ /* RANGE */
async checkRange(config) { async checkRange(config) {
if(!this.range || !this.actor) return true; if (!this.range || !this.actor) return true;
return {values: [], hasRange: true}; return { values: [], hasRange: true };
} }
/* RANGE */ /* RANGE */
/* EFFECTS */ /* EFFECTS */
async applyEffects(event, data, force=false) { async applyEffects(event, data, force = false) {
if(!this.effects?.length || !data.system.targets.length) return; if (!this.effects?.length || !data.system.targets.length) return;
data.system.targets.forEach(async (token) => { data.system.targets.forEach(async token => {
if(!token.hit && !force) return; if (!token.hit && !force) return;
this.effects.forEach(async (e) => { this.effects.forEach(async e => {
const actor = canvas.tokens.get(token.id)?.actor, const actor = canvas.tokens.get(token.id)?.actor,
effect = this.item.effects.get(e._id); effect = this.item.effects.get(e._id);
if(!actor || !effect) return; if (!actor || !effect) return;
await this.applyEffect(effect, actor); await this.applyEffect(effect, actor);
}) });
}) });
} }
async applyEffect(effect, actor) { async applyEffect(effect, actor) {
// Enable an existing effect on the target if it originated from this effect // Enable an existing effect on the target if it originated from this effect
const existingEffect = actor.effects.find(e => e.origin === origin.uuid); const existingEffect = actor.effects.find(e => e.origin === origin.uuid);
if ( existingEffect ) { if (existingEffect) {
return existingEffect.update(foundry.utils.mergeObject({ return existingEffect.update(
foundry.utils.mergeObject({
...effect.constructor.getInitialDuration(), ...effect.constructor.getInitialDuration(),
disabled: false disabled: false
})); })
} );
}
// Otherwise, create a new effect on the target
const effectData = foundry.utils.mergeObject({ // Otherwise, create a new effect on the target
...effect.toObject(), const effectData = foundry.utils.mergeObject({
disabled: false, ...effect.toObject(),
transfer: false, disabled: false,
origin: origin.uuid transfer: false,
}); origin: origin.uuid
await ActiveEffect.implementation.create(effectData, { parent: actor }); });
await ActiveEffect.implementation.create(effectData, { parent: actor });
} }
/* EFFECTS */ /* EFFECTS */
/* CHAT */ /* CHAT */
async proceedChatDisplay(config) { async proceedChatDisplay(config) {
if(!this.chatDisplay) return; if (!this.chatDisplay) return;
} }
/* CHAT */ /* CHAT */
} }
@ -412,14 +425,14 @@ export class DHDamageAction extends DHBaseAction {
async use(event, ...args) { async use(event, ...args) {
const config = await super.use(event, args); const config = await super.use(event, args);
if(!config || ['error', 'warning'].includes(config.type)) return; if (!config || ['error', 'warning'].includes(config.type)) return;
if(!this.directDamage) return; if (!this.directDamage) return;
return await this.rollDamage(event, config); return await this.rollDamage(event, config);
} }
async rollDamage(event, data) { async rollDamage(event, data) {
let formula = this.damage.parts.map(p => p.getFormula(this.actor)).join(' + '); let formula = this.damage.parts.map(p => p.getFormula(this.actor)).join(' + ');
if (!formula || formula == '') return; if (!formula || formula == '') return;
let roll = { formula: formula, total: formula }, let roll = { formula: formula, total: formula },
bonusDamage = []; bonusDamage = [];
@ -427,10 +440,15 @@ export class DHDamageAction extends DHBaseAction {
const config = { const config = {
title: game.i18n.format('DAGGERHEART.Chat.DamageRoll.Title', { damage: this.name }), title: game.i18n.format('DAGGERHEART.Chat.DamageRoll.Title', { damage: this.name }),
formula, formula,
targets: (data.system?.targets ?? data.targets).map(x => ({ id: x.id, name: x.name, img: x.img, hit: true })) targets: (data.system?.targets ?? data.targets).map(x => ({
} id: x.id,
name: x.name,
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config) img: x.img,
hit: true
}))
};
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
} }
} }
@ -475,24 +493,31 @@ export class DHHealingAction extends DHBaseAction {
async use(event, ...args) { async use(event, ...args) {
const config = await super.use(event, args); const config = await super.use(event, args);
if(!config || ['error', 'warning'].includes(config.type)) return; if (!config || ['error', 'warning'].includes(config.type)) return;
if(this.hasRoll()) return; if (this.hasRoll()) return;
return await this.rollHealing(event, config); return await this.rollHealing(event, config);
} }
async rollHealing(event, data) { async rollHealing(event, data) {
let formula = this.healing.value.getFormula(this.actor); let formula = this.healing.value.getFormula(this.actor);
if (!formula || formula == '') return; if (!formula || formula == '') return;
let roll = { formula: formula, total: formula }, let roll = { formula: formula, total: formula },
bonusDamage = []; bonusDamage = [];
const config = { const config = {
title: game.i18n.format('DAGGERHEART.Chat.HealingRoll.Title', { healing: game.i18n.localize(SYSTEM.GENERAL.healingTypes[this.healing.type].label) }), title: game.i18n.format('DAGGERHEART.Chat.HealingRoll.Title', {
healing: game.i18n.localize(SYSTEM.GENERAL.healingTypes[this.healing.type].label)
}),
formula, formula,
targets: (data.system?.targets ?? data.targets).map(x => ({ id: x.id, name: x.name, img: x.img, hit: true })), targets: (data.system?.targets ?? data.targets).map(x => ({
id: x.id,
name: x.name,
img: x.img,
hit: true
})),
messageTemplate: 'systems/daggerheart/templates/chat/healing-roll.hbs' messageTemplate: 'systems/daggerheart/templates/chat/healing-roll.hbs'
} };
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config); roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
} }
@ -511,13 +536,12 @@ export class DHSummonAction extends DHBaseAction {
} }
async use(event, ...args) { async use(event, ...args) {
if ( !this.canSummon || !canvas.scene ) return; if (!this.canSummon || !canvas.scene) return;
const config = await super.use(event, args); const config = await super.use(event, args);
} }
get canSummon() { get canSummon() {
return game.user.can("TOKEN_CREATE"); return game.user.can('TOKEN_CREATE');
} }
} }
@ -526,7 +550,7 @@ export class DHEffectAction extends DHBaseAction {
async use(event, ...args) { async use(event, ...args) {
const config = await super.use(event, args); const config = await super.use(event, args);
if(['error', 'warning'].includes(config.type)) return; if (['error', 'warning'].includes(config.type)) return;
return await this.chatApplyEffects(event, config); return await this.chatApplyEffects(event, config);
} }
@ -570,7 +594,7 @@ export class DHMacroAction extends DHBaseAction {
async use(event, ...args) { async use(event, ...args) {
const config = await super.use(event, args); const config = await super.use(event, args);
if(['error', 'warning'].includes(config.type)) return; if (['error', 'warning'].includes(config.type)) return;
const fixUUID = !this.documentUUID.includes('Macro.') ? `Macro.${this.documentUUID}` : this.documentUUID, const fixUUID = !this.documentUUID.includes('Macro.') ? `Macro.${this.documentUUID}` : this.documentUUID,
macro = await fromUuid(fixUUID); macro = await fromUuid(fixUUID);
try { try {

View file

@ -11,7 +11,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
initial: 'proficiency', initial: 'proficiency',
label: 'Multiplier' label: 'Multiplier'
}), }),
flatMultiplier : new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }), flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }),
dice: new fields.StringField({ choices: SYSTEM.GENERAL.diceTypes, initial: 'd6', label: 'Formula' }), dice: new fields.StringField({ choices: SYSTEM.GENERAL.diceTypes, initial: 'd6', label: 'Formula' }),
bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }), bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }),
custom: new fields.SchemaField({ custom: new fields.SchemaField({

View file

@ -90,9 +90,11 @@ export default class DhpAdversary extends BaseDataActor {
type: 'weapon' type: 'weapon'
}, },
damage: { damage: {
parts: [{ parts: [
multiplier: 'flat' {
}] multiplier: 'flat'
}
]
} }
} }
}), }),

View file

@ -17,6 +17,12 @@ const resourceField = max =>
max: new foundry.data.fields.NumberField({ initial: max, integer: true }) max: new foundry.data.fields.NumberField({ initial: max, integer: true })
}); });
const stressDamageReductionRule = () =>
new foundry.data.fields.SchemaField({
enabled: new foundry.data.fields.BooleanField({ required: true, initial: false }),
cost: new foundry.data.fields.NumberField({ integer: true })
});
export default class DhCharacter extends BaseDataActor { export default class DhCharacter extends BaseDataActor {
static get metadata() { static get metadata() {
return foundry.utils.mergeObject(super.metadata, { return foundry.utils.mergeObject(super.metadata, {
@ -90,6 +96,18 @@ export default class DhCharacter extends BaseDataActor {
attack: new fields.NumberField({ integer: true, initial: 0 }), attack: new fields.NumberField({ integer: true, initial: 0 }),
spellcast: new fields.NumberField({ integer: true, initial: 0 }), spellcast: new fields.NumberField({ integer: true, initial: 0 }),
armorScore: new fields.NumberField({ integer: true, initial: 0 }) armorScore: new fields.NumberField({ integer: true, initial: 0 })
}),
rules: new fields.SchemaField({
maxArmorMarked: new fields.SchemaField({
value: new fields.NumberField({ required: true, integer: true, initial: 1 }),
bonus: new fields.NumberField({ required: true, integer: true, initial: 0 }),
stressExtra: new fields.NumberField({ required: true, integer: true, initial: 0 })
}),
stressDamageReduction: new fields.SchemaField({
severe: stressDamageReductionRule(),
major: stressDamageReductionRule(),
minor: stressDamageReductionRule()
})
}) })
}; };
} }
@ -239,6 +257,9 @@ export default class DhCharacter extends BaseDataActor {
experience.total = experience.value + experience.bonus; experience.total = experience.value + experience.bonus;
} }
this.rules.maxArmorMarked.total = this.rules.maxArmorMarked.value + this.rules.maxArmorMarked.bonus;
this.armorScore = this.armor ? this.armor.system.baseScore + (this.bonuses.armorScore ?? 0) : 0;
this.resources.hitPoints.maxTotal = this.resources.hitPoints.max + this.resources.hitPoints.bonus; this.resources.hitPoints.maxTotal = this.resources.hitPoints.max + this.resources.hitPoints.bonus;
this.resources.stress.maxTotal = this.resources.stress.max + this.resources.stress.bonus; this.resources.stress.maxTotal = this.resources.stress.max + this.resources.stress.bonus;
this.evasion.total = (this.class?.evasion ?? 0) + this.evasion.bonus; this.evasion.total = (this.class?.evasion ?? 0) + this.evasion.bonus;

View file

@ -1,5 +1,5 @@
import DhpActor from "../../documents/actor.mjs"; import DhpActor from '../../documents/actor.mjs';
import ActionField from "../fields/actionField.mjs"; import ActionField from '../fields/actionField.mjs';
export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel { export default class DHAdversaryRoll extends foundry.abstract.TypeDataModel {
static defineSchema() { static defineSchema() {

View file

@ -29,7 +29,6 @@ export default class DHArmor extends BaseDataItem {
}) })
), ),
marks: new fields.SchemaField({ marks: new fields.SchemaField({
max: new fields.NumberField({ initial: 6, integer: true }),
value: new fields.NumberField({ initial: 0, integer: true }) value: new fields.NumberField({ initial: 0, integer: true })
}), }),
baseThresholds: new fields.SchemaField({ baseThresholds: new fields.SchemaField({

View file

@ -1,15 +1,18 @@
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api; const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
export default class D20RollDialog extends HandlebarsApplicationMixin(ApplicationV2) { export default class D20RollDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(config={}, options={}) { constructor(config = {}, options = {}) {
super(options); super(options);
this.config = config; this.config = config;
this.config.experiences = []; this.config.experiences = [];
if(config.source?.action) { if (config.source?.action) {
this.item = config.data.parent.items.get(config.source.item); this.item = config.data.parent.items.get(config.source.item);
this.action = config.data.attack?._id == config.source.action ? config.data.attack : this.item.system.actions.find(a => a._id === config.source.action); this.action =
config.data.attack?._id == config.source.action
? config.data.attack
: this.item.system.actions.find(a => a._id === config.source.action);
} }
} }
@ -47,17 +50,20 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
async _prepareContext(_options) { async _prepareContext(_options) {
const context = await super._prepareContext(_options); const context = await super._prepareContext(_options);
context.experiences = Object.keys(this.config.data.experiences).map(id => ({ id, ...this.config.data.experiences[id] })); context.experiences = Object.keys(this.config.data.experiences).map(id => ({
id,
...this.config.data.experiences[id]
}));
context.selectedExperiences = this.config.experiences; context.selectedExperiences = this.config.experiences;
context.advantage = this.config.advantage; context.advantage = this.config.advantage;
/* context.diceOptions = this.diceOptions; */ /* context.diceOptions = this.diceOptions; */
context.canRoll = true; context.canRoll = true;
if(this.config.costs?.length) { if (this.config.costs?.length) {
const updatedCosts = this.action.calcCosts(this.config.costs); const updatedCosts = this.action.calcCosts(this.config.costs);
context.costs = updatedCosts context.costs = updatedCosts;
context.canRoll = this.action.getRealCosts(updatedCosts)?.hasCost; context.canRoll = this.action.getRealCosts(updatedCosts)?.hasCost;
} }
if(this.config.uses?.max) { if (this.config.uses?.max) {
context.uses = this.action.calcUses(this.config.uses); context.uses = this.action.calcUses(this.config.uses);
context.canRoll = context.canRoll && this.action.hasUses(context.uses); context.canRoll = context.canRoll && this.action.hasUses(context.uses);
} }
@ -66,8 +72,8 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
static updateRollConfiguration(event, _, formData) { static updateRollConfiguration(event, _, formData) {
const { ...rest } = foundry.utils.expandObject(formData.object); const { ...rest } = foundry.utils.expandObject(formData.object);
if(this.config.costs) this.config.costs = foundry.utils.mergeObject(this.config.costs, rest.costs); if (this.config.costs) this.config.costs = foundry.utils.mergeObject(this.config.costs, rest.costs);
if(this.config.uses) this.config.uses = foundry.utils.mergeObject(this.config.uses, rest.uses); if (this.config.uses) this.config.uses = foundry.utils.mergeObject(this.config.uses, rest.uses);
this.render(); this.render();
} }
@ -87,19 +93,19 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
} }
static async submitRoll() { static async submitRoll() {
await this.close({ submitted: true }); await this.close({ submitted: true });
} }
/** @override */ /** @override */
_onClose(options={}) { _onClose(options = {}) {
if ( !options.submitted ) this.config = false; if (!options.submitted) this.config = false;
} }
static async configure(config={}) { static async configure(config = {}) {
return new Promise(resolve => { return new Promise(resolve => {
const app = new this(config); const app = new this(config);
app.addEventListener("close", () => resolve(app.config), { once: true }); app.addEventListener('close', () => resolve(app.config), { once: true });
app.render({ force: true }); app.render({ force: true });
}); });
} }
} }

View file

@ -4,6 +4,7 @@ import RollSelectionDialog from '../applications/rollSelectionDialog.mjs';
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs'; import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs'; import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
import DHDualityRoll from '../data/chat-message/dualityRoll.mjs'; import DHDualityRoll from '../data/chat-message/dualityRoll.mjs';
import DamageReductionDialog from '../applications/damageReductionDialog.mjs';
export default class DhpActor extends Actor { export default class DhpActor extends Actor {
async _preCreate(data, options, user) { async _preCreate(data, options, user) {
@ -265,9 +266,9 @@ export default class DhpActor extends Actor {
* @param {object} [config.costs] * @param {object} [config.costs]
*/ */
async diceRoll(config, action) { async diceRoll(config, action) {
config.source = {...(config.source ?? {}), actor: this._id}; config.source = { ...(config.source ?? {}), actor: this._id };
config.data = this.getRollData() config.data = this.getRollData();
const roll = await CONFIG.Dice.daggerheart[this.type === 'character' ? 'DualityRoll' : 'D20Roll'].build(config) const roll = await CONFIG.Dice.daggerheart[this.type === 'character' ? 'DualityRoll' : 'D20Roll'].build(config);
return config; return config;
} }
@ -361,66 +362,78 @@ export default class DhpActor extends Actor {
async takeDamage(damage, type) { async takeDamage(damage, type) {
const hpDamage = const hpDamage =
damage >= this.system.damageThresholds.severe damage >= this.system.damageThresholds.severe
? -3 ? 3
: damage >= this.system.damageThresholds.major : damage >= this.system.damageThresholds.major
? -2 ? 2
: damage >= this.system.damageThresholds.minor : damage >= this.system.damageThresholds.minor
? -1 ? 1
: 0; : 0;
await this.modifyResource([{value: hpDamage, type}]);
/* const update = {
'system.resources.hitPoints.value': Math.min(
this.system.resources.hitPoints.value + hpDamage,
this.system.resources.hitPoints.max
)
};
if (game.user.isGM) { if (
await this.update(update); this.type === 'character' &&
this.system.armor &&
this.system.armor.system.marks.value < this.system.armorScore
) {
new Promise((resolve, reject) => {
new DamageReductionDialog(resolve, reject, this, hpDamage).render(true);
})
.then(async ({ modifiedDamage, armorSpent, stressSpent }) => {
const resources = [
{ value: modifiedDamage, type: 'hitPoints' },
...(armorSpent ? [{ value: armorSpent, type: 'armorStack' }] : []),
...(stressSpent ? [{ value: stressSpent, type: 'stress' }] : [])
];
await this.modifyResource(resources);
})
.catch(() => {
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
user: game.user.id,
content: game.i18n.format('DAGGERHEART.DamageReduction.Notifications.DamageIgnore', {
character: this.name
})
});
cls.create(msg.toObject());
});
} else { } else {
await game.socket.emit(`system.${SYSTEM.id}`, { await this.modifyResource([{ value: hpDamage, type: 'hitPoints' }]);
action: socketEvent.GMUpdate, }
data: {
action: GMUpdateEvent.UpdateDocument,
uuid: this.uuid,
update: update
}
});
} */
} }
async modifyResource(resources) { async modifyResource(resources) {
if(!resources.length) return; if (!resources.length) return;
let updates = { actor: { target: this, resources: {} }, armor: { target: this.armor, resources: {} } }; let updates = { actor: { target: this, resources: {} }, armor: { target: this.system.armor, resources: {} } };
resources.forEach(r => { resources.forEach(r => {
switch (type) { switch (r.type) {
case 'armorStrack': case 'armorStack':
// resource = 'system.stacks.value'; updates.armor.resources['system.marks.value'] = Math.min(
// target = this.armor; this.system.armor.system.marks.value + r.value,
// update = Math.min(this.marks.value + value, this.marks.max); this.system.armorScore
updates.armor.resources['system.stacks.value'] = Math.min(this.marks.value + value, this.marks.max); );
break; break;
default: default:
// resource = `system.resources.${type}`; updates.actor.resources[`system.resources.${r.type}.value`] = Math.min(
// target = this; this.system.resources[r.type].value + r.value,
// update = Math.min(this.resources[type].value + value, this.resources[type].max); this.system.resources[r.type].max
updates.armor.resources[`system.resources.${type}`] = Math.min(this.resources[type].value + value, this.resources[type].max); );
break; break;
} }
}) });
Object.values(updates).forEach(async (u) => { Object.values(updates).forEach(async u => {
if (game.user.isGM) { if (Object.keys(u.resources).length > 0) {
await u.target.update(u.resources); if (game.user.isGM) {
} else { await u.target.update(u.resources);
await game.socket.emit(`system.${SYSTEM.id}`, { } else {
action: socketEvent.GMUpdate, await game.socket.emit(`system.${SYSTEM.id}`, {
data: { action: socketEvent.GMUpdate,
action: GMUpdateEvent.UpdateDocument, data: {
uuid: u.target.uuid, action: GMUpdateEvent.UpdateDocument,
update: u.resources uuid: u.target.uuid,
} update: u.resources
}); }
});
}
} }
}) });
} }
} }

View file

@ -235,3 +235,29 @@ Roll.replaceFormulaData = function (formula, data, { missing, warn = false } = {
formula = terms.reduce((a, c) => a.replaceAll(`@${c.term}`, data[c.term] ?? c.default), formula); formula = terms.reduce((a, c) => a.replaceAll(`@${c.term}`, data[c.term] ?? c.default), formula);
return nativeReplaceFormulaData(formula, data, { missing, warn }); return nativeReplaceFormulaData(formula, data, { missing, warn });
}; };
export const getDamageLabel = damage => {
switch (damage) {
case 3:
return game.i18n.localize('DAGGERHEART.General.Damage.Severe');
case 2:
return game.i18n.localize('DAGGERHEART.General.Damage.Major');
case 1:
return game.i18n.localize('DAGGERHEART.General.Damage.Minor');
case 0:
return game.i18n.localize('DAGGERHEART.General.Damage.None');
}
};
export const damageKeyToNumber = key => {
switch (key) {
case 'severe':
return 3;
case 'major':
return 2;
case 'minor':
return 1;
case 'none':
return 0;
}
};

View file

@ -66,7 +66,10 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
getAction(actor, itemId, actionId) { getAction(actor, itemId, actionId) {
const item = actor.items.get(itemId), const item = actor.items.get(itemId),
action = actor.system.attack?._id === actionId ? actor.system.attack : item?.system?.actions?.find(a => a._id === actionId); action =
actor.system.attack?._id === actionId
? actor.system.attack
: item?.system?.actions?.find(a => a._id === actionId);
return action; return action;
} }
@ -74,9 +77,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation(); event.stopPropagation();
const actor = this.getActor(message.system.source.actor); const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true; if (!actor || !game.user.isGM) return true;
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?.rollDamage) return; if (!action || !action?.rollDamage) return;
await action.rollDamage(event, message); await action.rollDamage(event, message);
} }
}; };
@ -85,9 +88,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation(); event.stopPropagation();
const actor = this.getActor(message.system.source.actor); const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true; if (!actor || !game.user.isGM) return true;
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?.rollHealing) return; if (!action || !action?.rollHealing) return;
await action.rollHealing(event, message); await action.rollHealing(event, message);
} }
}; };
@ -96,12 +99,12 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation(); event.stopPropagation();
const actor = this.getActor(message.system.source.actor); const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true; if (!actor || !game.user.isGM) return true;
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); await action.applyEffects(event, message);
} }
} };
hoverTarget = event => { hoverTarget = event => {
event.stopPropagation(); event.stopPropagation();
@ -148,7 +151,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected')); ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
for (var target of targets) { for (var target of targets) {
await target.actor.modifyResource([{value: healing, type: event.currentTarget.dataset.type}]); await target.actor.modifyResource([{ value: healing, type: event.currentTarget.dataset.type }]);
} }
}; };

View file

@ -3115,6 +3115,125 @@ div.daggerheart.views.multiclass {
.daggerheart.views.ownership-selection .ownership-outer-container .ownership-container select { .daggerheart.views.ownership-selection .ownership-outer-container .ownership-container select {
margin: 4px 0; margin: 4px 0;
} }
.daggerheart.views.damage-reduction .window-content {
padding: 8px 0;
}
.daggerheart.views.damage-reduction .damage-reduction-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.daggerheart.views.damage-reduction .damage-reduction-container .section-container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.daggerheart.views.damage-reduction .damage-reduction-container .padded {
padding: 0 8px;
}
.daggerheart.views.damage-reduction .damage-reduction-container .armor-title {
margin: 0;
white-space: nowrap;
}
.daggerheart.views.damage-reduction .damage-reduction-container .resources-container {
display: flex;
gap: 8px;
width: 100%;
}
.daggerheart.views.damage-reduction .damage-reduction-container .resources-container .resource-container {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection {
display: flex;
align-items: center;
width: 100%;
margin: 0;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner {
display: flex;
gap: 2px;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner:not(:last-child) {
margin-right: 8px;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner .mark-container {
cursor: pointer;
border: 1px solid light-dark(#18162e, #f3c267);
border-radius: 6px;
height: 26px;
padding: 0 1px;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.4;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner .mark-container.selected {
opacity: 1;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner .mark-container.inactive {
cursor: initial;
opacity: 0.2;
}
.daggerheart.views.damage-reduction .damage-reduction-container .mark-selection .mark-selection-inner .mark-container .fa-shield {
position: relative;
right: 0.5px;
}
.daggerheart.views.damage-reduction .damage-reduction-container .stress-reduction-container {
margin: 0;
width: 100%;
}
.daggerheart.views.damage-reduction .damage-reduction-container .stress-reduction-container .stress-reduction {
border: 1px solid light-dark(#18162e, #f3c267);
border-radius: 6px;
height: 26px;
padding: 0 4px;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
opacity: 0.4;
}
.daggerheart.views.damage-reduction .damage-reduction-container .stress-reduction-container .stress-reduction.active {
opacity: 1;
cursor: pointer;
}
.daggerheart.views.damage-reduction .damage-reduction-container .stress-reduction-container .stress-reduction.selected {
opacity: 1;
background: var(--color-warm-2);
color: white;
}
.daggerheart.views.damage-reduction .damage-reduction-container .stress-reduction-container .stress-reduction .stress-reduction-cost {
display: flex;
align-items: center;
}
.daggerheart.views.damage-reduction .damage-reduction-container .markers-subtitle {
margin: -4px 0 0 0;
}
.daggerheart.views.damage-reduction .damage-reduction-container .markers-subtitle.bold {
font-variant: all-small-caps;
font-weight: bold;
}
.daggerheart.views.damage-reduction .damage-reduction-container footer {
display: flex;
width: 100%;
}
.daggerheart.views.damage-reduction .damage-reduction-container footer button {
flex: 1;
}
.daggerheart.views.damage-reduction .damage-reduction-container footer button .damage-value {
font-weight: bold;
}
.daggerheart.views.damage-reduction .damage-reduction-container footer button .damage-value.reduced-value {
opacity: 0.4;
text-decoration: line-through;
}
:root { :root {
--shadow-text-stroke: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; --shadow-text-stroke: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
--fear-animation: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, opacity 0.3s ease; --fear-animation: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;

View file

@ -11,6 +11,7 @@
@import './characterCreation.less'; @import './characterCreation.less';
@import './levelup.less'; @import './levelup.less';
@import './ownershipSelection.less'; @import './ownershipSelection.less';
@import './damageReduction.less';
@import './resources.less'; @import './resources.less';
@import './countdown.less'; @import './countdown.less';
@import './settings.less'; @import './settings.less';

145
styles/damageReduction.less Normal file
View file

@ -0,0 +1,145 @@
.daggerheart.views.damage-reduction {
.window-content {
padding: 8px 0;
}
.damage-reduction-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
.section-container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.padded {
padding: 0 8px;
}
.armor-title {
margin: 0;
white-space: nowrap;
}
.resources-container {
display: flex;
gap: 8px;
width: 100%;
.resource-container {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
}
.mark-selection {
display: flex;
align-items: center;
width: 100%;
margin: 0;
.mark-selection-inner {
display: flex;
gap: 2px;
&:not(:last-child) {
margin-right: 8px;
}
.mark-container {
cursor: pointer;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
height: 26px;
padding: 0 1px;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.4;
&.selected {
opacity: 1;
}
&.inactive {
cursor: initial;
opacity: 0.2;
}
.fa-shield {
position: relative;
right: 0.5px;
}
}
}
}
.stress-reduction-container {
margin: 0;
width: 100%;
.stress-reduction {
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
height: 26px;
padding: 0 4px;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
opacity: 0.4;
&.active {
opacity: 1;
cursor: pointer;
}
&.selected {
opacity: 1;
background: var(--color-warm-2);
color: white;
}
.stress-reduction-cost {
display: flex;
align-items: center;
}
}
}
.markers-subtitle {
margin: -4px 0 0 0;
&.bold {
font-variant: all-small-caps;
font-weight: bold;
}
}
footer {
display: flex;
width: 100%;
button {
flex: 1;
.damage-value {
font-weight: bold;
&.reduced-value {
opacity: 0.4;
text-decoration: line-through;
}
}
}
}
}
}

View file

@ -1,11 +1,11 @@
@import '../utils/colors.less'; @import '../utils/colors.less';
@import '../utils/fonts.less'; @import '../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.window-content { .window-content {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
} }

View file

@ -1,20 +1,20 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.tab.biography { .tab.biography {
.items-section { .items-section {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 10%, black 98%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 10%, black 98%, transparent 100%);
padding-bottom: 40px; padding-bottom: 40px;
height: 100%; height: 100%;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent; scrollbar-color: light-dark(@dark-blue, @golden) transparent;
} }
} }
} }

View file

@ -1,20 +1,20 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.tab.features { .tab.features {
.features-sections { .features-sections {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
overflow-y: auto; overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%);
padding: 20px 0; padding: 20px 0;
padding-top: 10px; padding-top: 10px;
height: 95%; height: 95%;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent; scrollbar-color: light-dark(@dark-blue, @golden) transparent;
} }
} }
} }

View file

@ -1,65 +1,65 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.tab.inventory { .tab.inventory {
.search-section { .search-section {
display: flex; display: flex;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
.search-bar { .search-bar {
position: relative; position: relative;
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
width: 100%; width: 100%;
padding-top: 5px; padding-top: 5px;
input { input {
border-radius: 50px; border-radius: 50px;
font-family: @font-body; font-family: @font-body;
background: light-dark(@dark-blue-10, @golden-10); background: light-dark(@dark-blue-10, @golden-10);
border: none; border: none;
outline: 2px solid transparent; outline: 2px solid transparent;
transition: all 0.3s ease; transition: all 0.3s ease;
padding: 0 20px; padding: 0 20px;
&:hover { &:hover {
outline: 2px solid light-dark(@dark, @golden); outline: 2px solid light-dark(@dark, @golden);
} }
&:placeholder { &:placeholder {
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
} }
} }
.icon { .icon {
align-content: center; align-content: center;
height: 32px; height: 32px;
position: absolute; position: absolute;
right: 20px; right: 20px;
font-size: 16px; font-size: 16px;
z-index: 1; z-index: 1;
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
} }
} }
} }
.items-section { .items-section {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
overflow-y: auto; overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 5%, black 95%, transparent 100%);
padding: 20px 0; padding: 20px 0;
height: 80%; height: 80%;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent; scrollbar-color: light-dark(@dark-blue, @golden) transparent;
} }
.currency-section { .currency-section {
display: flex; display: flex;
gap: 10px; gap: 10px;
} }
} }
} }

View file

@ -1,101 +1,101 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.tab.loadout { .tab.loadout {
.search-section { .search-section {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.search-bar { .search-bar {
position: relative; position: relative;
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
width: 80%; width: 80%;
padding-top: 5px; padding-top: 5px;
input { input {
border-radius: 50px; border-radius: 50px;
font-family: @font-body; font-family: @font-body;
background: light-dark(@dark-blue-10, @golden-10); background: light-dark(@dark-blue-10, @golden-10);
border: none; border: none;
outline: 2px solid transparent; outline: 2px solid transparent;
transition: all 0.3s ease; transition: all 0.3s ease;
padding: 0 20px; padding: 0 20px;
&:hover { &:hover {
outline: 2px solid light-dark(@dark, @golden); outline: 2px solid light-dark(@dark, @golden);
} }
&:placeholder { &:placeholder {
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
} }
} }
.icon { .icon {
align-content: center; align-content: center;
height: 32px; height: 32px;
position: absolute; position: absolute;
right: 20px; right: 20px;
font-size: 16px; font-size: 16px;
z-index: 1; z-index: 1;
color: light-dark(@dark-blue-50, @beige-50); color: light-dark(@dark-blue-50, @beige-50);
} }
} }
.btn-toogle-view { .btn-toogle-view {
background: light-dark(@dark-blue-10, @dark-blue); background: light-dark(@dark-blue-10, @dark-blue);
border: 1px solid light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 15px; border-radius: 15px;
padding: 0; padding: 0;
gap: 0; gap: 0;
width: 62px; width: 62px;
span { span {
margin: 1px; margin: 1px;
width: 26px; width: 26px;
color: light-dark(@dark-blue, @golden); color: light-dark(@dark-blue, @golden);
&.list-icon { &.list-icon {
i { i {
margin-left: 3px; margin-left: 3px;
} }
} }
&.grid-icon { &.grid-icon {
i { i {
margin-right: 3px; margin-right: 3px;
} }
} }
&.list-active { &.list-active {
border-radius: 32px 3px 3px 32px; border-radius: 32px 3px 3px 32px;
background-color: light-dark(@dark-blue, @golden); background-color: light-dark(@dark-blue, @golden);
color: light-dark(@beige, @dark-blue); color: light-dark(@beige, @dark-blue);
padding: 2px; padding: 2px;
} }
&.grid-active { &.grid-active {
border-radius: 3px 32px 32px 3px; border-radius: 3px 32px 32px 3px;
background-color: light-dark(@dark-blue, @golden); background-color: light-dark(@dark-blue, @golden);
color: light-dark(@beige, @dark-blue); color: light-dark(@beige, @dark-blue);
padding: 2px; padding: 2px;
} }
} }
} }
} }
.items-section { .items-section {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 10%, black 98%, transparent 100%); mask-image: linear-gradient(0deg, transparent 0%, black 10%, black 98%, transparent 100%);
padding: 20px 0; padding: 20px 0;
height: 90%; height: 90%;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent; scrollbar-color: light-dark(@dark-blue, @golden) transparent;
} }
} }
} }

View file

@ -1,32 +1,32 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.window-content { .window-content {
display: grid; display: grid;
grid-template-columns: 275px 1fr; grid-template-columns: 275px 1fr;
grid-template-rows: 283px 1fr; grid-template-rows: 283px 1fr;
gap: 15px 0; gap: 15px 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
.character-sidebar-sheet { .character-sidebar-sheet {
grid-row: 1 / span 2; grid-row: 1 / span 2;
grid-column: 1; grid-column: 1;
} }
.character-header-sheet { .character-header-sheet {
grid-row: 1; grid-row: 1;
grid-column: 2; grid-column: 2;
} }
.tab { .tab {
grid-row: 2; grid-row: 2;
grid-column: 2; grid-column: 2;
} }
.old-sheet { .old-sheet {
width: 500px; width: 500px;
} }
} }
} }

View file

@ -1,283 +1,283 @@
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.character-sidebar-sheet { .character-sidebar-sheet {
width: 275px; width: 275px;
min-width: 275px; min-width: 275px;
border-right: 1px solid light-dark(@dark-blue, @golden); border-right: 1px solid light-dark(@dark-blue, @golden);
background-image: url('../assets/parchments/dh-parchment-dark.png'); background-image: url('../assets/parchments/dh-parchment-dark.png');
.theme-light & { .theme-light & {
background: transparent; background: transparent;
} }
img { img {
height: 235px; height: 235px;
width: 275px; width: 275px;
border-bottom: 1px solid light-dark(@dark-blue, @golden); border-bottom: 1px solid light-dark(@dark-blue, @golden);
cursor: pointer; cursor: pointer;
object-fit: cover; object-fit: cover;
} }
.info-section { .info-section {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
top: -20px; top: -20px;
gap: 30px; gap: 30px;
margin-bottom: -10px; margin-bottom: -10px;
.resources-section { .resources-section {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
.status-bar { .status-bar {
position: relative; position: relative;
width: 100px; width: 100px;
height: 40px; height: 40px;
justify-items: center; justify-items: center;
.status-label { .status-label {
position: relative; position: relative;
top: 40px; top: 40px;
height: 22px; height: 22px;
width: 79px; width: 79px;
clip-path: path('M0 0H79L74 16.5L39 22L4 16.5L0 0Z'); clip-path: path('M0 0H79L74 16.5L39 22L4 16.5L0 0Z');
background: light-dark(@dark-blue, @golden); background: light-dark(@dark-blue, @golden);
h4 { h4 {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
line-height: 18px; line-height: 18px;
color: light-dark(@beige, @dark-blue); color: light-dark(@beige, @dark-blue);
} }
} }
.status-value { .status-value {
position: absolute; position: absolute;
display: flex; display: flex;
padding: 0 6px; padding: 0 6px;
font-size: 1.5rem; font-size: 1.5rem;
align-items: center; align-items: center;
width: 100px; width: 100px;
height: 40px; height: 40px;
justify-content: center; justify-content: center;
text-align: center; text-align: center;
z-index: 2; z-index: 2;
color: @beige; color: @beige;
input[type='number'] { input[type='number'] {
background: transparent; background: transparent;
font-size: 1.5rem; font-size: 1.5rem;
width: 40px; width: 40px;
height: 30px; height: 30px;
text-align: center; text-align: center;
border: none; border: none;
outline: 2px solid transparent; outline: 2px solid transparent;
color: @beige; color: @beige;
&.bar-input { &.bar-input {
padding: 0; padding: 0;
color: @beige; color: @beige;
backdrop-filter: none; backdrop-filter: none;
background: transparent; background: transparent;
transition: all 0.3s ease; transition: all 0.3s ease;
&:hover, &:hover,
&:focus { &:focus {
background: @semi-transparent-dark-blue; background: @semi-transparent-dark-blue;
backdrop-filter: blur(9.5px); backdrop-filter: blur(9.5px);
} }
} }
} }
.bar-label { .bar-label {
width: 40px; width: 40px;
} }
} }
.progress-bar { .progress-bar {
position: absolute; position: absolute;
appearance: none; appearance: none;
width: 100px; width: 100px;
height: 40px; height: 40px;
border: 1px solid light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px; border-radius: 6px;
z-index: 1; z-index: 1;
&::-webkit-progress-bar { &::-webkit-progress-bar {
border: none; border: none;
background: @dark-blue; background: @dark-blue;
border-radius: 6px; border-radius: 6px;
} }
&::-webkit-progress-value { &::-webkit-progress-value {
background: @gradient-hp; background: @gradient-hp;
border-radius: 6px; border-radius: 6px;
} }
&.stress-color::-webkit-progress-value { &.stress-color::-webkit-progress-value {
background: @gradient-stress; background: @gradient-stress;
border-radius: 6px; border-radius: 6px;
} }
&::-moz-progress-value, &::-moz-progress-value,
&::-moz-progress-bar { &::-moz-progress-bar {
border-radius: 6px; border-radius: 6px;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
background: @gradient-hp; background: @gradient-hp;
} }
&.stress-color::-moz-progress-bar { &.stress-color::-moz-progress-bar {
background: @gradient-stress; background: @gradient-stress;
border-radius: 6px; border-radius: 6px;
} }
} }
} }
} }
.status-section { .status-section {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 5px; gap: 5px;
justify-content: center; justify-content: center;
.status-number { .status-number {
justify-items: center; justify-items: center;
.status-value { .status-value {
position: relative; position: relative;
display: flex; display: flex;
width: 50px; width: 50px;
height: 30px; height: 30px;
border: 1px solid light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark-blue, @golden);
border-bottom: none; border-bottom: none;
border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0;
padding: 0 6px; padding: 0 6px;
font-size: 1.2rem; font-size: 1.2rem;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: light-dark(transparent, @dark-blue); background: light-dark(transparent, @dark-blue);
z-index: 2; z-index: 2;
&.armor-slots { &.armor-slots {
width: 80px; width: 80px;
height: 30px; height: 30px;
} }
} }
.status-label { .status-label {
padding: 2px 10px; padding: 2px 10px;
width: 100%; width: 100%;
border-radius: 3px; border-radius: 3px;
background: light-dark(@dark-blue, @golden); background: light-dark(@dark-blue, @golden);
h4 { h4 {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
line-height: 18px; line-height: 18px;
font-size: 12px; font-size: 12px;
color: light-dark(@beige, @dark-blue); color: light-dark(@beige, @dark-blue);
} }
} }
} }
} }
} }
.items-sidebar-list { .items-sidebar-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 5px; gap: 5px;
.inventory-item { .inventory-item {
padding: 0 10px; padding: 0 10px;
} }
} }
.equipment-section { .equipment-section {
.title { .title {
display: flex; display: flex;
gap: 15px; gap: 15px;
align-items: center; align-items: center;
h3 { h3 {
font-size: 20px; font-size: 20px;
} }
} }
.items-list { .items-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
} }
} }
.loadout-section { .loadout-section {
.title { .title {
display: flex; display: flex;
gap: 15px; gap: 15px;
align-items: center; align-items: center;
h3 { h3 {
font-size: 20px; font-size: 20px;
} }
} }
} }
.experience-section { .experience-section {
.title { .title {
display: flex; display: flex;
gap: 15px; gap: 15px;
align-items: center; align-items: center;
h3 { h3 {
font-size: 20px; font-size: 20px;
} }
} }
.experience-list { .experience-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 5px; gap: 5px;
width: 100%; width: 100%;
margin-top: 10px; margin-top: 10px;
align-items: center; align-items: center;
.experience-row { .experience-row {
display: flex; display: flex;
gap: 5px; gap: 5px;
width: 250px; width: 250px;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
input[type='text'] { input[type='text'] {
height: 32px; height: 32px;
width: 180px; width: 180px;
border: 1px solid transparent; border: 1px solid transparent;
outline: 2px solid transparent; outline: 2px solid transparent;
font-size: 14px; font-size: 14px;
font-family: @font-body; font-family: @font-body;
transition: all 0.3s ease; transition: all 0.3s ease;
color: light-dark(@dark, @beige); color: light-dark(@dark, @beige);
&:hover { &:hover {
outline: 2px solid light-dark(@dark, @beige); outline: 2px solid light-dark(@dark, @beige);
} }
} }
} }
.experience-value { .experience-value {
height: 25px; height: 25px;
width: 35px; width: 35px;
font-size: 14px; font-size: 14px;
font-family: @font-body; font-family: @font-body;
color: light-dark(@dark, @beige); color: light-dark(@dark, @beige);
align-content: center; align-content: center;
text-align: center; text-align: center;
background: url(../assets/svg/experience-shield.svg) no-repeat; background: url(../assets/svg/experience-shield.svg) no-repeat;
.theme-light & { .theme-light & {
background: url('../assets/svg/experience-shield-light.svg') no-repeat; background: url('../assets/svg/experience-shield-light.svg') no-repeat;
} }
} }
} }
} }
} }
} }

View file

@ -1,17 +1,17 @@
@import '../utils/colors.less'; @import '../utils/colors.less';
@import '../utils/fonts.less'; @import '../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.items-list { .items-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
} }
.card-list { .card-list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
} }
} }

View file

@ -1,133 +1,133 @@
@import '../utils/colors.less'; @import '../utils/colors.less';
@import '../utils/fonts.less'; @import '../utils/fonts.less';
.application.sheet.daggerheart.actor.dh-style.character { .application.sheet.daggerheart.actor.dh-style.character {
.inventory-item { .inventory-item {
display: grid; display: grid;
grid-template-columns: 40px 1fr 60px; grid-template-columns: 40px 1fr 60px;
gap: 10px; gap: 10px;
width: 100%; width: 100%;
.item-img { .item-img {
height: 40px; height: 40px;
width: 40px; width: 40px;
border-radius: 3px; border-radius: 3px;
border: none; border: none;
cursor: pointer; cursor: pointer;
object-fit: cover; object-fit: cover;
} }
.item-label { .item-label {
font-family: @font-body; font-family: @font-body;
align-self: center; align-self: center;
.item-name { .item-name {
font-size: 14px; font-size: 14px;
} }
.item-tags, .item-tags,
.item-labels { .item-labels {
display: flex; display: flex;
gap: 10px; gap: 10px;
.tag { .tag {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 3px 5px; padding: 3px 5px;
font-size: 12px; font-size: 12px;
background: light-dark(@dark-15, @beige-15); background: light-dark(@dark-15, @beige-15);
border: 1px solid light-dark(@dark, @beige); border: 1px solid light-dark(@dark, @beige);
border-radius: 3px; border-radius: 3px;
} }
.label { .label {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
} }
} }
} }
.controls { .controls {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: end; justify-content: end;
gap: 8px; gap: 8px;
a { a {
text-align: center; text-align: center;
&.unequipped { &.unequipped {
opacity: 0.4; opacity: 0.4;
} }
} }
} }
} }
.card-item { .card-item {
position: relative; position: relative;
height: 120px; height: 120px;
width: 100px; width: 100px;
border: 1px solid light-dark(@dark-blue, @golden); border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
.card-label { .card-label {
padding-top: 15px; padding-top: 15px;
.controls { .controls {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
transition: all 0.3s ease; transition: all 0.3s ease;
max-height: 16px; max-height: 16px;
} }
} }
} }
.card-img { .card-img {
height: 100%; height: 100%;
width: 100%; width: 100%;
object-fit: cover; object-fit: cover;
} }
.card-label { .card-label {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: fit-content; height: fit-content;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
width: 100%; width: 100%;
position: absolute; position: absolute;
background-color: @dark-blue; background-color: @dark-blue;
bottom: 0; bottom: 0;
mask-image: linear-gradient(180deg, transparent 0%, black 20%); mask-image: linear-gradient(180deg, transparent 0%, black 20%);
.card-name { .card-name {
font-family: @font-body; font-family: @font-body;
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-size: 12px; font-size: 12px;
line-height: 15px; line-height: 15px;
color: @beige; color: @beige;
} }
.controls { .controls {
display: flex; display: flex;
gap: 15px; gap: 15px;
align-items: center; align-items: center;
max-height: 0px; max-height: 0px;
opacity: 0; opacity: 0;
visibility: collapse; visibility: collapse;
transition: all 0.3s ease; transition: all 0.3s ease;
color: @beige; color: @beige;
} }
} }
} }
} }

View file

@ -1,18 +1,18 @@
@import '../utils/colors.less'; @import '../utils/colors.less';
@import '../utils/fonts.less'; @import '../utils/fonts.less';
.sheet.daggerheart.dh-style { .sheet.daggerheart.dh-style {
.tab-navigation { .tab-navigation {
margin: 5px 0; margin: 5px 0;
height: 40px; height: 40px;
.feature-tab { .feature-tab {
border: none; border: none;
a { a {
color: light-dark(@dark-blue, @golden); color: light-dark(@dark-blue, @golden);
font-family: @font-body; font-family: @font-body;
} }
} }
} }
} }

View file

@ -1,21 +1,21 @@
@primary-blue: #1488cc; @primary-blue: #1488cc;
@secondary-blue: #2b32b2; @secondary-blue: #2b32b2;
@golden: #f3c267; @golden: #f3c267;
@golden-40: #f3c26740; @golden-40: #f3c26740;
@dark-blue-40: #18162e40; @dark-blue-40: #18162e40;
@golden-10: #f3c26710; @golden-10: #f3c26710;
@dark-blue-10: #18162e10; @dark-blue-10: #18162e10;
@dark-blue-50: #18162e50; @dark-blue-50: #18162e50;
@dark-blue: #18162e; @dark-blue: #18162e;
@deep-black: #0e0d15; @deep-black: #0e0d15;
@beige: #efe6d8; @beige: #efe6d8;
@beige-15: #efe6d815; @beige-15: #efe6d815;
@beige-50: #efe6d850; @beige-50: #efe6d850;
@dark-blue: rgb(24, 22, 46); @dark-blue: rgb(24, 22, 46);
@semi-transparent-dark-blue: rgba(24, 22, 46, 0.33); @semi-transparent-dark-blue: rgba(24, 22, 46, 0.33);
@dark: #222; @dark: #222;
@dark-15: #22222215; @dark-15: #22222215;
@light-black: rgba(0, 0, 0, 0.3); @light-black: rgba(0, 0, 0, 0.3);
@soft-shadow: rgba(0, 0, 0, 0.05); @soft-shadow: rgba(0, 0, 0, 0.05);
@gradient-hp: linear-gradient(15deg, rgb(70, 20, 10) 0%, rgb(190, 0, 0) 42%, rgb(252, 176, 69) 100%); @gradient-hp: linear-gradient(15deg, rgb(70, 20, 10) 0%, rgb(190, 0, 0) 42%, rgb(252, 176, 69) 100%);
@gradient-stress: linear-gradient(15deg, rgb(130, 59, 1) 0%, rgb(252, 142, 69) 65%, rgb(190, 0, 0) 100%); @gradient-stress: linear-gradient(15deg, rgb(130, 59, 1) 0%, rgb(252, 142, 69) 65%, rgb(190, 0, 0) 100%);

View file

@ -0,0 +1,76 @@
<div class="damage-reduction-container">
<div class="section-container padded">
<div class="resources-container">
<div class="resource-container">
<h4 class="armor-title">{{localize "DAGGERHEART.DamageReduction.ArmorMarks"}}</h4>
<div class="markers-subtitle">{{armorMarks}}/{{armorScore}}</div>
</div>
{{#if this.stress}}
<div class="resource-container">
<h4 class="armor-title">{{localize "DAGGERHEART.DamageReduction.Stress"}}</h4>
<div class="markers-subtitle">{{this.stress.value}}/{{this.stress.maxTotal}}</div>
</div>
{{/if}}
</div>
</div>
<div class="section-container">
<h4 class="mark-selection divider">
<div class="mark-selection-inner">
{{#each marks.armor}}
<div
class="mark-container {{#if this.selected}}selected{{/if}}"
data-action="setMarks" data-key="{{@key}}" data-type="armor"
>
<i class="fa-solid fa-shield"></i>
</div>
{{/each}}
</div>
<div class="mark-selection-inner">
{{#each marks.stress}}
<div
class="mark-container {{#if this.selected}}selected{{/if}} {{#if (not @root.basicMarksUsed)}}inactive{{/if}}"
{{#if @root.basicMarksUsed}}data-action="setMarks"{{/if}} data-key="{{@key}}" data-type="stress" data-tooltip="{{#if @root.basicMarksUsed}}{{localize "DAGGERHEART.DamageReduction.ArmorWithStress"}}{{else}}{{localize "DAGGERHEART.DamageReduction.UnncessaryStress"}}{{/if}}"
>
<i class="fa-solid fa-bolt"></i>
</div>
{{/each}}
</div>
</h4>
<div class="markers-subtitle bold">{{localize "DAGGERHEART.DamageReduction.UsedMarks"}}</div>
</div>
<div class="resources-container">
<div class="resource-container">
<h4 class="armor-title">{{localize "DAGGERHEART.DamageReduction.StressReduction"}}</h4>
</div>
</div>
{{#each availableStressReductions}}
<div class="section-container">
<h4 class="stress-reduction-container divider">
<div class="stress-reduction {{#if (eq this.from @root.currentDamage)}}active{{/if}} {{#if this.selected}}selected{{/if}}" data-action="useStressReduction" data-reduction="{{@key}}">
{{this.from}}
<i class="fa-solid fa-arrow-right-long"></i>
{{this.to}}
<div class="stress-reduction-cost">
{{this.cost}}
<i class="fa-solid fa-bolt"></i>
</div>
</div>
</h4>
</div>
{{/each}}
<footer class="padded">
<button type="button" data-action="takeDamage">
{{localize "Take"}}
<div class="damage-value {{#if this.reducedDamage}}reduced-value{{/if}}">{{this.damage}}</div>
{{#if this.reducedDamage}}
<i class="fa-solid fa-arrow-right-long"></i>
<div class="damage-value">{{this.reducedDamage}}</div>
{{/if}}
{{localize "Damage"}}
</button>
</footer>
</div>