mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
[V14] Refactor ArmorChange schema and fix some bugs (#1742)
* Refactor ArmorChange schema and fix some bugs * Add current back to schema * Fixed so changing armor values and taking damage works again * Fixed so that scrolltexts for armor changes work again * Removed old marks on armor.system * Restored damageReductionDialog armorScore.value * Use toggle for css class addition/removal * Fix armor change type choices * Added ArmorChange DamageThresholds --------- Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
6193153596
commit
50dcbf4396
68 changed files with 356 additions and 428 deletions
|
|
@ -1891,7 +1891,7 @@
|
|||
"armor": {
|
||||
"newArmorEffect": "Armor Effect",
|
||||
"FIELDS": {
|
||||
"armorInteraction": {
|
||||
"interaction": {
|
||||
"label": "Armor Interaction",
|
||||
"hint": "Does the character wearing armor suppress this effect?"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
|
|||
true
|
||||
);
|
||||
const armor = orderedArmorEffects.reduce((acc, effect) => {
|
||||
const { value, max } = effect.system.armorData;
|
||||
const { current, max } = effect.system.armorData;
|
||||
acc.push({
|
||||
effect: effect,
|
||||
marks: [...Array(max).keys()].reduce((acc, _, index) => {
|
||||
const spent = index < value;
|
||||
const spent = index < current;
|
||||
acc[foundry.utils.randomID()] = { selected: false, disabled: spent, spent };
|
||||
return acc;
|
||||
}, {})
|
||||
|
|
|
|||
|
|
@ -154,6 +154,10 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
htmlElement
|
||||
.querySelector('.armor-change-checkbox')
|
||||
?.addEventListener('change', this.armorChangeToggle.bind(this));
|
||||
|
||||
htmlElement
|
||||
.querySelector('.armor-damage-thresholds-checkbox')
|
||||
?.addEventListener('change', this.armorDamageThresholdToggle.bind(this));
|
||||
}
|
||||
|
||||
async _prepareContext(options) {
|
||||
|
|
@ -190,23 +194,14 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
}));
|
||||
break;
|
||||
case 'changes':
|
||||
const fields = this.document.system.schema.fields.changes.element.fields;
|
||||
|
||||
const singleTypes = ['armor'];
|
||||
const { base, ...typedChanges } = context.source.changes.reduce((acc, change, index) => {
|
||||
const type = CONFIG.DH.GENERAL.baseActiveEffectModes[change.type] ? 'base' : change.type;
|
||||
if (singleTypes.includes(type)) {
|
||||
acc[type] = { ...change, index };
|
||||
} else {
|
||||
if (!acc[type]) acc[type] = [];
|
||||
acc[type].push({ ...change, index });
|
||||
const typedChanges = context.source.changes.reduce((acc, change, index) => {
|
||||
if (singleTypes.includes(change.type)) {
|
||||
acc[change.type] = { ...change, index };
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
partContext.changes = await Promise.all(
|
||||
foundry.utils.deepClone(base ?? []).map(c => this._prepareChangeContext(c, fields))
|
||||
);
|
||||
partContext.changes = partContext.changes.filter(c => !!c);
|
||||
partContext.typedChanges = typedChanges;
|
||||
break;
|
||||
}
|
||||
|
|
@ -238,29 +233,51 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
return this.submit({ updateData: { system: { changes } } });
|
||||
}
|
||||
|
||||
_prepareChangeContext(change, fields) {
|
||||
armorDamageThresholdToggle(event) {
|
||||
const submitData = this._processFormData(null, this.form, new FormDataExtended(this.form));
|
||||
const changes = Object.values(submitData.system?.changes ?? {});
|
||||
const index = Number(event.target.dataset.index);
|
||||
if (event.target.checked) {
|
||||
changes[index].value.damageThresholds = { major: 0, severe: 0 };
|
||||
} else {
|
||||
changes[index].value.damageThresholds = null;
|
||||
}
|
||||
|
||||
return this.submit({ updateData: { system: { changes } } });
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
_renderChange(context) {
|
||||
const { change, index, defaultPriority } = context;
|
||||
if (!(change.type in CONFIG.DH.GENERAL.baseActiveEffectModes)) return null;
|
||||
|
||||
const changeTypesSchema = this.document.system.schema.fields.changes.element.types;
|
||||
const fields = context.fields ?? (changeTypesSchema[change.type] ?? changeTypesSchema.add).fields;
|
||||
if (typeof change.value !== 'string') change.value = JSON.stringify(change.value);
|
||||
const defaultPriority = game.system.api.documents.DhActiveEffect.CHANGE_TYPES[change.type]?.defaultPriority;
|
||||
Object.assign(
|
||||
change,
|
||||
['key', 'type', 'value', 'priority'].reduce((paths, fieldName) => {
|
||||
paths[`${fieldName}Path`] = `system.changes.${change.index}.${fieldName}`;
|
||||
paths[`${fieldName}Path`] = `system.changes.${index}.${fieldName}`;
|
||||
return paths;
|
||||
}, {})
|
||||
);
|
||||
return (
|
||||
game.system.api.documents.DhActiveEffect.CHANGE_TYPES[change.type].render?.(
|
||||
change,
|
||||
change.index,
|
||||
index,
|
||||
defaultPriority
|
||||
) ??
|
||||
foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/activeEffect/change.hbs',
|
||||
{
|
||||
change,
|
||||
index: change.index,
|
||||
index,
|
||||
defaultPriority,
|
||||
fields
|
||||
fields,
|
||||
types: Object.keys(CONFIG.DH.GENERAL.baseActiveEffectModes).reduce((r, key) => {
|
||||
r[key] = CONFIG.DH.GENERAL.baseActiveEffectModes[key].label;
|
||||
return r;
|
||||
}, {})
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1003,16 +1003,16 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const effect = await foundry.utils.fromUuid(event.target.dataset.uuid);
|
||||
const armorChange = effect.system.armorChange;
|
||||
if (!armorChange) return;
|
||||
const value = Math.max(Math.min(Number.parseInt(event.target.value), effect.system.armorData.max), 0);
|
||||
const current = Math.max(Math.min(Number.parseInt(event.target.value), effect.system.armorData.max), 0);
|
||||
|
||||
const newChanges = effect.system.changes.map(change => ({
|
||||
...change,
|
||||
value: change.type === 'armor' ? value : change.value
|
||||
value: change.type === 'armor' ? { ...change.value, current } : change.value
|
||||
}));
|
||||
|
||||
event.target.value = value;
|
||||
event.target.value = current;
|
||||
const progressBar = event.target.closest('.status-bar.armor-slots').querySelector('progress');
|
||||
progressBar.value = value;
|
||||
progressBar.value = current;
|
||||
|
||||
await effect.update({ 'system.changes': newChanges });
|
||||
}
|
||||
|
|
@ -1023,27 +1023,22 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const armorChange = effect.system.armorChange;
|
||||
if (!armorChange) return;
|
||||
|
||||
const { value } = effect.system.armorData;
|
||||
const { current } = effect.system.armorData;
|
||||
|
||||
const inputValue = Number.parseInt(target.dataset.value);
|
||||
const decreasing = value >= inputValue;
|
||||
const newValue = decreasing ? inputValue - 1 : inputValue;
|
||||
const decreasing = current >= inputValue;
|
||||
const newCurrent = decreasing ? inputValue - 1 : inputValue;
|
||||
|
||||
const newChanges = effect.system.changes.map(change => ({
|
||||
...change,
|
||||
value: change.type === 'armor' ? newValue : change.value
|
||||
value: change.type === 'armor' ? { ...change.value, current: newCurrent } : change.value
|
||||
}));
|
||||
|
||||
const container = target.closest('.slot-bar');
|
||||
for (const armorSlot of container.querySelectorAll('.armor-slot i')) {
|
||||
const index = Number.parseInt(armorSlot.dataset.index);
|
||||
if (decreasing && index >= newValue) {
|
||||
armorSlot.classList.remove('fa-shield');
|
||||
armorSlot.classList.add('fa-shield-halved');
|
||||
} else if (!decreasing && index < newValue) {
|
||||
armorSlot.classList.add('fa-shield');
|
||||
armorSlot.classList.remove('fa-shield-halved');
|
||||
}
|
||||
const marked = !decreasing && Number.parseInt(armorSlot.dataset.index) < newCurrent;
|
||||
armorSlot.classList.toggle('fa-shield', marked);
|
||||
armorSlot.classList.toggle('fa-shield-halved', !marked);
|
||||
}
|
||||
|
||||
await effect.update({ 'system.changes': newChanges });
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
|||
context.armorScore = this.document.system.armorData.max;
|
||||
break;
|
||||
case 'effects':
|
||||
context.effects.actives = context.effects.actives.filter(x => x.type !== 'armor');
|
||||
context.effects.inactives = context.effects.actives.filter(x => x.type !== 'armor');
|
||||
context.effects.actives = context.effects.actives.filter(x => !x.system.armorData);
|
||||
context.effects.inactives = context.effects.inactives.filter(x => !x.system.armorData);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
|||
const armorEffect = this.document.system.armorEffect;
|
||||
if (Number.isNaN(value) || !armorEffect) return;
|
||||
|
||||
await armorEffect.system.armorChange.typeData.updateArmorMax(value);
|
||||
await armorEffect.system.armorChange.updateArmorMax(value);
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,29 +12,41 @@
|
|||
* "Anything that uses another data model value as its value": +1 - Effects that increase traits have to be calculated first at Base priority. (EX: Raise evasion by half your agility)
|
||||
*/
|
||||
|
||||
import { getScrollTextData } from '../../helpers/utils.mjs';
|
||||
import { changeTypes } from './_module.mjs';
|
||||
|
||||
export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
const baseChanges = Object.keys(CONFIG.DH.GENERAL.baseActiveEffectModes).reduce((r, type) => {
|
||||
r[type] = new fields.SchemaField({
|
||||
key: new fields.StringField({ required: true }),
|
||||
type: new fields.StringField({
|
||||
required: true,
|
||||
choices: [type],
|
||||
initial: type,
|
||||
validate: BaseEffect.#validateType
|
||||
}),
|
||||
value: new fields.AnyField({
|
||||
required: true,
|
||||
nullable: true,
|
||||
serializable: true,
|
||||
initial: ''
|
||||
}),
|
||||
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
|
||||
priority: new fields.NumberField()
|
||||
});
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
changes: new fields.ArrayField(
|
||||
new fields.SchemaField({
|
||||
key: new fields.StringField({ required: true }),
|
||||
type: new fields.StringField({
|
||||
required: true,
|
||||
blank: false,
|
||||
choices: CONFIG.DH.GENERAL.activeEffectModes,
|
||||
initial: CONFIG.DH.GENERAL.activeEffectModes.add.id,
|
||||
validate: BaseEffect.#validateType
|
||||
}),
|
||||
value: new fields.AnyField({ required: true, nullable: true, serializable: true, initial: '' }),
|
||||
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
|
||||
priority: new fields.NumberField(),
|
||||
typeData: new fields.TypedSchemaField(changeTypes, { nullable: true, initial: null })
|
||||
})
|
||||
new fields.TypedSchemaField(
|
||||
{ ...changeTypes, ...baseChanges },
|
||||
{ initial: baseChanges.add.getInitialValue() }
|
||||
)
|
||||
),
|
||||
duration: new fields.SchemaField({
|
||||
type: new fields.StringField({
|
||||
|
|
@ -89,6 +101,12 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
|||
return true;
|
||||
}
|
||||
|
||||
get isSuppressed() {
|
||||
for (const change of this.changes) {
|
||||
if (change.isSuppressed) return true;
|
||||
}
|
||||
}
|
||||
|
||||
get armorChange() {
|
||||
return this.changes.find(x => x.type === CONFIG.DH.GENERAL.activeEffectModes.armor.id);
|
||||
}
|
||||
|
|
@ -97,7 +115,7 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
|||
const armorChange = this.armorChange;
|
||||
if (!armorChange) return null;
|
||||
|
||||
return armorChange.typeData.getArmorData(armorChange);
|
||||
return armorChange.getArmorData();
|
||||
}
|
||||
|
||||
static getDefaultObject() {
|
||||
|
|
@ -119,4 +137,31 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
async _preUpdate(changed, options, userId) {
|
||||
const allowed = await super._preUpdate(changed, options, userId);
|
||||
if (allowed === false) return false;
|
||||
|
||||
const autoSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||
if (
|
||||
autoSettings.resourceScrollTexts &&
|
||||
this.parent.actor?.type === 'character' &&
|
||||
this.parent.actor.system.resources.armor
|
||||
) {
|
||||
const newArmorTotal = (changed.system?.changes ?? []).reduce((acc, change) => {
|
||||
if (change.type === 'armor') acc += change.value.current;
|
||||
return acc;
|
||||
}, 0);
|
||||
|
||||
const armorData = getScrollTextData(this.parent.actor, { value: newArmorTotal }, 'armor');
|
||||
options.scrollingTextData = [armorData];
|
||||
}
|
||||
}
|
||||
|
||||
_onUpdate(changed, options, userId) {
|
||||
super._onUpdate(changed, options, userId);
|
||||
|
||||
if (this.parent.actor && options.scrollingTextData)
|
||||
this.parent.actor.queueScrollText(options.scrollingTextData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,39 +2,56 @@ import { itemAbleRollParse } from '../../../helpers/utils.mjs';
|
|||
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
export default class Armor extends foundry.abstract.DataModel {
|
||||
export default class ArmorChange extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
return {
|
||||
type: new fields.StringField({ required: true, initial: 'armor', blank: false }),
|
||||
max: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
initial: '1',
|
||||
label: 'DAGGERHEART.GENERAL.max'
|
||||
}),
|
||||
armorInteraction: new fields.StringField({
|
||||
required: true,
|
||||
choices: CONFIG.DH.GENERAL.activeEffectArmorInteraction,
|
||||
initial: CONFIG.DH.GENERAL.activeEffectArmorInteraction.none.id,
|
||||
label: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.label',
|
||||
hint: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.hint'
|
||||
type: new fields.StringField({ required: true, choices: ['armor'], initial: 'armor' }),
|
||||
priority: new fields.NumberField(),
|
||||
phase: new fields.StringField({ required: true, blank: false, initial: 'initial' }),
|
||||
value: new fields.SchemaField({
|
||||
current: new fields.NumberField({ integer: true, min: 0, initial: 0 }),
|
||||
max: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
initial: '1',
|
||||
label: 'DAGGERHEART.GENERAL.max'
|
||||
}),
|
||||
damageThresholds: new fields.SchemaField(
|
||||
{
|
||||
major: new fields.StringField({
|
||||
initial: '0',
|
||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.majorThreshold'
|
||||
}),
|
||||
severe: new fields.StringField({
|
||||
initial: '0',
|
||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.severeThreshold'
|
||||
})
|
||||
},
|
||||
{ nullable: true, initial: null }
|
||||
),
|
||||
interaction: new fields.StringField({
|
||||
required: true,
|
||||
choices: CONFIG.DH.GENERAL.activeEffectArmorInteraction,
|
||||
initial: CONFIG.DH.GENERAL.activeEffectArmorInteraction.none.id,
|
||||
label: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.label',
|
||||
hint: 'DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.hint'
|
||||
})
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
static changeEffect = {
|
||||
label: 'Armor',
|
||||
defaultPriortiy: 20,
|
||||
defaultPriority: 20,
|
||||
handler: (actor, change, _options, _field, replacementData) => {
|
||||
const parsedMax = itemAbleRollParse(change.typeData.max, actor, change.effect.parent);
|
||||
|
||||
const parsedMax = itemAbleRollParse(change.value.max, actor, change.effect.parent);
|
||||
game.system.api.documents.DhActiveEffect.applyChange(
|
||||
actor,
|
||||
{
|
||||
...change,
|
||||
key: 'system.armorScore.value',
|
||||
type: CONFIG.DH.GENERAL.activeEffectModes.add.id,
|
||||
value: change.value
|
||||
value: change.value.current
|
||||
},
|
||||
replacementData
|
||||
);
|
||||
|
|
@ -48,13 +65,52 @@ export default class Armor extends foundry.abstract.DataModel {
|
|||
},
|
||||
replacementData
|
||||
);
|
||||
|
||||
if (change.value.damageThresholds) {
|
||||
const getThresholdValue = value => {
|
||||
const parsed = itemAbleRollParse(value, actor, change.effect.parent);
|
||||
const roll = new Roll(parsed).evaluateSync();
|
||||
return roll ? (roll.isDeterministic ? roll.total : null) : null;
|
||||
};
|
||||
const major = getThresholdValue(change.value.damageThresholds.major);
|
||||
const severe = getThresholdValue(change.value.damageThresholds.severe);
|
||||
|
||||
if (major) {
|
||||
game.system.api.documents.DhActiveEffect.applyChange(
|
||||
actor,
|
||||
{
|
||||
...change,
|
||||
key: 'system.damageThresholds.major',
|
||||
type: CONFIG.DH.GENERAL.activeEffectModes.override.id,
|
||||
priority: 50,
|
||||
value: major
|
||||
},
|
||||
replacementData
|
||||
);
|
||||
}
|
||||
|
||||
if (severe) {
|
||||
game.system.api.documents.DhActiveEffect.applyChange(
|
||||
actor,
|
||||
{
|
||||
...change,
|
||||
key: 'system.damageThresholds.severe',
|
||||
type: CONFIG.DH.GENERAL.activeEffectModes.override.id,
|
||||
priority: 50,
|
||||
value: severe
|
||||
},
|
||||
replacementData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
render: null
|
||||
};
|
||||
|
||||
get isSuppressed() {
|
||||
switch (this.armorInteraction) {
|
||||
switch (this.value.interaction) {
|
||||
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.active.id:
|
||||
return !this.parent.parent?.actor.system.armor;
|
||||
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.inactive.id:
|
||||
|
|
@ -64,15 +120,12 @@ export default class Armor extends foundry.abstract.DataModel {
|
|||
}
|
||||
}
|
||||
|
||||
static getInitialValue(locked) {
|
||||
static getInitialValue() {
|
||||
return {
|
||||
key: 'Armor',
|
||||
type: CONFIG.DH.GENERAL.activeEffectModes.armor.id,
|
||||
value: 0,
|
||||
typeData: {
|
||||
type: 'armor',
|
||||
max: 0,
|
||||
locked
|
||||
value: {
|
||||
current: 0,
|
||||
max: 0
|
||||
},
|
||||
phase: 'initial',
|
||||
priority: 20
|
||||
|
|
@ -84,22 +137,22 @@ export default class Armor extends foundry.abstract.DataModel {
|
|||
name: game.i18n.localize('DAGGERHEART.EFFECTS.ChangeTypes.armor.newArmorEffect'),
|
||||
img: 'icons/equipment/chest/breastplate-helmet-metal.webp',
|
||||
system: {
|
||||
changes: [Armor.getInitialValue(true)]
|
||||
changes: [ArmorChange.getInitialValue()]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
|
||||
getArmorData(parentChange) {
|
||||
getArmorData() {
|
||||
const actor = this.parent.parent?.actor?.type === 'character' ? this.parent.parent.actor : null;
|
||||
const maxParse = actor ? itemAbleRollParse(this.max, actor, this.parent.parent.parent) : null;
|
||||
const maxParse = actor ? itemAbleRollParse(this.value.max, actor, this.parent.parent.parent) : null;
|
||||
const maxRoll = maxParse ? new Roll(maxParse).evaluateSync() : null;
|
||||
const maxEvaluated = maxRoll ? (maxRoll.isDeterministic ? maxRoll.total : null) : null;
|
||||
|
||||
return {
|
||||
value: parentChange.value,
|
||||
max: maxEvaluated ?? this.max
|
||||
current: this.value.current,
|
||||
max: maxEvaluated ?? this.value.max
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -107,8 +160,14 @@ export default class Armor extends foundry.abstract.DataModel {
|
|||
const newChanges = [
|
||||
...this.parent.changes.map(change => ({
|
||||
...change,
|
||||
value: change.type === 'armor' ? Math.min(change.value, newMax) : change.value,
|
||||
typeData: change.type === 'armor' ? { ...change.typeData, max: newMax } : change.typeData
|
||||
value:
|
||||
change.type === 'armor'
|
||||
? {
|
||||
...change.value,
|
||||
current: Math.min(change.value.current, newMax),
|
||||
max: newMax
|
||||
}
|
||||
: change.value
|
||||
}))
|
||||
];
|
||||
await this.parent.parent.update({ 'system.changes': newChanges });
|
||||
|
|
|
|||
|
|
@ -42,15 +42,15 @@ export default class DhCharacter extends DhCreature {
|
|||
}),
|
||||
evasion: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.evasion' }),
|
||||
damageThresholds: new fields.SchemaField({
|
||||
severe: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.severeThreshold'
|
||||
}),
|
||||
major: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.majorThreshold'
|
||||
}),
|
||||
severe: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.severeThreshold'
|
||||
})
|
||||
}),
|
||||
experiences: new fields.TypedObjectField(
|
||||
|
|
@ -479,14 +479,14 @@ export default class DhCharacter extends DhCreature {
|
|||
for (const armorEffect of orderedEffects) {
|
||||
let usedArmorChange = 0;
|
||||
if (clear) {
|
||||
usedArmorChange -= armorEffect.system.armorChange.value;
|
||||
usedArmorChange -= armorEffect.system.armorChange.value.current;
|
||||
} else {
|
||||
if (increasing) {
|
||||
const remainingArmor = armorEffect.system.armorData.max - armorEffect.system.armorData.value;
|
||||
const remainingArmor = armorEffect.system.armorData.max - armorEffect.system.armorData.current;
|
||||
usedArmorChange = Math.min(remainingChange, remainingArmor);
|
||||
remainingChange -= usedArmorChange;
|
||||
} else {
|
||||
const changeChange = Math.min(armorEffect.system.armorData.value, remainingChange);
|
||||
const changeChange = Math.min(armorEffect.system.armorData.current, remainingChange);
|
||||
usedArmorChange -= changeChange;
|
||||
remainingChange -= changeChange;
|
||||
}
|
||||
|
|
@ -503,7 +503,10 @@ export default class DhCharacter extends DhCreature {
|
|||
...change,
|
||||
value:
|
||||
change.type === 'armor'
|
||||
? armorEffect.system.armorChange.value + usedArmorChange
|
||||
? {
|
||||
...change.value,
|
||||
current: armorEffect.system.armorChange.value.current + usedArmorChange
|
||||
}
|
||||
: change.value
|
||||
}))
|
||||
});
|
||||
|
|
@ -519,11 +522,12 @@ export default class DhCharacter extends DhCreature {
|
|||
|
||||
async updateArmorEffectValue({ uuid, value }) {
|
||||
const effect = await foundry.utils.fromUuid(uuid);
|
||||
const effectValue = effect.system.armorChange.value;
|
||||
await effect.update({
|
||||
'system.changes': [
|
||||
{
|
||||
...effect.system.armorChange,
|
||||
value: effect.system.armorChange.value + value
|
||||
value: { ...effectValue, current: effectValue.current + value }
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ export default class DHArmor extends AttachableItem {
|
|||
actionIds: new fields.ArrayField(new fields.StringField({ required: true }))
|
||||
})
|
||||
),
|
||||
marks: new fields.SchemaField({
|
||||
value: new fields.NumberField({ initial: 0, integer: true })
|
||||
}),
|
||||
baseThresholds: new fields.SchemaField({
|
||||
major: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
severe: new fields.NumberField({ integer: true, initial: 0 })
|
||||
|
|
|
|||
|
|
@ -220,14 +220,6 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
|
||||
addLinkedItemsDiff(changed.system?.features, this.features, options);
|
||||
|
||||
const autoSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||
const armorChanged =
|
||||
changed.system?.marks?.value !== undefined && changed.system.marks.value !== this.marks.value;
|
||||
if (armorChanged && autoSettings.resourceScrollTexts && this.parent.parent?.type === 'character') {
|
||||
const armorData = getScrollTextData(this.parent.parent, changed.system.marks, 'armor');
|
||||
options.scrollingTextData = [armorData];
|
||||
}
|
||||
|
||||
if (changed.system?.actions) {
|
||||
const triggersToRemove = Object.keys(changed.system.actions).reduce((acc, key) => {
|
||||
const action = changed.system.actions[key];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { itemAbleRollParse } from '../helpers/utils.mjs';
|
||||
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
|
||||
import { RefreshType } from '../systemRegistration/socket.mjs';
|
||||
|
||||
export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -155,11 +155,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
/* Methods */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static applyChange(actor, change, options) {
|
||||
super.applyChange(actor, change, options);
|
||||
}
|
||||
|
||||
/**@inheritdoc*/
|
||||
static applyChangeField(model, change, field) {
|
||||
change.value = Number.isNumeric(change.value)
|
||||
|
|
@ -168,7 +163,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
super.applyChangeField(model, change, field);
|
||||
}
|
||||
|
||||
_applyChangeUnguided(actor, change, changes, options) {
|
||||
static _applyChangeUnguided(actor, change, changes, options) {
|
||||
change.value = DhActiveEffect.getChangeValue(actor, change, change.effect);
|
||||
super._applyChangeUnguided(actor, change, changes, options);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,15 +94,12 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "1",
|
||||
"armorInteraction": "active"
|
||||
"interaction": "active"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -21,20 +21,21 @@
|
|||
"flags": {},
|
||||
"effects": [
|
||||
{
|
||||
"name": "Bare Bones Armor",
|
||||
"name": "Bare Bones",
|
||||
"type": "base",
|
||||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"value": 0,
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "3 + @system.traits.strength.value",
|
||||
"armorInteraction": "inactive"
|
||||
"interaction": "inactive",
|
||||
"damageThresholds": {
|
||||
"major": "9 + (@tier - 1) * 5 + max(0, (@tier -2) * 2 )",
|
||||
"severe": "19 + (@tier - 1) * 5 + max(0, (@tier -2) * 2 )"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -62,57 +63,6 @@
|
|||
"compendiumSource": null
|
||||
},
|
||||
"_key": "!items.effects!l5D9kq901JDESaXw.FCsgz7Tdsw6QUzBs"
|
||||
},
|
||||
{
|
||||
"name": "Bare Bones",
|
||||
"type": "base",
|
||||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "system.damageThresholds.major",
|
||||
"type": "add",
|
||||
"value": "9 + (@tier - 1) * 5 + max(0, (@tier -2) * 2 )",
|
||||
"priority": null,
|
||||
"phase": "initial"
|
||||
},
|
||||
{
|
||||
"key": "system.damageThresholds.severe",
|
||||
"type": "add",
|
||||
"value": "19 + (@tier - 1) * 5 + max(0, (@tier -2) * 2 )",
|
||||
"priority": null,
|
||||
"phase": "initial"
|
||||
}
|
||||
],
|
||||
"rangeDependence": {
|
||||
"enabled": false,
|
||||
"type": "withinRange",
|
||||
"target": "hostile",
|
||||
"range": "melee"
|
||||
}
|
||||
},
|
||||
"_id": "8flPpWNoBeuFPFTK",
|
||||
"img": "icons/magic/control/buff-strength-muscle-damage-orange.webp",
|
||||
"disabled": false,
|
||||
"start": null,
|
||||
"duration": {
|
||||
"value": null,
|
||||
"units": "seconds",
|
||||
"expiry": null,
|
||||
"expired": false
|
||||
},
|
||||
"description": "<p>You use the following as your base damage thresholds:</p><ul><li class=\"vertical-card-list-found\"><p><em><strong>Tier 1:</strong></em> 9/19</p></li><li class=\"vertical-card-list-found\"><p><em><strong>Tier 2:</strong></em> 11/24</p></li><li class=\"vertical-card-list-found\"><p><em><strong>Tier 3:</strong></em> 13/31</p></li><li class=\"vertical-card-list-found\"><p><em><strong>Tier 4:</strong></em> 15/38</p></li></ul>",
|
||||
"origin": null,
|
||||
"tint": "#ffffff",
|
||||
"transfer": true,
|
||||
"statuses": [],
|
||||
"showIcon": 1,
|
||||
"folder": null,
|
||||
"sort": 0,
|
||||
"flags": {},
|
||||
"_stats": {
|
||||
"compendiumSource": null
|
||||
},
|
||||
"_key": "!items.effects!l5D9kq901JDESaXw.8flPpWNoBeuFPFTK"
|
||||
}
|
||||
],
|
||||
"ownership": {
|
||||
|
|
|
|||
|
|
@ -263,13 +263,10 @@
|
|||
},
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,13 +95,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,13 +70,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,13 +96,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "7"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,13 +72,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,13 +94,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,13 +87,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,13 +83,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "7"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "7"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,13 +71,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,13 +63,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,13 +70,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,13 +70,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,13 +101,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "8"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,13 +76,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,13 +63,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,13 +63,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier + 1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier + 1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier + 1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,13 +160,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,10 @@
|
|||
"system": {
|
||||
"changes": [
|
||||
{
|
||||
"key": "Armor",
|
||||
"type": "armor",
|
||||
"phase": "initial",
|
||||
"priority": 20,
|
||||
"value": 0,
|
||||
"typeData": {
|
||||
"type": "armor",
|
||||
"value": {
|
||||
"max": "ITEM.@system.tier + 1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,50 @@
|
|||
|
||||
header,
|
||||
ol {
|
||||
grid-template-columns: 6rem 6rem 12rem 4rem;
|
||||
grid-template-columns: 5rem 7rem 12rem 4rem;
|
||||
}
|
||||
|
||||
.damage-thresholds-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
.damage-threshold-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
flex: 1;
|
||||
height: 2px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, light-dark(@dark-blue, @golden) 100%);
|
||||
}
|
||||
|
||||
&::after {
|
||||
background: linear-gradient(90deg, light-dark(@dark-blue, @golden) 0%, rgba(0, 0, 0, 0) 100%);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: var(--font-size-18);
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
|
||||
label {
|
||||
color: inherit;
|
||||
line-height: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
<section class="tab scrollable{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
|
||||
{{formGroup fields.tint value=source.tint rootId=rootId placeholder="#ffffff"}}
|
||||
{{formGroup fields.description value=source.description rootId=rootId}}
|
||||
{{formGroup fields.disabled value=source.disabled rootId=rootId}}
|
||||
|
||||
{{#if isActorEffect}}
|
||||
<div class="form-group">
|
||||
<label>{{localize "EFFECT.FIELDS.origin.label"}}</label>
|
||||
<div class="form-fields">
|
||||
<input type="text" value="{{source.origin}}" disabled />
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if isItemEffect}}
|
||||
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
|
||||
{{/if}}
|
||||
|
||||
{{formGroup fields.showIcon value=source.showIcon options=showIconOptions rootId=rootId}}
|
||||
</section>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<section class='tab-form-footer padded'>
|
||||
<button type="button" data-action="finish"><i class="fa-solid fa-floppy-disk"></i> {{localize "Save"}}</button>
|
||||
</section>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<section class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
|
||||
<fieldset>
|
||||
<legend>{{localize "Armor"}}</legend>
|
||||
<div class="two-columns even">
|
||||
{{#each source.system.changes as |change index|}}
|
||||
{{formGroup @root.systemFields.changes.element.fields.value name=(concat 'system.changes.' index '.value') value=change.value localize=true}}
|
||||
{{formGroup @root.systemFields.changes.element.fields.max name=(concat 'system.changes.' index '.max') value=change.max localize=true}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.general"}}</legend>
|
||||
|
||||
{{formGroup @root.systemFields.armorInteraction name="system.armorInteraction" value=source.system.armorInteraction localize=true}}
|
||||
</fieldset>
|
||||
</section>
|
||||
|
|
@ -3,7 +3,9 @@
|
|||
<input type="text" class="effect-change-input" name="{{change.keyPath}}" value="{{change.key}}" />
|
||||
</div>
|
||||
<div class="type">
|
||||
{{formInput fields.type name=change.typePath value=change.type localize=true}}
|
||||
<select name="{{change.typePath}}">
|
||||
{{selectOptions types selected=change.type localize=true}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="value">
|
||||
{{formInput fields.value name=change.valuePath value=change.value elementType="input"}}
|
||||
|
|
|
|||
|
|
@ -17,15 +17,7 @@
|
|||
<fieldset class="armor-change-container">
|
||||
<legend>{{localize "DAGGERHEART.GENERAL.armor"}} <input type="checkbox" class="armor-change-checkbox" data-index="{{typedChanges.armor.index}}" {{checked typedChanges.armor}} /></legend>
|
||||
{{#if typedChanges.armor}}
|
||||
<header>
|
||||
<div>{{localize "EFFECT.FIELDS.changes.element.value.label"}}</div>
|
||||
<div>{{localize "DAGGERHEART.GENERAL.max"}}</div>
|
||||
<div>{{localize "DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.armorInteraction.label"}}</div>
|
||||
<div>{{localize "EFFECT.FIELDS.changes.element.priority.label"}}</div>
|
||||
</header>
|
||||
<ol class="scrollable">
|
||||
{{> "systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs" typedChanges.armor fields=@root.systemFields.changes.element.fields}}
|
||||
</ol>
|
||||
{{> "systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs" typedChanges.armor fields=@root.systemFields.changes.element.types.armor.fields}}
|
||||
{{/if}}
|
||||
</fieldset>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,28 @@
|
|||
<li data-index="{{index}}">
|
||||
<input type="hidden" name="{{concat "system.changes." index ".key"}}" value="{{key}}" />
|
||||
<input type="hidden" name="{{concat "system.changes." index ".type"}}" value="{{type}}" />
|
||||
<input type="hidden" name="{{concat "system.changes." index ".phase"}}" value="{{phase}}" />
|
||||
<input type="hidden" name="{{concat "system.changes." index ".typeData.type"}}" value="{{typeData.type}}" />
|
||||
{{formInput fields.value name=(concat "system.changes." index ".value") value=value elementType="input" data-dtype="Number"}}
|
||||
{{formInput fields.typeData.types.armor.fields.max name=(concat "system.changes." index ".typeData.max") value=typeData.max data-dtype="Number"}}
|
||||
{{formInput fields.typeData.types.armor.fields.armorInteraction name=(concat "system.changes." index ".typeData.armorInteraction") value=typeData.armorInteraction localize=true}}
|
||||
{{formInput fields.priority name=(concat "system.changes." index ".priority") value=priority}}
|
||||
</li>
|
||||
<header>
|
||||
<div>{{localize "EFFECT.FIELDS.changes.element.value.label"}}</div>
|
||||
<div>{{localize "DAGGERHEART.GENERAL.max"}}</div>
|
||||
<div>{{localize "DAGGERHEART.EFFECTS.ChangeTypes.armor.FIELDS.interaction.label"}}</div>
|
||||
<div>{{localize "EFFECT.FIELDS.changes.element.priority.label"}}</div>
|
||||
</header>
|
||||
<ol class="scrollable">
|
||||
<li data-index="{{index}}">
|
||||
<input type="hidden" name="{{concat "system.changes." index ".type"}}" value="{{type}}" />
|
||||
<input type="hidden" name="{{concat "system.changes." index ".phase"}}" value="{{phase}}" />
|
||||
{{formInput fields.value.fields.current name=(concat "system.changes." index ".value.current") value=value.current data-dtype="Number"}}
|
||||
{{formInput fields.value.fields.max name=(concat "system.changes." index ".value.max") value=value.max data-dtype="Number"}}
|
||||
{{formInput fields.value.fields.interaction name=(concat "system.changes." index ".value.interaction") value=value.interaction localize=true}}
|
||||
{{formInput fields.priority name=(concat "system.changes." index ".priority") value=priority}}
|
||||
</li>
|
||||
</ol>
|
||||
<div class="damage-thresholds-container">
|
||||
<div class="damage-threshold-title">
|
||||
<span>{{localize "DAGGERHEART.GENERAL.DamageThresholds.title"}}</span>
|
||||
<input type="checkbox" class="armor-damage-thresholds-checkbox" data-index="{{index}}" {{checked value.damageThresholds}} />
|
||||
</div>
|
||||
{{#if value.damageThresholds}}
|
||||
<div class="flexrow">
|
||||
{{formGroup fields.value.fields.damageThresholds.fields.major name=(concat "system.changes." index ".value.damageThresholds.major") value=value.damageThresholds.major localize=true }}
|
||||
{{formGroup fields.value.fields.damageThresholds.fields.severe name=(concat "system.changes." index ".value.damageThresholds.severe") value=value.damageThresholds.severe localize=true }}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
</h3>
|
||||
<h3>
|
||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
||||
{{source.system.baseScore}}
|
||||
{{source.system.armorData.max}}
|
||||
<span>-</span>
|
||||
{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}:
|
||||
{{source.system.baseThresholds.major}}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="slot-bar">
|
||||
{{#times source.max}}
|
||||
<a class='armor-slot' data-value="{{add this 1}}" data-uuid="{{source.uuid}}">
|
||||
{{#if (gte ../value (add this 1))}}
|
||||
{{#if (gte ../current (add this 1))}}
|
||||
<i class="fa-solid fa-shield" data-index="{{this}}"></i>
|
||||
{{else}}
|
||||
<i class="fa-solid fa-shield-halved" data-index="{{this}}"></i>
|
||||
|
|
@ -21,13 +21,13 @@
|
|||
<p class="armor-source-label">{{source.name}}</p>
|
||||
<div class="status-bar armor-slots">
|
||||
<div class='status-value'>
|
||||
<input class="bar-input armor-marks-input" value="{{source.value}}" data-uuid="{{source.uuid}}" type="number">
|
||||
<input class="bar-input armor-marks-input" value="{{source.current}}" data-uuid="{{source.uuid}}" type="number">
|
||||
<span>/</span>
|
||||
<span class="bar-label">{{source.max}}</span>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar stress-color'
|
||||
value='{{source.value}}'
|
||||
value='{{source.current}}'
|
||||
max='{{source.max}}'
|
||||
></progress>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue