mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 05:31:07 +01:00
Added effects for Weapon and Armor traits
This commit is contained in:
parent
b7ea925276
commit
b8482da848
13 changed files with 573 additions and 51 deletions
40
lang/en.json
40
lang/en.json
|
|
@ -620,9 +620,25 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WeaponFeature": {
|
"WeaponFeature": {
|
||||||
"Barrier": {
|
"Barrier1": {
|
||||||
"Name": "Barrier",
|
"Name": "Barrier 1",
|
||||||
"Description": "+{armorBonus} to Armor Score; -1 to Evasion"
|
"Description": "+1 to Armor Score; -1 to Evasion"
|
||||||
|
},
|
||||||
|
"Barrier2": {
|
||||||
|
"Name": "Barrier 2",
|
||||||
|
"Description": "+2 to Armor Score; -1 to Evasion"
|
||||||
|
},
|
||||||
|
"Barrier3": {
|
||||||
|
"Name": "Barrier 3",
|
||||||
|
"Description": "+3 to Armor Score; -1 to Evasion"
|
||||||
|
},
|
||||||
|
"Barrier4": {
|
||||||
|
"Name": "Barrier 4",
|
||||||
|
"Description": "+4 to Armor Score; -1 to Evasion"
|
||||||
|
},
|
||||||
|
"Barrier5": {
|
||||||
|
"Name": "Barrier 5",
|
||||||
|
"Description": "+5 to Armor Score; -1 to Evasion"
|
||||||
},
|
},
|
||||||
"Bonded": {
|
"Bonded": {
|
||||||
"Name": "Bonded",
|
"Name": "Bonded",
|
||||||
|
|
@ -748,9 +764,21 @@
|
||||||
"Name": "Powerful",
|
"Name": "Powerful",
|
||||||
"Description": "On a successful attack, roll an additional damage die and discard the lowest result."
|
"Description": "On a successful attack, roll an additional damage die and discard the lowest result."
|
||||||
},
|
},
|
||||||
"Protective": {
|
"Protective1": {
|
||||||
"Name": "Protective",
|
"Name": "Protective 1",
|
||||||
"Description": "+{armorBonus} to Armor Score"
|
"Description": "+1 to Armor Score"
|
||||||
|
},
|
||||||
|
"Protective2": {
|
||||||
|
"Name": "Protective 2",
|
||||||
|
"Description": "+2 to Armor Score"
|
||||||
|
},
|
||||||
|
"Protective3": {
|
||||||
|
"Name": "Protective 3",
|
||||||
|
"Description": "+3 to Armor Score"
|
||||||
|
},
|
||||||
|
"Protective4": {
|
||||||
|
"Name": "Protective 4",
|
||||||
|
"Description": "+4 to Armor Score"
|
||||||
},
|
},
|
||||||
"Quick": {
|
"Quick": {
|
||||||
"Name": "Quick",
|
"Name": "Quick",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { armorFeatures } from '../../../config/itemConfig.mjs';
|
||||||
|
import { tagifyElement } from '../../../helpers/utils.mjs';
|
||||||
import DHItemSheetV2 from '../item.mjs';
|
import DHItemSheetV2 from '../item.mjs';
|
||||||
|
|
||||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
@ -20,4 +22,28 @@ export default class ArmorSheet extends DHItemSheetV2(ItemSheetV2) {
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
super._preparePartContext(partId, context);
|
||||||
|
|
||||||
|
switch (partId) {
|
||||||
|
case 'settings':
|
||||||
|
context.features = this.document.system.features.map(x => x.value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
const featureInput = htmlElement.querySelector('.features-input');
|
||||||
|
tagifyElement(featureInput, armorFeatures, this.onFeatureSelect.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
async onFeatureSelect(features) {
|
||||||
|
await this.document.update({ 'system.features': features.map(x => ({ value: x.value })) });
|
||||||
|
this.render(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { weaponFeatures } from '../../../config/itemConfig.mjs';
|
||||||
|
import { tagifyElement } from '../../../helpers/utils.mjs';
|
||||||
import DHItemSheetV2 from '../item.mjs';
|
import DHItemSheetV2 from '../item.mjs';
|
||||||
|
|
||||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
@ -19,4 +21,28 @@ export default class WeaponSheet extends DHItemSheetV2(ItemSheetV2) {
|
||||||
scrollable: ['.settings']
|
scrollable: ['.settings']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async _preparePartContext(partId, context) {
|
||||||
|
super._preparePartContext(partId, context);
|
||||||
|
|
||||||
|
switch (partId) {
|
||||||
|
case 'settings':
|
||||||
|
context.features = this.document.system.features.map(x => x.value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
const featureInput = htmlElement.querySelector('.features-input');
|
||||||
|
tagifyElement(featureInput, weaponFeatures, this.onFeatureSelect.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
async onFeatureSelect(features) {
|
||||||
|
await this.document.update({ 'system.features': features.map(x => ({ value: x.value })) });
|
||||||
|
this.render(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,78 @@ export const armorFeatures = {
|
||||||
},
|
},
|
||||||
channeling: {
|
channeling: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Channeling.Name',
|
label: 'DAGGERHEART.ArmorFeature.Channeling.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.Channeling.Description'
|
description: 'DAGGERHEART.ArmorFeature.Channeling.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.spellcast',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
difficult: {
|
difficult: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Difficult.Name',
|
label: 'DAGGERHEART.ArmorFeature.Difficult.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.Difficult.Description'
|
description: 'DAGGERHEART.ArmorFeature.Difficult.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.traits.agility.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.strength.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.finesse.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.instinct.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.presence.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.knowledge.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
flexible: {
|
flexible: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Flexible.Name',
|
label: 'DAGGERHEART.ArmorFeature.Flexible.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.Flexible.Description'
|
description: 'DAGGERHEART.ArmorFeature.Flexible.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
fortified: {
|
fortified: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Fortified.Name',
|
label: 'DAGGERHEART.ArmorFeature.Fortified.Name',
|
||||||
|
|
@ -21,11 +84,33 @@ export const armorFeatures = {
|
||||||
},
|
},
|
||||||
gilded: {
|
gilded: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Gilded.Name',
|
label: 'DAGGERHEART.ArmorFeature.Gilded.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.Gilded.Description'
|
description: 'DAGGERHEART.ArmorFeature.Gilded.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.traits.presence.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
heavy: {
|
heavy: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Heavy.Name',
|
label: 'DAGGERHEART.ArmorFeature.Heavy.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.Heavy.Description'
|
description: 'DAGGERHEART.ArmorFeature.Heavy.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
hopeful: {
|
hopeful: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Hopeful.Name',
|
label: 'DAGGERHEART.ArmorFeature.Hopeful.Name',
|
||||||
|
|
@ -77,7 +162,23 @@ export const armorFeatures = {
|
||||||
},
|
},
|
||||||
veryheavy: {
|
veryheavy: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.VeryHeavy.Name',
|
label: 'DAGGERHEART.ArmorFeature.VeryHeavy.Name',
|
||||||
description: 'DAGGERHEART.ArmorFeature.VeryHeavy.Description'
|
description: 'DAGGERHEART.ArmorFeature.VeryHeavy.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'system.traits.agility.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
warded: {
|
warded: {
|
||||||
label: 'DAGGERHEART.ArmorFeature.Warded.Name',
|
label: 'DAGGERHEART.ArmorFeature.Warded.Name',
|
||||||
|
|
@ -86,16 +187,140 @@ export const armorFeatures = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const weaponFeatures = {
|
export const weaponFeatures = {
|
||||||
barrier: {
|
barrier1: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Barrier.Name',
|
label: 'DAGGERHEART.WeaponFeature.Barrier1.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Barrier.Description',
|
description: 'DAGGERHEART.WeaponFeature.Barrier1.Description',
|
||||||
override: {
|
effects: [
|
||||||
armorBonus: 1
|
{
|
||||||
}
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
barrier2: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Barrier2.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Barrier2.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '2'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
barrier3: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Barrier3.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Barrier3.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '3'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
barrier4: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Barrier4.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Barrier4.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '4'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
barrier5: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Barrier5.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Barrier5.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '5'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
bonded: {
|
bonded: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Bonded.Name',
|
label: 'DAGGERHEART.WeaponFeature.Bonded.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Bonded.Description'
|
description: 'DAGGERHEART.WeaponFeature.Bonded.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.damage',
|
||||||
|
mode: 2,
|
||||||
|
value: 'system.levelData.levels.current'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
bouncing: {
|
bouncing: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Bouncing.Name',
|
label: 'DAGGERHEART.WeaponFeature.Bouncing.Name',
|
||||||
|
|
@ -103,7 +328,27 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
brave: {
|
brave: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Brave.Name',
|
label: 'DAGGERHEART.WeaponFeature.Brave.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Brave.Description'
|
description: 'DAGGERHEART.WeaponFeature.Brave.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.damageThresholds.severe',
|
||||||
|
mode: 2,
|
||||||
|
value: '3'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
brutal: {
|
brutal: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Brutal.Name',
|
label: 'DAGGERHEART.WeaponFeature.Brutal.Name',
|
||||||
|
|
@ -119,7 +364,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
cumbersome: {
|
cumbersome: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Cumbersome.Name',
|
label: 'DAGGERHEART.WeaponFeature.Cumbersome.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Cumbersome.Description'
|
description: 'DAGGERHEART.WeaponFeature.Cumbersome.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.traits.finesse.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
deadly: {
|
deadly: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Deadly.Name',
|
label: 'DAGGERHEART.WeaponFeature.Deadly.Name',
|
||||||
|
|
@ -131,7 +387,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
destructive: {
|
destructive: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Destructive.Name',
|
label: 'DAGGERHEART.WeaponFeature.Destructive.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Destructive.Description'
|
description: 'DAGGERHEART.WeaponFeature.Destructive.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.traits.agility.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
devastating: {
|
devastating: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Devastating.Name',
|
label: 'DAGGERHEART.WeaponFeature.Devastating.Name',
|
||||||
|
|
@ -139,7 +406,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
doubleduty: {
|
doubleduty: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.DoubleDuty.Name',
|
label: 'DAGGERHEART.WeaponFeature.DoubleDuty.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.DoubleDuty.Description'
|
description: 'DAGGERHEART.WeaponFeature.DoubleDuty.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
doubledup: {
|
doubledup: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.DoubledUp.Name',
|
label: 'DAGGERHEART.WeaponFeature.DoubledUp.Name',
|
||||||
|
|
@ -163,7 +441,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
heavy: {
|
heavy: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Heavy.Name',
|
label: 'DAGGERHEART.WeaponFeature.Heavy.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Heavy.Description'
|
description: 'DAGGERHEART.WeaponFeature.Heavy.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
hooked: {
|
hooked: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Hooked.Name',
|
label: 'DAGGERHEART.WeaponFeature.Hooked.Name',
|
||||||
|
|
@ -191,7 +480,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
massive: {
|
massive: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Massive.Name',
|
label: 'DAGGERHEART.WeaponFeature.Massive.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Massive.Description'
|
description: 'DAGGERHEART.WeaponFeature.Massive.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.evasion.bonus',
|
||||||
|
mode: 2,
|
||||||
|
value: '-1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
painful: {
|
painful: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Painful.Name',
|
label: 'DAGGERHEART.WeaponFeature.Painful.Name',
|
||||||
|
|
@ -220,12 +520,65 @@ export const weaponFeatures = {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Powerful.Name',
|
label: 'DAGGERHEART.WeaponFeature.Powerful.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Powerful.Description'
|
description: 'DAGGERHEART.WeaponFeature.Powerful.Description'
|
||||||
},
|
},
|
||||||
protective: {
|
protective1: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Protective.Name',
|
label: 'DAGGERHEART.WeaponFeature.Protective1.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Protective.Description',
|
description: 'DAGGERHEART.WeaponFeature.Protective1.Description',
|
||||||
override: {
|
effects: [
|
||||||
armorBonus: 1
|
{
|
||||||
}
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '1'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
protective2: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Protective2.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Protective2.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '2'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
protective3: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Protective3.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Protective3.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '3'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
protective4: {
|
||||||
|
label: 'DAGGERHEART.WeaponFeature.Protective4.Name',
|
||||||
|
description: 'DAGGERHEART.WeaponFeature.Protective4.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.armorScore',
|
||||||
|
mode: 2,
|
||||||
|
value: '4'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
quick: {
|
quick: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Quick.Name',
|
label: 'DAGGERHEART.WeaponFeature.Quick.Name',
|
||||||
|
|
@ -233,7 +586,18 @@ export const weaponFeatures = {
|
||||||
},
|
},
|
||||||
reliable: {
|
reliable: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Reliable.Name',
|
label: 'DAGGERHEART.WeaponFeature.Reliable.Name',
|
||||||
description: 'DAGGERHEART.WeaponFeature.Reliable.Description'
|
description: 'DAGGERHEART.WeaponFeature.Reliable.Description',
|
||||||
|
effects: [
|
||||||
|
{
|
||||||
|
changes: [
|
||||||
|
{
|
||||||
|
key: 'system.bonuses.attack',
|
||||||
|
mode: 2,
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
reloading: {
|
reloading: {
|
||||||
label: 'DAGGERHEART.WeaponFeature.Reloading.Name',
|
label: 'DAGGERHEART.WeaponFeature.Reloading.Name',
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
async use(event) {
|
async use(event) {
|
||||||
if (this.roll.type && this.roll.trait) {
|
if (this.roll.type && this.roll.trait) {
|
||||||
const modifierValue = this.actor.system.traits[this.roll.trait].value;
|
const modifierValue =
|
||||||
|
this.actor.system.traits[this.roll.trait].value + (this.actor.system.bonuses.attack ?? 0);
|
||||||
const config = {
|
const config = {
|
||||||
event: event,
|
event: event,
|
||||||
title: this.item.name,
|
title: this.item.name,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
||||||
getFormula(actor) {
|
getFormula(actor) {
|
||||||
return this.custom.enabled
|
return this.custom.enabled
|
||||||
? this.custom.formula
|
? this.custom.formula
|
||||||
: `${actor.system[this.multiplier] ?? 1}${this.dice}${this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : ''}`;
|
: `${actor.system[this.multiplier]?.total ?? 1}${this.dice}${this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : ''}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,12 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
value: new ForeignDocumentUUIDField({ type: 'Item', nullable: true }),
|
value: new ForeignDocumentUUIDField({ type: 'Item', nullable: true }),
|
||||||
subclass: new ForeignDocumentUUIDField({ type: 'Item', nullable: true })
|
subclass: new ForeignDocumentUUIDField({ type: 'Item', nullable: true })
|
||||||
}),
|
}),
|
||||||
levelData: new fields.EmbeddedDataField(DhPCLevelData)
|
levelData: new fields.EmbeddedDataField(DhPCLevelData),
|
||||||
|
bonuses: new fields.SchemaField({
|
||||||
|
attack: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
|
spellcast: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
|
armorScore: new fields.NumberField({ integer: true, initial: 0 })
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ActionField from '../fields/actionField.mjs';
|
||||||
|
import { armorFeatures } from '../../config/itemConfig.mjs';
|
||||||
|
|
||||||
export default class DHArmor extends BaseDataItem {
|
export default class DHArmor extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static get metadata() {
|
static get metadata() {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
label: "TYPES.Item.armor",
|
label: 'TYPES.Item.armor',
|
||||||
type: "armor",
|
type: 'armor',
|
||||||
hasDescription: true,
|
hasDescription: true,
|
||||||
isQuantifiable: true,
|
isQuantifiable: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,7 +20,12 @@ export default class DHArmor extends BaseDataItem {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
equipped: new fields.BooleanField({ initial: false }),
|
equipped: new fields.BooleanField({ initial: false }),
|
||||||
baseScore: new fields.NumberField({ integer: true, initial: 0 }),
|
baseScore: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
feature: new fields.StringField({ choices: SYSTEM.ITEM.armorFeatures, blank: true }),
|
features: new fields.ArrayField(
|
||||||
|
new fields.SchemaField({
|
||||||
|
value: new fields.StringField({ required: true, choices: SYSTEM.ITEM.armorFeatures, blank: true }),
|
||||||
|
effectIds: new fields.ArrayField(new fields.StringField({ required: true }))
|
||||||
|
})
|
||||||
|
),
|
||||||
marks: new fields.SchemaField({
|
marks: new fields.SchemaField({
|
||||||
max: new fields.NumberField({ initial: 6, integer: true }),
|
max: new fields.NumberField({ initial: 6, integer: true }),
|
||||||
value: new fields.NumberField({ initial: 0, integer: true })
|
value: new fields.NumberField({ initial: 0, integer: true })
|
||||||
|
|
@ -35,4 +41,34 @@ export default class DHArmor extends BaseDataItem {
|
||||||
get featureInfo() {
|
get featureInfo() {
|
||||||
return this.feature ? CONFIG.daggerheart.ITEM.armorFeatures[this.feature] : null;
|
return this.feature ? CONFIG.daggerheart.ITEM.armorFeatures[this.feature] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _preUpdate(changes, options, user) {
|
||||||
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
|
if (allowed === false) return false;
|
||||||
|
|
||||||
|
if (changes.system.features) {
|
||||||
|
const removed = this.features.filter(x => !changes.system.features.includes(x));
|
||||||
|
const added = changes.system.features.filter(x => !this.features.includes(x));
|
||||||
|
|
||||||
|
for (var feature of removed) {
|
||||||
|
for (var effectId of feature.effectIds) {
|
||||||
|
await this.parent.effects.get(effectId).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var feature of added) {
|
||||||
|
const featureData = armorFeatures[feature.value];
|
||||||
|
if (featureData.effects?.length > 0) {
|
||||||
|
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
|
{
|
||||||
|
name: game.i18n.localize(featureData.label),
|
||||||
|
description: game.i18n.localize(featureData.description),
|
||||||
|
changes: featureData.effects.flatMap(x => x.changes)
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
feature.effectIds = embeddedItems.map(x => x.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import FormulaField from '../fields/formulaField.mjs';
|
import FormulaField from '../fields/formulaField.mjs';
|
||||||
import PseudoDocumentsField from '../fields/pseudoDocumentsField.mjs';
|
|
||||||
import BaseFeatureData from '../pseudo-documents/feature/baseFeatureData.mjs';
|
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ActionField from '../fields/actionField.mjs';
|
||||||
|
import { weaponFeatures } from '../../config/itemConfig.mjs';
|
||||||
|
|
||||||
export default class DHWeapon extends BaseDataItem {
|
export default class DHWeapon extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -39,14 +38,43 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
initial: 'physical'
|
initial: 'physical'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
feature: new fields.StringField({ choices: SYSTEM.ITEM.weaponFeatures, blank: true }),
|
features: new fields.ArrayField(
|
||||||
featureTest: new PseudoDocumentsField(BaseFeatureData, {
|
new fields.SchemaField({
|
||||||
required: true,
|
value: new fields.StringField({ required: true, choices: SYSTEM.ITEM.weaponFeatures, blank: true }),
|
||||||
nullable: true,
|
effectIds: new fields.ArrayField(new fields.StringField({ required: true }))
|
||||||
max: 1,
|
})
|
||||||
validTypes: ['weapon']
|
),
|
||||||
}),
|
|
||||||
actions: new fields.ArrayField(new ActionField())
|
actions: new fields.ArrayField(new ActionField())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _preUpdate(changes, options, user) {
|
||||||
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
|
if (allowed === false) return false;
|
||||||
|
|
||||||
|
if (changes.system.features) {
|
||||||
|
const removed = this.features.filter(x => !changes.system.features.includes(x));
|
||||||
|
const added = changes.system.features.filter(x => !this.features.includes(x));
|
||||||
|
|
||||||
|
for (var feature of removed) {
|
||||||
|
for (var effectId of feature.effectIds) {
|
||||||
|
await this.parent.effects.get(effectId).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var feature of added) {
|
||||||
|
const featureData = weaponFeatures[feature.value];
|
||||||
|
if (featureData.effects?.length > 0) {
|
||||||
|
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
|
{
|
||||||
|
name: game.i18n.localize(featureData.label),
|
||||||
|
description: game.i18n.localize(featureData.description),
|
||||||
|
changes: featureData.effects.flatMap(x => x.changes)
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
feature.effectIds = embeddedItems.map(x => x.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
export default class DhActiveEffect extends ActiveEffect {
|
export default class DhActiveEffect extends ActiveEffect {
|
||||||
|
get isSuppressed() {
|
||||||
|
if (['weapon', 'armor'].includes(this.parent.type)) {
|
||||||
|
return !this.parent.system.equipped;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.isSuppressed;
|
||||||
|
}
|
||||||
|
|
||||||
async _preCreate(data, options, user) {
|
async _preCreate(data, options, user) {
|
||||||
const update = {};
|
const update = {};
|
||||||
if (!data.img) {
|
if (!data.img) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<li class="item inventory-item">
|
<li class="item inventory-item">
|
||||||
<div class="inventory-row" data-item-id="{{item.uuid}}">
|
<div class="inventory-row" data-item-id="{{item.uuid}}">
|
||||||
<div class="inventory-item-title-container">
|
<div class="inventory-item-title-container">
|
||||||
<div data-action="useItem" data-value="{{item.uuid}}" class="inventory-item-title">
|
<div data-action="viewObject" data-value="{{item.uuid}}" class="inventory-item-title">
|
||||||
<img src="{{item.img}}" />
|
<img src="{{item.img}}" />
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
{{formField systemFields.baseScore value=source.system.baseScore}}
|
{{formField systemFields.baseScore value=source.system.baseScore}}
|
||||||
|
|
||||||
<span>{{localize "DAGGERHEART.Sheets.Armor.feature"}}</span>
|
<span>{{localize "DAGGERHEART.Sheets.Armor.feature"}}</span>
|
||||||
{{formField systemFields.feature value=source.system.feature localize=true blank=""}}
|
<input type="text" class="features-input" value="{{features}}" />
|
||||||
|
|
||||||
<span>{{localize "DAGGERHEART.Sheets.Armor.baseThresholds.base"}}</span>
|
<span>{{localize "DAGGERHEART.Sheets.Armor.baseThresholds.base"}}</span>
|
||||||
<div class="nest-inputs">
|
<div class="nest-inputs">
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,6 @@
|
||||||
<fieldset class="two-columns">
|
<fieldset class="two-columns">
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Weapon.Feature"}}</legend>
|
<legend>{{localize "DAGGERHEART.Sheets.Weapon.Feature"}}</legend>
|
||||||
<span>{{localize "DAGGERHEART.Sheets.Weapon.Feature"}}</span>
|
<span>{{localize "DAGGERHEART.Sheets.Weapon.Feature"}}</span>
|
||||||
{{formField systemFields.feature value=source.system.feature localize=true}}
|
<input type="text" class="features-input" value="{{features}}" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue