diff --git a/app/imports/api/properties/Damages.js b/app/imports/api/properties/Damages.js
index d01a2e0d..b5510444 100644
--- a/app/imports/api/properties/Damages.js
+++ b/app/imports/api/properties/Damages.js
@@ -33,10 +33,23 @@ const DamageSchema = createPropertySchema({
type: Boolean,
optional: true,
},
+ // remove the entire object if there is no saving throw
save: {
- type: SavingThrowSchema,
+ type: Object,
optional: true,
},
+ // The computed DC
+ 'save.dc': {
+ type: 'fieldToCompute',
+ optional: true,
+ },
+ // The variable name of save to roll
+ 'save.stat': {
+ type: String,
+ optional: true,
+ max: STORAGE_LIMITS.variableName,
+ },
+ // The damage to deal on a successful save
'save.damageFunction': {
type: 'fieldToCompute',
optional: true,
@@ -51,13 +64,18 @@ const ComputedOnlyDamageSchema = createPropertySchema({
parseLevel: 'compile',
},
save: {
- type: ComputedOnlySavingThrowSchema,
+ type: Object,
+ optional: true,
+ },
+ 'save.dc': {
+ type: 'computedOnlyField',
+ parseLevel: 'compile',
optional: true,
},
'save.damageFunction': {
type: 'computedOnlyField',
- optional: true,
parseLevel: 'compile',
+ optional: true,
},
});
diff --git a/app/imports/client/ui/properties/forms/DamageForm.vue b/app/imports/client/ui/properties/forms/DamageForm.vue
index b7ed8881..8c5204c0 100644
--- a/app/imports/client/ui/properties/forms/DamageForm.vue
+++ b/app/imports/client/ui/properties/forms/DamageForm.vue
@@ -31,25 +31,92 @@
@change="change('damageType', ...arguments)"
/>
-
-
-
-
+
$emit('change', {
+ path: ['save'],
+ value: val ? {} : undefined,
+ ack
+ })"
/>
+
+
+
+
+
+
+ $emit('change', {path: ['save', 'dc', ...path], value, ack})"
+ />
+
+
+
+ $emit('change', {path: ['save', 'stat'], value, ack})"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $emit('change', {path: ['save', 'damageFunction', ...path], value, ack})"
+ />
+
+
@@ -60,9 +127,10 @@
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
import propertyFormMixin from '/imports/client/ui/properties/forms/shared/propertyFormMixin.js';
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
+import saveListMixin from '/imports/client/ui/properties/forms/shared/lists/saveListMixin.js';
export default {
- mixins: [propertyFormMixin],
+ mixins: [propertyFormMixin, saveListMixin],
props: {
parentTarget: {
type: String,
@@ -102,6 +170,13 @@ export default {
return hints[this.model.target];
}
},
+ methods: {
+ saveChange({ path, value, ack }) {
+ console.log({ path, value, ack });
+ this.$emit('change', {path: [ 'save', ...path ], value, ack})
+ this.$emit('change', {path: [ 'silent' ], value: true, ack})
+ },
+ },
}
diff --git a/app/imports/client/ui/properties/forms/SavingThrowForm.vue b/app/imports/client/ui/properties/forms/SavingThrowForm.vue
index 4b5aaf25..95050bcc 100644
--- a/app/imports/client/ui/properties/forms/SavingThrowForm.vue
+++ b/app/imports/client/ui/properties/forms/SavingThrowForm.vue
@@ -29,7 +29,6 @@