From 1717ee4bc75bb49cdae9b331db9bd256003a4940 Mon Sep 17 00:00:00 2001 From: Thaum Rystra Date: Thu, 16 Apr 2020 15:21:31 +0200 Subject: [PATCH] Made spells into a special kind of action --- app/imports/api/properties/Spells.js | 13 +- .../ui/creature/character/CharacterSheet.vue | 207 ++++++------ .../character/characterSheetTabs/StatsTab.vue | 295 +++++++++++------- .../components/actions/ActionListTile.vue | 34 ++ .../components/attributes/AbilityListTile.vue | 45 +-- app/imports/ui/properties/forms/SpellForm.vue | 44 ++- app/package.json | 2 +- 7 files changed, 389 insertions(+), 251 deletions(-) create mode 100644 app/imports/ui/properties/components/actions/ActionListTile.vue diff --git a/app/imports/api/properties/Spells.js b/app/imports/api/properties/Spells.js index 54f720a2..947632a0 100644 --- a/app/imports/api/properties/Spells.js +++ b/app/imports/api/properties/Spells.js @@ -1,4 +1,4 @@ -import { AttackSchema } from '/imports/api/properties/Attacks.js'; +import { ActionSchema } from '/imports/api/properties/Actions.js'; import SimpleSchema from 'simpl-schema'; const magicSchools = [ @@ -13,7 +13,7 @@ const magicSchools = [ ]; let SpellSchema = new SimpleSchema({}) -.extend(AttackSchema) +.extend(ActionSchema) .extend({ name: { type: String, @@ -29,6 +29,10 @@ let SpellSchema = new SimpleSchema({}) castWithoutSpellSlots: { type: Boolean, optional: true, + }, + hasAttackRoll: { + type: Boolean, + optional: true, }, // Spell lists that this spell appears on spellLists: { @@ -87,6 +91,11 @@ let SpellSchema = new SimpleSchema({}) defaultValue: 'abjuration', allowedValues: magicSchools, }, + // Set better defaults for the action + actionType: { + type: String, + defaultValue: 'spell', + }, }); export { SpellSchema }; diff --git a/app/imports/ui/creature/character/CharacterSheet.vue b/app/imports/ui/creature/character/CharacterSheet.vue index e1244c8a..5e0fde17 100644 --- a/app/imports/ui/creature/character/CharacterSheet.vue +++ b/app/imports/ui/creature/character/CharacterSheet.vue @@ -1,92 +1,115 @@ @@ -94,7 +117,7 @@ import Creatures from '/imports/api/creature/Creatures.js'; import removeCreature from '/imports/api/creature/removeCreature.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js'; - import { mapMutations } from "vuex"; + import { mapMutations } from 'vuex'; import { theme } from '/imports/ui/theme.js'; import StatsTab from '/imports/ui/creature/character/characterSheetTabs/StatsTab.vue'; import FeaturesTab from '/imports/ui/creature/character/characterSheetTabs/FeaturesTab.vue'; @@ -105,10 +128,6 @@ import { recomputeCreature } from '/imports/api/creature/computation/recomputeCreature.js'; export default { - props: { - showMenuButton: Boolean, - creatureId: String, - }, components: { StatsTab, FeaturesTab, @@ -117,13 +136,20 @@ PersonaTab, TreeTab, }, + props: { + showMenuButton: Boolean, + creatureId: { + type: String, + required: true, + }, + }, data(){return { theme, tab: 0, }}, methods: { ...mapMutations([ - "toggleDrawer", + 'toggleDrawer', ]), recompute(charId){ recomputeCreature.call({charId}); @@ -160,7 +186,7 @@ }, callback(confirmation){ if(!confirmation) return; - removeCreature.call({charId: that.creatureId}, (error, result) => { + removeCreature.call({charId: that.creatureId}, (error) => { if (error) { console.error(error); } else { @@ -174,7 +200,7 @@ }, meteor: { $subscribe: { - 'singleCharacter'(){ + 'singleCharacter'(){ return [this.creatureId]; }, }, @@ -182,6 +208,9 @@ return Creatures.findOne(this.creatureId) || {}; }, }, + provide: { + creature: this.character, + } } diff --git a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue index 752b4433..740fabf4 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/StatsTab.vue @@ -1,130 +1,172 @@ + + diff --git a/app/imports/ui/properties/components/attributes/AbilityListTile.vue b/app/imports/ui/properties/components/attributes/AbilityListTile.vue index 60ed39e4..373e5b2a 100644 --- a/app/imports/ui/properties/components/attributes/AbilityListTile.vue +++ b/app/imports/ui/properties/components/attributes/AbilityListTile.vue @@ -1,22 +1,23 @@ diff --git a/app/imports/ui/properties/forms/SpellForm.vue b/app/imports/ui/properties/forms/SpellForm.vue index cb6ef362..44587b6b 100644 --- a/app/imports/ui/properties/forms/SpellForm.vue +++ b/app/imports/ui/properties/forms/SpellForm.vue @@ -100,30 +100,42 @@ :debounce-time="debounceTime" @change="(value, ack) => $emit('change', {path: ['description'], value, ack})" /> - - - + + + + + + + +