Added parsing of effect values from Item data model. Almost finished with itemConfig.

This commit is contained in:
WBHarry 2025-07-07 20:14:05 +02:00
parent 52be430eff
commit 363afb97a1
9 changed files with 679 additions and 141 deletions

View file

@ -482,10 +482,6 @@
"name": "Magic", "name": "Magic",
"description": "You can't mark an Armor Slot to reduce physical damage." "description": "You can't mark an Armor Slot to reduce physical damage."
}, },
"painful": {
"name": "Painful",
"description": "Each time you mark an Armor Slot, you must mark a Stress."
},
"physical": { "physical": {
"name": "Physical", "name": "Physical",
"description": "You can't mark an Armor Slot to reduce magic damage." "description": "You can't mark an Armor Slot to reduce magic damage."
@ -883,6 +879,10 @@
"name": "Scary", "name": "Scary",
"description": "On a successful attack, the target must mark a Stress." "description": "On a successful attack, the target must mark a Stress."
}, },
"selfCorrecting": {
"name": "Self Correcting",
"description": "When you roll a 1 on a damage die, it deals 6 damage instead."
},
"serrated": { "serrated": {
"name": "Serrated", "name": "Serrated",
"description": "When you roll a 1 on a damage die, it deals 8 damage instead." "description": "When you roll a 1 on a damage die, it deals 8 damage instead."

View file

@ -13,21 +13,25 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
const maxArmorMarks = Math.min( const maxArmorMarks = Math.min(
actor.system.armorScore - actor.system.armor.system.marks.value, actor.system.armorScore - actor.system.armor.system.marks.value,
actor.system.rules.maxArmorMarked.total actor.system.rules.damageReduction.maxArmorMarked.total
); );
const armor = [...Array(maxArmorMarks).keys()].reduce((acc, _) => { const armor = [...Array(maxArmorMarks).keys()].reduce((acc, _) => {
acc[foundry.utils.randomID()] = { selected: false }; acc[foundry.utils.randomID()] = { selected: false };
return acc; return acc;
}, {}); }, {});
const stress = [...Array(actor.system.rules.maxArmorMarked.stressExtra ?? 0).keys()].reduce((acc, _) => { const stress = [...Array(actor.system.rules.damageReduction.maxArmorMarked.stressExtra ?? 0).keys()].reduce(
(acc, _) => {
acc[foundry.utils.randomID()] = { selected: false }; acc[foundry.utils.randomID()] = { selected: false };
return acc; return acc;
}, {}); },
{}
);
this.marks = { armor, stress }; this.marks = { armor, stress };
this.availableStressReductions = Object.keys(actor.system.rules.stressDamageReduction).reduce((acc, key) => { this.availableStressReductions = Object.keys(actor.system.rules.damageReduction.stressDamageReduction).reduce(
const dr = actor.system.rules.stressDamageReduction[key]; (acc, key) => {
const dr = actor.system.rules.damageReduction.stressDamageReduction[key];
if (dr.enabled) { if (dr.enabled) {
if (acc === null) acc = {}; if (acc === null) acc = {};
@ -41,7 +45,9 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
} }
return acc; return acc;
}, null); },
null
);
} }
get title() { get title() {
@ -90,7 +96,8 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
context.armorScore = this.actor.system.armorScore; context.armorScore = this.actor.system.armorScore;
context.armorMarks = currentMarks; context.armorMarks = currentMarks;
context.basicMarksUsed = selectedArmorMarks.length === this.actor.system.rules.maxArmorMarked.total; context.basicMarksUsed =
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.total;
const stressReductionStress = this.availableStressReductions const stressReductionStress = this.availableStressReductions
? stressReductions.reduce((acc, red) => acc + red.cost, 0) ? stressReductions.reduce((acc, red) => acc + red.cost, 0)

View file

@ -34,7 +34,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
switch (partId) { switch (partId) {
case 'settings': case 'settings':
context.features = this.document.system.features.map(x => x.value); context.features = this.document.system.weaponFeatures.map(x => x.value);
break; break;
} }
@ -46,6 +46,6 @@ export default class WeaponSheet extends DHBaseItemSheet {
* @param {Array<Object>} selectedOptions - The currently selected tag objects. * @param {Array<Object>} selectedOptions - The currently selected tag objects.
*/ */
static async #onFeatureSelect(selectedOptions) { static async #onFeatureSelect(selectedOptions) {
await this.document.update({ 'system.features': selectedOptions.map(x => ({ value: x.value })) }); await this.document.update({ 'system.weaponFeatures': selectedOptions.map(x => ({ value: x.value })) });
} }
} }

View file

@ -351,7 +351,7 @@ export const abilityCosts = {
}, },
stress: { stress: {
id: 'stress', id: 'stress',
label: 'DAGGERHEART.CONFIG.HealingType.Stress.Name', label: 'DAGGERHEART.CONFIG.HealingType.stress.name',
group: 'TYPES.Actor.character' group: 'TYPES.Actor.character'
}, },
armor: { armor: {
@ -361,7 +361,7 @@ export const abilityCosts = {
}, },
hp: { hp: {
id: 'hp', id: 'hp',
label: 'DAGGERHEART.CONFIG.HealingType.HitPoints.Name', label: 'DAGGERHEART.CONFIG.HealingType.hitPoints.name',
group: 'TYPES.Actor.character' group: 'TYPES.Actor.character'
}, },
prayer: { prayer: {

View file

@ -1,16 +1,29 @@
export const armorFeatures = { export const armorFeatures = {
burning: { burning: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.burning.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.burning.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.burning.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.burning.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.ArmorFeature.burning.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.burning.description',
img: 'icons/magic/fire/flame-burning-embers-yellow.webp'
}
]
}, },
channeling: { channeling: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.description', description: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.channeling.description',
img: 'icons/magic/symbols/rune-sigil-horned-blue.webp',
changes: [ changes: [
{ {
key: 'system.bonuses.spellcast', key: 'system.bonuses.roll.spellcast',
mode: 2, mode: 2,
value: '1' value: '1'
} }
@ -23,6 +36,9 @@ export const armorFeatures = {
description: 'DAGGERHEART.CONFIG.ArmorFeature.difficult.description', description: 'DAGGERHEART.CONFIG.ArmorFeature.difficult.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.ArmorFeature.difficult.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.difficult.description',
img: 'icons/magic/control/buff-flight-wings-red.webp',
changes: [ changes: [
{ {
key: 'system.traits.agility.bonus', key: 'system.traits.agility.bonus',
@ -68,6 +84,9 @@ export const armorFeatures = {
description: 'DAGGERHEART.CONFIG.ArmorFeature.flexible.description', description: 'DAGGERHEART.CONFIG.ArmorFeature.flexible.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.ArmorFeature.flexible.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.flexible.description',
img: 'icons/magic/movement/abstract-ribbons-red-orange.webp',
changes: [ changes: [
{ {
key: 'system.evasion.bonus', key: 'system.evasion.bonus',
@ -80,13 +99,30 @@ export const armorFeatures = {
}, },
fortified: { fortified: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.description',
effects: [
{
name: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.fortified.description',
img: 'icons/magic/defensive/shield-barrier-glowing-blue.webp',
changes: [
{
key: 'system.rules.damageReduction.increasePerArmorMark',
mode: 3,
value: '2'
}
]
}
]
}, },
gilded: { gilded: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.description', description: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.gilded.description',
img: 'icons/magic/control/control-influence-crown-gold.webp',
changes: [ changes: [
{ {
key: 'system.traits.presence.bonus', key: 'system.traits.presence.bonus',
@ -102,6 +138,9 @@ export const armorFeatures = {
description: 'DAGGERHEART.CONFIG.ArmorFeature.heavy.description', description: 'DAGGERHEART.CONFIG.ArmorFeature.heavy.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.ArmorFeature.heavy.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.heavy.description',
img: 'icons/commodities/metal/ingot-worn-iron.webp',
changes: [ changes: [
{ {
key: 'system.evasion.bonus', key: 'system.evasion.bonus',
@ -114,19 +153,60 @@ export const armorFeatures = {
}, },
hopeful: { hopeful: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.hopeful.description',
img: 'icons/magic/holy/barrier-shield-winged-blue.webp'
}
]
}, },
impenetrable: { impenetrable: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.impenetrable.description',
img: 'icons/magic/defensive/shield-barrier-flaming-pentagon-purple-orange.webp',
uses: {
max: 1,
recovery: 'shortRest',
value: 0
},
cost: [
{
type: 'stress',
value: 1
}
]
}
]
}, },
magic: { magic: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.magic.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.magic.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.magic.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.magic.description',
}, effects: [
painful: { {
label: 'DAGGERHEART.CONFIG.ArmorFeature.painful.name', name: 'DAGGERHEART.CONFIG.ArmorFeature.magic.name',
description: 'DAGGERHEART.CONFIG.ArmorFeature.painful.description' description: 'DAGGERHEART.CONFIG.ArmorFeature.magic.description',
img: 'icons/magic/defensive/barrier-shield-dome-blue-purple.webp',
changes: [
{
key: 'system.rules.damageReduction.magic',
mode: 3,
value: '1'
}
]
}
]
}, },
physical: { physical: {
label: 'DAGGERHEART.CONFIG.ArmorFeature.physical.name', label: 'DAGGERHEART.CONFIG.ArmorFeature.physical.name',
@ -196,7 +276,7 @@ export const weaponFeatures = {
{ {
key: 'system.bonuses.armorScore', key: 'system.bonuses.armorScore',
mode: 2, mode: 2,
value: '@system.tier + 1' value: 'ITEM.@system.tier + 1'
} }
] ]
}, },
@ -218,9 +298,9 @@ export const weaponFeatures = {
{ {
changes: [ changes: [
{ {
key: 'system.bonuses.damage', key: 'system.bonuses.damage.primaryWeapon.bonus',
mode: 2, mode: 2,
value: 'system.levelData.levels.current' value: '@system.levelData.levels.current'
} }
] ]
} }
@ -228,7 +308,25 @@ export const weaponFeatures = {
}, },
bouncing: { bouncing: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.bouncing.description',
img: 'icons/skills/movement/ball-spinning-blue.webp',
cost: [
{
type: 'stress',
value: 1,
scalable: true,
step: 1
}
]
}
]
}, },
brave: { brave: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.brave.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.brave.name',
@ -248,7 +346,7 @@ export const weaponFeatures = {
{ {
key: 'system.damageThresholds.severe', key: 'system.damageThresholds.severe',
mode: 2, mode: 2,
value: '3' value: 'ITEM.@system.tier'
} }
] ]
} }
@ -256,7 +354,17 @@ export const weaponFeatures = {
}, },
brutal: { brutal: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.brutal.description',
img: 'icons/skills/melee/strike-dagger-blood-red.webp'
}
]
}, },
charged: { charged: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.charged.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.charged.name',
@ -264,16 +372,31 @@ export const weaponFeatures = {
actions: [ actions: [
{ {
type: 'effect', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.name',
img: 'icons/skills/melee/shield-damaged-broken-brown.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.charged.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.charged.description',
img: 'icons/magic/lightning/claws-unarmed-strike-teal.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
value: 1 value: 1
} }
],
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.charged.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.charged.description',
img: 'icons/magic/lightning/claws-unarmed-strike-teal.webp',
changes: [
{
key: 'system.proficiency.bonus',
mode: 2,
value: '1'
}
]
}
] ]
// Should add an effect with path system.proficiency.bonus +1
} }
] ]
}, },
@ -282,10 +405,12 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.name',
img: 'icons/skills/melee/shield-damaged-broken-brown.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.concussive.description',
img: 'icons/skills/melee/shield-block-bash-yellow.webp',
cost: [ cost: [
{ {
type: 'hope', type: 'hope',
@ -300,6 +425,9 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.cumbersome.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.cumbersome.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.cumbersome.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.cumbersome.description',
img: 'icons/commodities/metal/mail-plate-steel.webp',
changes: [ changes: [
{ {
key: 'system.traits.finesse.bonus', key: 'system.traits.finesse.bonus',
@ -312,27 +440,70 @@ export const weaponFeatures = {
}, },
deadly: { deadly: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.deadly.description',
img: 'icons/skills/melee/strike-sword-dagger-runes-red.webp'
}
]
}, },
deflecting: { deflecting: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.description',
// actions: [{ actions: [
// type: 'effect', {
// name: 'DAGGERHEART.CONFIG.WeaponFeature.Deflecting.Name', type: 'effect',
// img: 'icons/skills/melee/strike-flail-destructive-yellow.webp', actionType: 'action',
// actionType: 'reaction', chatDisplay: true,
// cost: [{ name: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.name',
// type: 'armorSlot', // Needs armorSlot as type description: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.description',
// value: 1 img: 'icons/skills/melee/hand-grip-sword-strike-orange.webp',
// }], cost: [
// }], {
type: 'armorStack',
value: 1
}
],
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.deflecting.description',
img: 'icons/skills/melee/hand-grip-sword-strike-orange.webp',
changes: [
{
key: 'system.evasion.bonus',
mode: 2,
value: '@system.armorScore'
}
]
}
]
}
]
}, },
destructive: { destructive: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.description',
img: 'icons/skills/melee/strike-flail-spiked-pink.webp'
}
],
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.destructive.description',
img: 'icons/skills/melee/strike-flail-spiked-pink.webp',
changes: [ changes: [
{ {
key: 'system.traits.agility.bonus', key: 'system.traits.agility.bonus',
@ -348,10 +519,12 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.devastating.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.devastating.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.devastating.name',
img: 'icons/skills/melee/strike-flail-destructive-yellow.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.devastating.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.devastating.description',
img: 'icons/skills/melee/strike-flail-destructive-yellow.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
@ -366,11 +539,19 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.doubleDuty.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.doubleDuty.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.doubleDuty.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.doubleDuty.description',
img: 'icons/skills/melee/sword-shield-stylized-white.webp',
changes: [ changes: [
{ {
key: 'system.bonuses.armorScore', key: 'system.bonuses.armorScore',
mode: 2, mode: 2,
value: '1' value: '1'
},
{
key: 'system.bonuses.damage.primaryWeapon.bonus',
mode: 2,
value: '1'
} }
] ]
} }
@ -378,28 +559,60 @@ export const weaponFeatures = {
}, },
doubledup: { doubledup: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.doubledUp.description',
img: 'icons/skills/melee/strike-slashes-orange.webp'
}
]
}, },
dueling: { dueling: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.dueling.description',
img: 'icons/skills/melee/weapons-crossed-swords-pink.webp'
}
]
}, },
eruptive: { eruptive: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.description',
actions: [
{
type: 'effect', // Should prompt a dc 14 reaction save on adversaries
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.eruptive.description',
img: 'icons/skills/melee/strike-hammer-destructive-blue.webp'
}
]
}, },
grappling: { grappling: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.name',
img: 'icons/magic/control/debuff-chains-ropes-net-white.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.grappling.description',
img: 'icons/magic/control/debuff-chains-ropes-net-white.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'hope',
value: 1 value: 1
} }
] ]
@ -408,7 +621,32 @@ export const weaponFeatures = {
}, },
greedy: { greedy: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.description',
img: 'icons/commodities/currency/coins-crown-stack-gold.webp',
// Should cost handfull of gold,
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.greedy.description',
img: 'icons/commodities/currency/coins-crown-stack-gold.webp',
changes: [
{
key: 'system.proficiency.bonus',
mode: 2,
value: '1'
}
]
}
]
}
]
}, },
healing: { healing: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.healing.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.healing.name',
@ -416,9 +654,10 @@ export const weaponFeatures = {
actions: [ actions: [
{ {
type: 'healing', type: 'healing',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.healing.name', name: 'DAGGERHEART.CONFIG.WeaponFeature.healing.name',
img: 'icons/magic/life/cross-beam-green.webp', img: 'icons/magic/life/cross-beam-green.webp',
actionType: 'action',
healing: { healing: {
type: 'health', type: 'health',
value: { value: {
@ -436,6 +675,9 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.heavy.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.heavy.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.heavy.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.heavy.description',
img: 'icons/commodities/metal/ingot-worn-iron.webp',
changes: [ changes: [
{ {
key: 'system.evasion.bonus', key: 'system.evasion.bonus',
@ -448,37 +690,99 @@ export const weaponFeatures = {
}, },
hooked: { hooked: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.hooked.description',
img: 'icons/skills/melee/strike-chain-whip-blue.webp'
}
]
}, },
hot: { hot: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.hot.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.hot.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.hot.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.hot.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.hot.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.hot.description',
img: 'icons/magic/fire/dagger-rune-enchant-flame-red.webp'
}
]
}, },
invigorating: { invigorating: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.invigorating.description',
img: 'icons/magic/life/heart-cross-green.webp'
}
]
}, },
lifestealing: { lifestealing: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lifestealing.description',
img: 'icons/magic/unholy/hand-claw-fire-blue.webp'
}
]
}, },
lockedon: { lockedon: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lockedOn.description',
img: 'icons/skills/targeting/crosshair-arrowhead-blue.webp'
}
]
}, },
long: { long: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.long.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.long.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.long.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.long.description'
// actions: [
// {
// type: 'effect',
// actionType: 'action',
// chatDisplay: true,
// name: 'DAGGERHEART.CONFIG.WeaponFeature.long.name',
// description: 'DAGGERHEART.CONFIG.WeaponFeature.long.description',
// img: 'icons/skills/melee/strike-weapon-polearm-ice-blue.webp',
// }
// ]
}, },
lucky: { lucky: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.name',
img: 'icons/magic/control/buff-luck-fortune-green.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.lucky.description',
img: 'icons/magic/control/buff-luck-fortune-green.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
@ -493,11 +797,24 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.massive.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.massive.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.massive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.massive.description',
img: '',
changes: [ changes: [
{ {
key: 'system.evasion.bonus', key: 'system.evasion.bonus',
mode: 2, mode: 2,
value: '-1' value: '-1'
},
{
key: 'system.bonuses.damage.primaryWeapon.extraDice',
mode: 2,
value: '1'
},
{
key: 'system.rules.weapon.dropLowestDamageDice',
mode: 3,
value: '1'
} }
] ]
} }
@ -508,10 +825,12 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.painful.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.painful.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.painful.name',
img: 'icons/skills/wounds/injury-face-impact-orange.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.painful.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.painful.description',
img: 'icons/skills/wounds/injury-face-impact-orange.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
@ -524,17 +843,64 @@ export const weaponFeatures = {
paired: { paired: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.paired.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.paired.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.paired.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.paired.description',
override: { actions: [
bonusDamage: 1 {
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.paired.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.paired.description',
img: 'icons/skills/melee/strike-flail-spiked-red.webp'
} }
]
}, },
parry: { parry: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.parry.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.parry.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.parry.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.parry.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.parry.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.parry.description',
img: 'icons/skills/melee/shield-block-fire-orange.webp'
}
]
}, },
persuasive: { persuasive: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.description',
img: 'icons/magic/control/hypnosis-mesmerism-eye.webp',
cost: [
{
type: 'stress',
value: 1
}
],
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.persuasive.description',
img: 'icons/magic/control/hypnosis-mesmerism-eye.webp',
changes: [
{
key: 'system.traits.presence.bonus',
mode: 2,
value: '2'
}
]
}
]
}
]
}, },
pompous: { pompous: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.pompous.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.pompous.name',
@ -542,18 +908,50 @@ export const weaponFeatures = {
}, },
powerful: { powerful: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.description',
img: 'icons/magic/control/buff-flight-wings-runes-red-yellow.webp',
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.powerful.description',
img: 'icons/magic/control/buff-flight-wings-runes-red-yellow.webp',
changes: [
{
key: 'system.bonuses.damage.primaryWeapon.extraDice',
mode: 2,
value: '1'
},
{
key: 'system.rules.weapon.dropLowestDamageDice',
mode: 3,
value: '1'
}
]
}
]
}
]
}, },
protective: { protective: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.protective.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.protective.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.protective.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.protective.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.protective.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.protective.description',
img: 'icons/skills/melee/shield-block-gray-orange.webp',
changes: [ changes: [
{ {
key: 'system.bonuses.armorScore', key: 'system.bonuses.armorScore',
mode: 2, mode: 2,
value: '@system.tier' value: '1'
} }
] ]
} }
@ -564,10 +962,12 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.quick.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.quick.description',
actions: [ actions: [
{ {
type: 'resource', type: 'effect',
name: 'DAGGERHEART.CONFIG.WeaponFeature.quick.name',
img: 'icons/skills/movement/arrow-upward-yellow.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.quick.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.quick.description',
img: 'icons/skills/movement/arrow-upward-yellow.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
@ -582,9 +982,12 @@ export const weaponFeatures = {
description: 'DAGGERHEART.CONFIG.WeaponFeature.reliable.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.reliable.description',
effects: [ effects: [
{ {
name: 'DAGGERHEART.CONFIG.WeaponFeature.reliable.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.reliable.description',
img: 'icons/skills/melee/strike-sword-slashing-red.webp',
changes: [ changes: [
{ {
key: 'system.bonuses.attack', key: 'system.bonuses.roll.primaryWeapon.attack',
mode: 2, mode: 2,
value: 1 value: 1
} }
@ -594,7 +997,17 @@ export const weaponFeatures = {
}, },
reloading: { reloading: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.reloading.description',
img: 'icons/weapons/ammunition/shot-round-blue.webp'
}
]
}, },
retractable: { retractable: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.retractable.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.retractable.name',
@ -604,21 +1017,87 @@ export const weaponFeatures = {
label: 'DAGGERHEART.CONFIG.WeaponFeature.returning.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.returning.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.returning.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.returning.description'
}, },
selfCorrecting: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.selfCorrecting.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.selfCorrecting.description',
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.selfCorrecting.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.selfCorrecting.description',
img: 'icons/weapons/ammunition/arrow-broadhead-glowing-orange.webp',
changes: [
{
key: 'system.rules.damage.flipMinDiceValue',
mode: 3,
value: 1
}
]
}
]
},
scary: { scary: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.scary.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.scary.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.scary.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.scary.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.scary.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.scary.description',
img: 'icons/magic/death/skull-energy-light-purple.webp'
}
]
}, },
serrated: { serrated: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.description',
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.serrated.description',
img: 'icons/weapons/ammunition/arrow-broadhead-glowing-orange.webp',
changes: [
{
key: 'system.rules.damage.flipMinDiceValue',
mode: 3,
value: 1
}
]
}
]
}, },
sharpwing: { sharpwing: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.description',
effects: [
{
name: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.sharpwing.description',
img: 'icons/weapons/swords/sword-winged-pink.webp',
changes: [
{
key: 'system.bonuses.damage.primaryWeapon.bonus',
mode: 2,
value: '@system.traits.agility.total'
}
]
}
]
}, },
sheltering: { sheltering: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.description' description: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.description',
actions: [
{
type: 'effect',
actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.sheltering.description',
img: 'icons/skills/melee/shield-block-gray-yellow.webp'
}
]
}, },
startling: { startling: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.startling.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.startling.name',
@ -626,9 +1105,11 @@ export const weaponFeatures = {
actions: [ actions: [
{ {
type: 'resource', type: 'resource',
name: 'DAGGERHEART.CONFIG.WeaponFeature.startling.name',
img: 'icons/magic/control/fear-fright-mask-orange.webp',
actionType: 'action', actionType: 'action',
chatDisplay: true,
name: 'DAGGERHEART.CONFIG.WeaponFeature.startling.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.startling.description',
img: 'icons/magic/control/fear-fright-mask-orange.webp',
cost: [ cost: [
{ {
type: 'stress', type: 'stress',
@ -644,12 +1125,12 @@ export const weaponFeatures = {
}, },
versatile: { versatile: {
label: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.name', label: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.name',
description: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.description', description: 'DAGGERHEART.CONFIG.WeaponFeature.versatile.description'
versatile: { // versatile: {
characterTrait: '', // characterTrait: '',
range: '', // range: '',
damage: '' // damage: ''
} // }
} }
}; };

View file

@ -290,7 +290,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
} }
prepareTarget() { prepareTarget() {
if(!this.target?.type) return []; if (!this.target?.type) return [];
let targets; let targets;
if (this.target?.type === CONFIG.DH.ACTIONS.targetTypes.self.id) if (this.target?.type === CONFIG.DH.ACTIONS.targetTypes.self.id)
targets = this.constructor.formatTarget(this.actor.token ?? this.actor.prototypeToken); targets = this.constructor.formatTarget(this.actor.token ?? this.actor.prototypeToken);
@ -332,7 +332,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
const resources = config.costs const resources = config.costs
.filter(c => c.enabled !== false) .filter(c => c.enabled !== false)
.map(c => { .map(c => {
return { type: c.type, value: (c.total ?? c.value) * -1 }; return { type: c.type, value: c.total ?? c.value };
}); });
await this.actor.modifyResource(resources); await this.actor.modifyResource(resources);
@ -384,8 +384,15 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
) )
return false; return false;
} }
const resources = this.actor.system.resources;
return realCosts.reduce( return realCosts.reduce(
(a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), (a, c) =>
a &&
!(
resources[c.type]?.value + (c.total ?? c.value) >
(resources[c.type]?.maxTotal ?? resources[c.type]?.total)
),
true true
); );
} }

View file

@ -106,6 +106,9 @@ export default class DhCharacter extends BaseDataActor {
}), }),
roll: new fields.SchemaField({ roll: new fields.SchemaField({
attack: new fields.NumberField({ integer: true, initial: 0 }), attack: new fields.NumberField({ integer: true, initial: 0 }),
primaryWeapon: new fields.SchemaField({
attack: new fields.NumberField({ integer: true, initial: 0 })
}),
spellcast: new fields.NumberField({ integer: true, initial: 0 }), spellcast: new fields.NumberField({ integer: true, initial: 0 }),
action: new fields.NumberField({ integer: true, initial: 0 }), action: new fields.NumberField({ integer: true, initial: 0 }),
hopeOrFear: new fields.NumberField({ integer: true, initial: 0 }) hopeOrFear: new fields.NumberField({ integer: true, initial: 0 })
@ -113,11 +116,16 @@ export default class DhCharacter extends BaseDataActor {
damage: new fields.SchemaField({ damage: new fields.SchemaField({
all: new fields.NumberField({ integer: true, initial: 0 }), all: new fields.NumberField({ integer: true, initial: 0 }),
physical: new fields.NumberField({ integer: true, initial: 0 }), physical: new fields.NumberField({ integer: true, initial: 0 }),
magic: new fields.NumberField({ integer: true, initial: 0 }) magic: new fields.NumberField({ integer: true, initial: 0 }),
primaryWeapon: new fields.SchemaField({
bonus: new fields.NumberField({ integer: true }),
extraDice: new fields.NumberField({ integer: true })
})
}) })
}), }),
companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }), companion: new ForeignDocumentUUIDField({ type: 'Actor', nullable: true, initial: null }),
rules: new fields.SchemaField({ rules: new fields.SchemaField({
damageReduction: new fields.SchemaField({
maxArmorMarked: new fields.SchemaField({ maxArmorMarked: new fields.SchemaField({
value: new fields.NumberField({ required: true, integer: true, initial: 1 }), value: new fields.NumberField({ required: true, integer: true, initial: 1 }),
bonus: new fields.NumberField({ required: true, integer: true, initial: 0 }), bonus: new fields.NumberField({ required: true, integer: true, initial: 0 }),
@ -128,6 +136,10 @@ export default class DhCharacter extends BaseDataActor {
major: stressDamageReductionRule(), major: stressDamageReductionRule(),
minor: stressDamageReductionRule() minor: stressDamageReductionRule()
}), }),
increasePerArmorMark: new fields.NumberField({ integer: true, initial: 1 }),
magical: new fields.BooleanField({ initial: false }),
physical: new fields.BooleanField({ initial: false })
}),
strangePatterns: new fields.NumberField({ strangePatterns: new fields.NumberField({
integer: true, integer: true,
min: 1, min: 1,
@ -135,6 +147,10 @@ export default class DhCharacter extends BaseDataActor {
nullable: true, nullable: true,
initial: null initial: null
}), }),
weapon: new fields.SchemaField({
dropLowestDamageDice: new fields.BooleanField({ initial: false }),
flipMinDiceValue: new fields.BooleanField({ intial: false })
}),
runeWard: new fields.BooleanField({ initial: false }) runeWard: new fields.BooleanField({ initial: false })
}) })
}; };
@ -372,7 +388,8 @@ 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.rules.damageReduction.maxArmorMarked.total =
this.rules.damageReduction.maxArmorMarked.value + this.rules.damageReduction.maxArmorMarked.bonus;
this.armorScore = this.armor ? this.armor.system.baseScore + (this.bonuses.armorScore ?? 0) : 0; this.armorScore = this.armor ? this.armor.system.baseScore + (this.bonuses.armorScore ?? 0) : 0;
this.resources.hitPoints.maxTotal = (this.class.value?.system?.hitPoints ?? 0) + this.resources.hitPoints.bonus; this.resources.hitPoints.maxTotal = (this.class.value?.system?.hitPoints ?? 0) + this.resources.hitPoints.bonus;

View file

@ -38,7 +38,7 @@ export default class DHWeapon extends BaseDataItem {
initial: 'physical' initial: 'physical'
}) })
}), }),
features: new fields.ArrayField( weaponFeatures: new fields.ArrayField(
new fields.SchemaField({ new fields.SchemaField({
value: new fields.StringField({ value: new fields.StringField({
required: true, required: true,
@ -57,17 +57,19 @@ export default class DHWeapon extends BaseDataItem {
const allowed = await super._preUpdate(changes, options, user); const allowed = await super._preUpdate(changes, options, user);
if (allowed === false) return false; if (allowed === false) return false;
if (changes.system?.features) { if (changes.system?.weaponFeatures) {
const removed = this.features.filter(x => !changes.system.features.includes(x)); const removed = this.weaponFeatures.filter(x => !changes.system.weaponFeatures.includes(x));
const added = changes.system.features.filter(x => !this.features.includes(x)); const added = changes.system.weaponFeatures.filter(x => !this.weaponFeatures.includes(x));
const removedEffectsUpdate = [];
const removedActionsUpdate = [];
for (let weaponFeature of removed) { for (let weaponFeature of removed) {
for (var effectId of weaponFeature.effectIds) { removedEffectsUpdate.push(...weaponFeature.effectIds);
await this.parent.effects.get(effectId).delete(); removedActionsUpdate.push(...weaponFeature.actionIds);
} }
changes.system.actions = this.actions.filter(x => !weaponFeature.actionIds.includes(x._id)); await this.parent.deleteEmbeddedDocuments('ActiveEffect', removedEffectsUpdate);
} changes.system.actions = this.actions.filter(x => !removedActionsUpdate.includes(x._id));
for (let weaponFeature of added) { for (let weaponFeature of added) {
const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value]; const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value];
@ -81,18 +83,38 @@ export default class DHWeapon extends BaseDataItem {
]); ]);
weaponFeature.effectIds = embeddedItems.map(x => x.id); weaponFeature.effectIds = embeddedItems.map(x => x.id);
} }
const newActions = [];
if (featureData.actions?.length > 0) { if (featureData.actions?.length > 0) {
const newActions = featureData.actions.map(action => { for (let action of featureData.actions) {
const cls = actionsTypes[action.type]; const embeddedEffects = await this.parent.createEmbeddedDocuments(
return new cls( 'ActiveEffect',
{ ...action, _id: foundry.utils.randomID(), name: game.i18n.localize(action.name) }, (action.effects ?? []).map(effect => ({
{ parent: this } ...effect,
transfer: false,
name: game.i18n.localize(effect.name),
description: game.i18n.localize(effect.description)
}))
); );
}); const cls = actionsTypes[action.type];
newActions.push(
new cls(
{
...action,
_id: foundry.utils.randomID(),
name: game.i18n.localize(action.name),
description: game.i18n.localize(action.description),
effects: embeddedEffects.map(x => ({ _id: x.id }))
},
{ parent: this }
)
);
}
}
changes.system.actions = [...this.actions, ...newActions]; changes.system.actions = [...this.actions, ...newActions];
weaponFeature.actionIds = newActions.map(x => x._id); weaponFeature.actionIds = newActions.map(x => x._id);
} }
} }
} }
}
} }

View file

@ -25,7 +25,11 @@ export default class DhActiveEffect extends ActiveEffect {
} }
static applyField(model, change, field) { static applyField(model, change, field) {
change.value = Roll.safeEval(Roll.replaceFormulaData(change.value, change.effect.parent)); const isItemTarget = change.value.toLowerCase().startsWith('item.');
change.value = isItemTarget ? change.value.slice(5) : change.value;
change.value = Roll.safeEval(
Roll.replaceFormulaData(change.value, isItemTarget ? change.effect.parent : model)
);
super.applyField(model, change, field); super.applyField(model, change, field);
} }