Action cards no longer display folder or the descendants of buffs
This commit is contained in:
@@ -105,7 +105,7 @@ const PROPERTIES = Object.freeze({
|
||||
name: 'Folder',
|
||||
docsPath: 'property/feature',
|
||||
helpText: 'A way to organise other properties on the character',
|
||||
suggestedParents: ['folder'],
|
||||
suggestedParents: ['action', 'folder'],
|
||||
},
|
||||
item: {
|
||||
icon: 'mdi-cube-outline',
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
const PROPERTIES = Object.freeze({
|
||||
action: {
|
||||
icon: '$vuetify.icons.action',
|
||||
name: 'Action',
|
||||
helpText: 'Actions are things your character can do. When an action is taken, all the properties under it are activated.',
|
||||
suggestedParents: ['classLevel', 'feature', 'item'],
|
||||
},
|
||||
attribute: {
|
||||
icon: '$vuetify.icons.attribute',
|
||||
name: 'Attribute',
|
||||
helpText: 'Attributes are the numbered statistics of your character, excluding rolls you might add proficiency bonus to, those are skills.',
|
||||
examples: 'Ability scores, speed, hit points, ki',
|
||||
suggestedParents: ['classLevel', 'buff'],
|
||||
},
|
||||
adjustment: {
|
||||
icon: '$vuetify.icons.attribute_damage',
|
||||
name: 'Attribute damage',
|
||||
helpText: 'Attribute damage reduces the current value of an attribute when it is applied by an action. A negative value causes the attribute to increase instead, up to its normal maximum.',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell', 'branch'],
|
||||
},
|
||||
buff: {
|
||||
icon: '$vuetify.icons.buff',
|
||||
name: 'Buff',
|
||||
helpText: 'When a buff is activated as a child of an action, it will copy the properties under itself onto a target character.',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell', 'branch'],
|
||||
},
|
||||
buffRemover: {
|
||||
icon: '$vuetify.icons.buffRemover',
|
||||
name: 'Remove Buff',
|
||||
helpText: 'Removes a buff from the target character',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell', 'branch'],
|
||||
},
|
||||
branch: {
|
||||
icon: 'mdi-file-tree',
|
||||
name: 'Branch',
|
||||
helpText: 'When a branch is activated as a child of an action, it can control which of its children get activated.',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell'],
|
||||
},
|
||||
class: {
|
||||
icon: 'mdi-card-account-details',
|
||||
name: 'Class',
|
||||
helpText: 'Your character should ideally have one starting class. Classes hold class levels',
|
||||
suggestedParents: [],
|
||||
},
|
||||
classLevel: {
|
||||
icon: '$vuetify.icons.class_level',
|
||||
name: 'Class level',
|
||||
helpText: 'Class levels represent a single level gained in a class',
|
||||
suggestedParents: ['class'],
|
||||
},
|
||||
constant: {
|
||||
icon: 'mdi-anchor',
|
||||
name: 'Constant',
|
||||
helpText: 'A constant can define a static value that can be used in calculations elsewhere in the sheet',
|
||||
suggestedParents: [],
|
||||
},
|
||||
container: {
|
||||
icon: 'mdi-bag-personal-outline',
|
||||
name: 'Container',
|
||||
helpText: 'A container holds items in the inventory',
|
||||
examples: 'Coin pouch, backpack',
|
||||
suggestedParents: ['folder'],
|
||||
},
|
||||
damage: {
|
||||
icon: '$vuetify.icons.damage',
|
||||
name: 'Damage',
|
||||
helpText: 'When damage is activated by an action it reduces the hit points of the target creature by the calculated amount.',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell', 'branch'],
|
||||
},
|
||||
damageMultiplier: {
|
||||
icon: '$vuetify.icons.damage_multiplier',
|
||||
name: 'Damage multiplier',
|
||||
helpText: 'Resistance, vulnerability, and immunity.',
|
||||
suggestedParents: ['classLevel', 'feature', 'item'],
|
||||
},
|
||||
effect: {
|
||||
icon: '$vuetify.icons.effect',
|
||||
name: 'Effect',
|
||||
helpText: 'Effects change the value or state of attributes and skills.',
|
||||
examples: '+2 Strength, Advantage on dexterity saving throws',
|
||||
suggestedParents: ['buff', 'classLevel', 'feature', 'folder', 'item'],
|
||||
},
|
||||
feature: {
|
||||
icon: 'mdi-text-subject',
|
||||
name: 'Feature',
|
||||
helpText: 'Descriptive or narrative features your character has access to',
|
||||
suggestedParents: ['classLevel', 'folder'],
|
||||
},
|
||||
folder: {
|
||||
icon: 'mdi-folder-outline',
|
||||
name: 'Folder',
|
||||
helpText: 'A way to organise other properties on the character',
|
||||
suggestedParents: ['folder'],
|
||||
},
|
||||
item: {
|
||||
icon: 'mdi-cube-outline',
|
||||
name: 'Item',
|
||||
helpText: 'Objects and equipment your charcter finds on their adventures',
|
||||
suggestedParents: ['container'],
|
||||
},
|
||||
note: {
|
||||
icon: 'mdi-note-outline',
|
||||
name: 'Note',
|
||||
helpText: 'Notes about your character and their adventures',
|
||||
suggestedParents: ['note', 'folder'],
|
||||
},
|
||||
pointBuy: {
|
||||
icon: 'mdi-table',
|
||||
name: 'Point Buy',
|
||||
helpText: 'A point buy table that allows the user to select an array of values that match a given cost',
|
||||
suggestedParents: [],
|
||||
},
|
||||
proficiency: {
|
||||
icon: 'mdi-brightness-1',
|
||||
name: 'Proficiency',
|
||||
helpText: 'Proficiencies apply your proficiency bonus to skills already on your character sheet.',
|
||||
suggestedParents: ['buff', 'classLevel', 'feature', 'folder'],
|
||||
},
|
||||
roll: {
|
||||
icon: '$vuetify.icons.roll',
|
||||
name: 'Roll',
|
||||
helpText: 'When activated by an action, rolls perform a calculation and temporarily store the result for other properties under the same action to use',
|
||||
suggestedParents: ['action', 'attack', 'savingThrow', 'spell', 'branch'],
|
||||
},
|
||||
reference: {
|
||||
icon: 'mdi-vector-link',
|
||||
name: 'Reference',
|
||||
libraryOnly: true,
|
||||
helpText: 'A reference is a link to a different property in a library. When a reference gets copied to a character sheet, it is replaced with the referenced property and all its children.',
|
||||
suggestedParents: [],
|
||||
},
|
||||
savingThrow: {
|
||||
icon: '$vuetify.icons.saving_throw',
|
||||
name: 'Saving throw',
|
||||
helpText: 'When a saving throw is activated by an action, it causes the target to make a saving throw, if the saving throw fails, the children properties of the saving throw are activated.',
|
||||
suggestedParents: ['action', 'attack', 'spell'],
|
||||
},
|
||||
skill: {
|
||||
icon: '$vuetify.icons.skill',
|
||||
name: 'Skill',
|
||||
helpText: 'Skills, saves, languages, and weapon and tool proficiencies are all skills. Skills can have a default proficiency set. Proficiencies and effects can change the value and state of skills.',
|
||||
suggestedParents: ['classLevel', 'folder'],
|
||||
},
|
||||
propertySlot: {
|
||||
icon: 'mdi-power-socket-eu',
|
||||
name: 'Slot',
|
||||
helpText: 'A slot in the character sheet is used to specify that a property needs to be selected from a library to fill the slot. The slot can determine what tags it is looking for, and any subscribed library property with matching tags can fill the slot',
|
||||
suggestedParents: [],
|
||||
},
|
||||
slotFiller: {
|
||||
icon: 'mdi-power-plug-outline',
|
||||
name: 'Slot filler',
|
||||
helpText: 'A slot filler allows for more advanced logic when it attempts to fill a slot. It can masquarade as any property type, and calculate whether it should fill a slot or not.',
|
||||
suggestedParents: ['propertySlot'],
|
||||
},
|
||||
spellList: {
|
||||
icon: '$vuetify.icons.spell_list',
|
||||
name: 'Spell list',
|
||||
helpText: 'A list of spells on your character sheet. It can provide a DC and spell attack bonus to the spells within',
|
||||
suggestedParents: [],
|
||||
},
|
||||
spell: {
|
||||
icon: '$vuetify.icons.spell',
|
||||
name: 'Spell',
|
||||
helpText: 'A spell your character can potentially cast',
|
||||
suggestedParents: ['spellList'],
|
||||
},
|
||||
toggle: {
|
||||
icon: '$vuetify.icons.toggle',
|
||||
name: 'Toggle',
|
||||
helpText: 'Togggles allow parts of the character sheet to be turned on and off, either manually or as the result of a calculation.',
|
||||
suggestedParents: [],
|
||||
},
|
||||
trigger: {
|
||||
icon: 'mdi-electric-switch',
|
||||
name: 'Trigger',
|
||||
helpText: 'Triggers apply their children in response to events on the character sheet, such as taking an action or receiving damage',
|
||||
suggestedParents: [],
|
||||
},
|
||||
});
|
||||
|
||||
export default PROPERTIES;
|
||||
|
||||
export function getPropertyName(type){
|
||||
return type && PROPERTIES[type] && PROPERTIES[type].name;
|
||||
}
|
||||
|
||||
export function getPropertyIcon(type){
|
||||
return type && PROPERTIES[type] && PROPERTIES[type].icon;
|
||||
}
|
||||
@@ -249,18 +249,6 @@
|
||||
@sub-click="_id => clickTreeProperty({_id})"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-for="attack in attacks"
|
||||
:key="attack._id"
|
||||
class="attack"
|
||||
>
|
||||
<action-card
|
||||
attack
|
||||
:model="attack"
|
||||
:data-id="attack._id"
|
||||
@click="clickProperty({_id: attack._id})"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="weapons && weapons.length"
|
||||
@@ -494,19 +482,6 @@ export default {
|
||||
sort: { value: 1, order: 1 }
|
||||
});
|
||||
},
|
||||
attacks() {
|
||||
let props = getProperties(this.creature, { type: 'attack' })
|
||||
return props && props.map(attack => {
|
||||
attack.children = CreatureProperties.find({
|
||||
'ancestors.id': attack._id,
|
||||
removed: { $ne: true },
|
||||
inactive: { $ne: true },
|
||||
}, {
|
||||
sort: { order: 1 }
|
||||
});
|
||||
return attack;
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clickProperty({ _id }) {
|
||||
|
||||
@@ -87,7 +87,14 @@
|
||||
<template v-if="model.summary">
|
||||
<markdown-text :markdown="model.summary.value || model.summary.text" />
|
||||
</template>
|
||||
<v-divder v-if="model.children && model.children.length" />
|
||||
<v-divider v-if="children && children.length" />
|
||||
<tree-node-list
|
||||
v-if="children && children.length"
|
||||
start-expanded
|
||||
:children="children"
|
||||
@selected="e => $emit('sub-click', e)"
|
||||
/>
|
||||
<!--
|
||||
<creature-properties-tree
|
||||
style="width: 100%;"
|
||||
expanded
|
||||
@@ -95,6 +102,7 @@
|
||||
@length="childrenLength = $event"
|
||||
@selected="e => $emit('sub-click', e)"
|
||||
/>
|
||||
-->
|
||||
</div>
|
||||
<card-highlight :active="hovering" />
|
||||
</v-card>
|
||||
@@ -112,6 +120,10 @@ import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
import CreaturePropertiesTree from '/imports/ui/creature/creatureProperties/CreaturePropertiesTree.vue';
|
||||
import TreeNodeList from '/imports/ui/components/tree/TreeNodeList.vue';
|
||||
import { nodeArrayToTree } from '/imports/api/parenting/nodesToTree.js';
|
||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||
import { some } from 'lodash';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -122,6 +134,7 @@ export default {
|
||||
RollPopup,
|
||||
CardHighlight,
|
||||
CreaturePropertiesTree,
|
||||
TreeNodeList,
|
||||
},
|
||||
inject: {
|
||||
context: {
|
||||
@@ -170,6 +183,35 @@ export default {
|
||||
return `$vuetify.icons.${this.model.actionType}`;
|
||||
},
|
||||
},
|
||||
meteor: {
|
||||
children() {
|
||||
const indicesOfTerminatingProps = [];
|
||||
const decendants = CreatureProperties.find({
|
||||
'ancestors.id': this.model._id,
|
||||
'removed': { $ne: true },
|
||||
}, {
|
||||
sort: {order: 1}
|
||||
}).map(prop => {
|
||||
// Get all the props we don't want to show the decendants of and
|
||||
// where they might appear in the ancestor list
|
||||
if (prop.type === 'buff' || prop.type === 'folder') {
|
||||
indicesOfTerminatingProps.push({
|
||||
id: prop._id,
|
||||
ancestorIndex: prop.ancestors.length,
|
||||
});
|
||||
}
|
||||
return prop;
|
||||
}).filter(prop => {
|
||||
// Filter out folders entirely
|
||||
if (prop.type === 'folder') return false;
|
||||
// Filter out decendants of terminating props
|
||||
return !some(indicesOfTerminatingProps, buffIndex => {
|
||||
return prop.ancestors[buffIndex.ancestorIndex]?.id === buffIndex.id;
|
||||
});
|
||||
});
|
||||
return nodeArrayToTree(decendants);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
click(e) {
|
||||
this.$emit('click', e);
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"vueCompilerOptions": {
|
||||
"target": 2,
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*"
|
||||
|
||||
46
app/package-lock.json
generated
46
app/package-lock.json
generated
@@ -49,6 +49,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/parser": {
|
||||
"version": "7.19.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.3.tgz",
|
||||
"integrity": "sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/runtime": {
|
||||
"version": "7.18.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.3.tgz",
|
||||
@@ -353,6 +359,34 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@vue/compiler-core": {
|
||||
"version": "3.2.40",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.40.tgz",
|
||||
"integrity": "sha512-2Dc3Stk0J/VyQ4OUr2yEC53kU28614lZS+bnrCbFSAIftBJ40g/2yQzf4mPBiFuqguMB7hyHaujdgZAQ67kZYA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/shared": "3.2.40",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
},
|
||||
"@vue/compiler-dom": {
|
||||
"version": "3.2.40",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.40.tgz",
|
||||
"integrity": "sha512-OZCNyYVC2LQJy4H7h0o28rtk+4v+HMQygRTpmibGoG9wZyomQiS5otU7qo3Wlq5UfHDw2RFwxb9BJgKjVpjrQw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@vue/compiler-core": "3.2.40",
|
||||
"@vue/shared": "3.2.40"
|
||||
}
|
||||
},
|
||||
"@vue/shared": {
|
||||
"version": "3.2.40",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.40.tgz",
|
||||
"integrity": "sha512-0PLQ6RUtZM0vO3teRfzGi4ltLUO5aO+kLgwh4Um3THSR03rpQWLTuRCkuO5A41ITzwdWeKdPHtSARuPkoo5pCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
@@ -1277,6 +1311,12 @@
|
||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
||||
"dev": true
|
||||
},
|
||||
"estree-walker": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
@@ -3722,6 +3762,12 @@
|
||||
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz",
|
||||
|
||||
@@ -63,12 +63,14 @@
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
||||
"@typescript-eslint/parser": "^5.39.0",
|
||||
"@vue/compiler-dom": "^3.2.40",
|
||||
"chai": "^4.3.6",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^7.20.0",
|
||||
"eslint-plugin-vuetify": "^1.1.0",
|
||||
"mem": "^6.1.1",
|
||||
"sass": "^1.52.2"
|
||||
"sass": "^1.52.2",
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
@@ -122,4 +124,4 @@
|
||||
"vuetify/no-deprecated-classes": "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
Folders allow the [character tree](/docs/tree) to be organized.
|
||||
|
||||
### Folders in actions
|
||||
|
||||
When a folder is the child of an action, it and its children will not show on the action card, but will still appear in the detail view of the action and be applied when the action is taken.
|
||||
|
||||
---
|
||||
|
||||
### Name
|
||||
|
||||
Reference in New Issue
Block a user