Relocate Damage Reduction

This commit is contained in:
Dapoolp 2025-07-10 16:26:48 +02:00
parent 7b24cc01eb
commit 081ebf5bb3
4 changed files with 6 additions and 9 deletions

View file

@ -395,7 +395,7 @@ export const armorFeatures = {
img: 'icons/magic/defensive/barrier-shield-dome-pink.webp', img: 'icons/magic/defensive/barrier-shield-dome-pink.webp',
changes: [ changes: [
{ {
key: 'system.bonuses.damageReduction.magical', key: 'system.resistance.magical.reduction',
mode: 2, mode: 2,
value: '@system.armorScore' value: '@system.armorScore'
} }

View file

@ -41,7 +41,8 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
if(this.metadata.hasResistances) if(this.metadata.hasResistances)
schema.resistance = new fields.SchemaField({ schema.resistance = new fields.SchemaField({
physical: resistanceField(), physical: resistanceField(),
magical: resistanceField() magical: resistanceField(),
resistance: new fields.NumberField({ integer: true, initial: 0 })
}) })
return schema; return schema;
} }

View file

@ -101,10 +101,6 @@ export default class DhCharacter extends BaseDataActor {
levelData: new fields.EmbeddedDataField(DhLevelData), levelData: new fields.EmbeddedDataField(DhLevelData),
bonuses: new fields.SchemaField({ bonuses: new fields.SchemaField({
armorScore: new fields.NumberField({ integer: true, initial: 0 }), armorScore: new fields.NumberField({ integer: true, initial: 0 }),
damageReduction: new fields.SchemaField({
physical: new fields.NumberField({ integer: true, initial: 0 }),
magical: new fields.NumberField({ integer: true, initial: 0 })
}),
damageThresholds: new fields.SchemaField({ damageThresholds: new fields.SchemaField({
severe: new fields.NumberField({ integer: true, initial: 0 }), severe: new fields.NumberField({ integer: true, initial: 0 }),
major: new fields.NumberField({ integer: true, initial: 0 }) major: new fields.NumberField({ integer: true, initial: 0 })

View file

@ -510,10 +510,10 @@ export default class DhpActor extends Actor {
calculateDamage(baseDamage, type) { calculateDamage(baseDamage, type) {
if (Hooks.call(`${CONFIG.DH.id}.preCalculateDamage`, this, baseDamage, type) === false) return null; if (Hooks.call(`${CONFIG.DH.id}.preCalculateDamage`, this, baseDamage, type) === false) return null;
if(this.system.resistance[type].immunity) return 0; if(this.system.resistance[type]?.immunity) return 0;
if(this.system.resistance[type].resistance) baseDamage = Math.ceil(baseDamage / 2); if(this.system.resistance[type]?.resistance) baseDamage = Math.ceil(baseDamage / 2);
const flatReduction = this.system.bonuses.damageReduction[type]; const flatReduction = this.system.resistance[type].reduction;
const damage = Math.max(baseDamage - (flatReduction ?? 0), 0); const damage = Math.max(baseDamage - (flatReduction ?? 0), 0);
const hpDamage = this.convertDamageToThreshold(damage); const hpDamage = this.convertDamageToThreshold(damage);