diff --git a/app/imports/api/creature/properties/Rolls.js b/app/imports/api/creature/properties/Rolls.js index b46d2fcd..6934ac70 100644 --- a/app/imports/api/creature/properties/Rolls.js +++ b/app/imports/api/creature/properties/Rolls.js @@ -51,10 +51,10 @@ let RollChildrenSchema = new SimpleSchema({ * child rolls are applied */ let RollSchema = new SimpleSchema({ - // Apply this only if the parent roll missed - // i.e. roll failed or target suceeded on their save - onMiss: { - type: Boolean, + // The roll made against the target value. A calculation that resolves to a + // number or a roll. If it is a number, it will be added to a d20 roll + roll: { + type: String, optional: true, }, // The target number to meet or exceed @@ -62,13 +62,20 @@ let RollSchema = new SimpleSchema({ type: String, optional: true, }, - // Swap who wins ties - invertTies: { + // Is this roll a saving throw + rollType: { + type: String, + defaultValue: 'roll', + allowedValues: ['roll', 'savingThrow'], + }, + // Apply this only if the parent roll missed + // i.e. roll failed or target suceeded on their save + onMiss: { type: Boolean, optional: true, }, - // Is this roll a saving throw - isSavingThrow: { + // Swap who wins ties + invertTies: { type: Boolean, optional: true, }, @@ -81,15 +88,15 @@ let RollSchema = new SimpleSchema({ 'tags.$': { type: String, }, - // The roll made against the target value. A calculation that resolves to a - // number or a roll. If it is a number, it will be added to a d20 roll - roll: { - type: String, - optional: true, - }, // The buffs and adjustments to apply based on the outcome of the roll - hit: RollChildrenSchema, - miss: RollChildrenSchema, + hit: { + type: RollChildrenSchema, + defaultValue: {}, + }, + miss: { + type: RollChildrenSchema, + defaultValue: {}, + }, }); Rolls.attachSchema(RollSchema); diff --git a/app/imports/ui/forms/AttributeForm.vue b/app/imports/ui/forms/AttributeForm.vue index 28f6e778..a4d72ba7 100644 --- a/app/imports/ui/forms/AttributeForm.vue +++ b/app/imports/ui/forms/AttributeForm.vue @@ -47,7 +47,7 @@ class="no-flex" :value="model.decimal" :error-messages="errors.decimal" - @change="e => $emit('change', $emit('change', {path: ['decimal'], value: !!e, ack}))" + @change="e => $emit('change', {path: ['decimal'], value: !!e})" />
diff --git a/app/imports/ui/forms/RollForm.vue b/app/imports/ui/forms/RollForm.vue new file mode 100644 index 00000000..19448ede --- /dev/null +++ b/app/imports/ui/forms/RollForm.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/app/imports/ui/forms/components/propertyFormIndex.js b/app/imports/ui/forms/components/propertyFormIndex.js index 57a1ab3b..9ca9fe6c 100644 --- a/app/imports/ui/forms/components/propertyFormIndex.js +++ b/app/imports/ui/forms/components/propertyFormIndex.js @@ -9,6 +9,7 @@ import FeatureForm from '/imports/ui/forms/FeatureForm.vue'; import FolderForm from '/imports/ui/forms/FolderForm.vue'; import NoteForm from '/imports/ui/forms/NoteForm.vue'; import ProficiencyForm from '/imports/ui/forms/ProficiencyForm.vue'; +import RollForm from '/imports/ui/forms/RollForm.vue'; export default { action: ActionForm, @@ -22,4 +23,5 @@ export default { folder: FolderForm, note: NoteForm, proficiency: ProficiencyForm, + roll: RollForm, };