Gave effects their own collection, they no longer live in arrays attached to skills/attributes

Also improved the display of features and generally iterated on their manipulation.

Characters now fetch the relevant effects directly when making a calculation, simplifying almost everything.

Effects now store a reference to their source if they have one.

Effect names are now optional, they can be fetched from the source's name if the source exists.
This commit is contained in:
Thaum
2015-01-23 11:04:07 +00:00
parent 84512beb72
commit 6a2e7f0832
32 changed files with 340 additions and 642 deletions

View File

@@ -4,20 +4,22 @@ Template.featureDialog.rendered = function(){
var feature = Features.findOne(Template.currentData().featureId, {fields: {name: 1}});
if(feature && feature.name) Session.set("global.ui.dialogHeader", feature.name);
})
//after the dialog is built, open it
_.defer(function(){GlobalUI.dialog.open()});
}
Template.featureDialog.events({
"tap #deleteFeature": function(){
Features.remove(this._id);
GlobalUI.closeDialog()
},
"tap #addEffectButton": function(){
var numUpdated = Features.update(this._id, {
$push: {
"effects": {
name: "fe",
operation: "add",
type: "feature"
}
}
Effects.insert({
charId: Template.currentData().charId,
sourceId: this._id,
operation: "add",
type: "feature"
});
console.log("pushed add button ", numUpdated, " updated");
},
"change #featureNameInput": function(event){
var name = Template.instance().find("#featureNameInput").value;
@@ -32,5 +34,9 @@ Template.featureDialog.events({
Template.featureDialog.helpers({
feature: function(){
return Features.findOne(this.featureId);
},
effects: function(){
var cursor = Effects.find({charId: Template.currentData().charId, type: "feature", sourceId: this._id})
return cursor;
}
});