Added indices, fixed bugs

This commit is contained in:
Stefan Zermatten
2018-09-27 09:39:21 +02:00
parent cf33bfcce1
commit d82031ab0d
4 changed files with 6 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ Schemas.Attribute = new SimpleSchema({
// The nice-to-read name
name: {
type: String,
index: 1,
},
// The technical, lowercase, single-word name used in formulae
variableName: {
@@ -20,6 +21,7 @@ Schemas.Attribute = new SimpleSchema({
// Attributes need to store their order to keep the sheet consistent
order: {
type: Number,
index: 1,
},
type: {
type: String,
@@ -32,6 +34,7 @@ Schemas.Attribute = new SimpleSchema({
"spellSlot", // Level 1, 2, 3... spell slots
"utility", // Aren't displayed, Jump height, Carry capacity
],
index: 1,
},
baseValue: {
type: Number,

View File

@@ -60,6 +60,7 @@ const computeCharacterById = function (charId){
let char = buildCharacter();
char = computeCharacter(char);
writeCharacter(char);
return char;
};
/*
@@ -339,7 +340,6 @@ const computeEffect = function(effect, char){
effect.result = evaluateCalculation(effect.calculation, char);
}
effect.computed = true;
console.log({effect});
};
/*
@@ -426,7 +426,6 @@ const combineAttribute = function(stat, char){
if (stat.attributeType === "ability") {
stat.mod = Math.floor((stat.result - 10) / 2);
}
console.log({statResult: stat.result})
}
const combineSkill = function(stat, char){

View File

@@ -150,4 +150,5 @@ getDefaultCharacterDocs = function(charId){
parent: _.clone(baseParent),
});
}
return docs;
}

View File

@@ -170,7 +170,7 @@ Migrations.add({
Skills.rawCollection().insert(defaultDocs.skills, {ordered: false});
DamageMultipliers.rawCollection().insert(defaultDocs.damageMultipliers, {ordered: false});
// Remove the stats on the character document
Characters.update(charId, modifier, function(error, result){
Characters.update(charId, modifier, {validate: false}, function(error, result){
if (error) console.log(error);
});
});