diff --git a/app/imports/api/creature/getDefaultCharacterDocs.js b/app/imports/api/creature/getDefaultCharacterDocs.js
index 31592518..cfb17000 100644
--- a/app/imports/api/creature/getDefaultCharacterDocs.js
+++ b/app/imports/api/creature/getDefaultCharacterDocs.js
@@ -18,12 +18,12 @@ const getRacialBonusEffect = function(charId, attribute, bonus){
name: "Race Bonus",
stat: attribute,
operation: "add",
- calculation: bonus,
+ calculation: bonus.toString(),
enabled: true,
parent: {
collection: "Creatures",
id: charId,
- group: "racial",
+ group: "race",
},
charId: charId,
};
diff --git a/app/imports/api/creature/properties/Attributes.js b/app/imports/api/creature/properties/Attributes.js
index 08a1686a..b3903688 100644
--- a/app/imports/api/creature/properties/Attributes.js
+++ b/app/imports/api/creature/properties/Attributes.js
@@ -91,6 +91,7 @@ let updateAttributeSchema = pickKeysAsOptional(attributeSchema, [
'type',
'baseValue',
'decimal',
+ 'adjustment',
'reset',
'resetMultiplier',
'color',
@@ -109,13 +110,18 @@ const updateAttribute = new ValidatedMethod({
}).validator(),
run({_id, update}) {
- let currentAttribute = Attributes.findOne(_id);
+ let currentAttribute = Attributes.findOne(_id, {fields: {value: 1, charId: 1}});
if (!currentAttribute){
throw new Meteor.Error("Attributes.methods.update.denied",
`No attributes exist with the id: ${_id}`);
}
let charId = currentAttribute.charId;
if (canEditCreature(charId, this.userId)){
+ if (typeof update.adjustment === 'number'){
+ let val = currentAttribute.value;
+ if (update.adjustment < -val) update.adjustment = -val;
+ if (update.adjustment > 0) update.adjustment = 0;
+ }
Attributes.update(_id, {$set: update});
recomputeCreatureById(charId);
}
diff --git a/app/imports/ui/character/CharacterSheet.vue b/app/imports/ui/character/CharacterSheet.vue
index d8b48e46..25ef34a3 100644
--- a/app/imports/ui/character/CharacterSheet.vue
+++ b/app/imports/ui/character/CharacterSheet.vue
@@ -62,7 +62,7 @@
},
data(){return {
theme,
- tab: 1,
+ tab: 0,
}},
methods: {
...mapMutations([
diff --git a/app/imports/ui/character/StatsTab.vue b/app/imports/ui/character/StatsTab.vue
index 8b9091d4..dd2ee105 100644
--- a/app/imports/ui/character/StatsTab.vue
+++ b/app/imports/ui/character/StatsTab.vue
@@ -31,7 +31,7 @@
/>
-
+
Hit Dice
-
+
hitDiceChange(hitDie._id, e)"
/>
diff --git a/app/imports/ui/components/AttributeDialog.vue b/app/imports/ui/components/AttributeDialog.vue
index f13b2d58..2f94bd67 100644
--- a/app/imports/ui/components/AttributeDialog.vue
+++ b/app/imports/ui/components/AttributeDialog.vue
@@ -3,27 +3,32 @@
{{name}}
-
-
- {{numberToSignedString(mod)}}
+
+
+
+ {{numberToSignedString(mod)}}
+
+
+ {{value}}
+
+
+
+ {{value+adjustment}} / {{value}}
-
+
+ {{numberToSignedString(value)}}
+
+
{{value}}
-
-
- {{value+adjustment}} / {{value}}
+
+
-
- {{numberToSignedString(value)}}
-
-
- {{value}}
-
-
-
-
Effects
-
+
+
$emit('change', update, ack)"/>
@@ -32,15 +37,24 @@
import store from "/imports/ui/vuexStore.js";
import DialogBase from "/imports/ui/dialogStack/DialogBase.vue";
import AttributeEffectList from '/imports/ui/components/AttributeEffectList.vue';
+ import AttributeEdit from '/imports/ui/components/AttributeEdit.vue';
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
export default {
props: {
+ charId: String,
name: String,
+ variableName: String,
+ order: Number,
type: String,
+ baseValue: Number,
value: Number,
mod: Number,
- baseValue: Number,
+ adjustment: Number,
+ decimal: Boolean,
+ reset: String,
+ resetMultiplier: Number,
+ color: String,
adjustment: {type: Number, default: 0},
effects: {type: Array, default: () => []},
},
@@ -66,6 +80,7 @@
components: {
DialogBase,
AttributeEffectList,
+ AttributeEdit,
},
};
diff --git a/app/imports/ui/components/AttributeDialogContainer.vue b/app/imports/ui/components/AttributeDialogContainer.vue
index 1eef55b6..ebb96cfe 100644
--- a/app/imports/ui/components/AttributeDialogContainer.vue
+++ b/app/imports/ui/components/AttributeDialogContainer.vue
@@ -2,13 +2,14 @@
diff --git a/app/imports/ui/components/AttributeEdit.vue b/app/imports/ui/components/AttributeEdit.vue
index fd28b4e2..a862898d 100644
--- a/app/imports/ui/components/AttributeEdit.vue
+++ b/app/imports/ui/components/AttributeEdit.vue
@@ -15,7 +15,7 @@
label="Base Value"
type="number"
:value="attribute.baseValue"
- @change="(baseValue, ack) => $emit('change', {baseValue}, ack)"
+ @change="(baseValue, ack) => $emit('change', {baseValue: +baseValue}, ack)"
hint="This is the value of the attribute before effects are applied"
/>
$emit('change', {decimal: e})"
+ @change="e => $emit('change', {decimal: !!e})"
/>
$emit('change', {resetMultiplier}, ack)"
+ @change="(resetMultiplier, ack) => $emit('change', {resetMultiplier: +resetMultiplier}, ack)"
hint="Some attributes, like hit dice, only reset by half their total on a long rest"
/>