Changed how effects are applied and removed to enable effects expiring after a set duration.
This commit is contained in:
@@ -44,7 +44,7 @@ Schemas.Attributes = new SimpleSchema({
|
||||
"armor.add": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [
|
||||
new Effect("Dexterity Modifier", "skillMod skills.dexterityArmor")
|
||||
{name: "Dexterity Modifier", value: "skillMod skills.dexterityArmor"}
|
||||
]
|
||||
}
|
||||
});
|
||||
@@ -9,9 +9,4 @@ Schemas.Buff = new SimpleSchema({
|
||||
effect: {
|
||||
type: Schemas.Effect
|
||||
}
|
||||
});
|
||||
|
||||
Buff = function(name, stat, value){
|
||||
this.stat = stat;
|
||||
this.effect = new Effect(name, value);
|
||||
};
|
||||
});
|
||||
@@ -7,7 +7,7 @@ Schemas.Effect = new SimpleSchema({
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue: function(){
|
||||
if(!isSet) return Random.id();
|
||||
if(!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
name: {
|
||||
@@ -22,14 +22,4 @@ Schemas.Effect = new SimpleSchema({
|
||||
type: String,
|
||||
optional: true
|
||||
}
|
||||
});
|
||||
|
||||
Effect = function(name, value){
|
||||
this._id = Random.id();
|
||||
this.name = name;
|
||||
if (typeof value === "string"){
|
||||
this.calculation = value;
|
||||
} else if (typeof valye === "number"){
|
||||
this.value = value;
|
||||
}
|
||||
};
|
||||
});
|
||||
12
rpg-docs/Model/Character/SubSchemas/Expiration.js
Normal file
12
rpg-docs/Model/Character/SubSchemas/Expiration.js
Normal file
@@ -0,0 +1,12 @@
|
||||
//schema to store all effects which expire and their expiry dates
|
||||
Schemas.Expiration = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue: function(){
|
||||
if(!this.isSet) return Random.id();
|
||||
}},
|
||||
stat: { type: String },
|
||||
effectId: { type: String, regEx: SimpleSchema.RegEx.Id },
|
||||
expiry: { type: Number }
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
Schemas.Feature = new SimpleSchema({
|
||||
_id: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
character: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
name: {type: String},
|
||||
description:{type: String},
|
||||
buffs: {type: [Schemas.Buff], optional: true},
|
||||
@@ -8,4 +7,4 @@ Schemas.Feature = new SimpleSchema({
|
||||
expires: {type: Number, optional: true},
|
||||
duration: {type: Number, optional: true},
|
||||
uses: {type: Number, min: 0, optional: true},
|
||||
})
|
||||
});
|
||||
@@ -1,9 +1,9 @@
|
||||
Schemas.Vulnerability = _.extend({
|
||||
"min.defaultValue": [
|
||||
new Effect("Resistance doesn't stack", 0.5)
|
||||
{name: "Resistance doesn't stack", value: 0.5}
|
||||
],
|
||||
"max.defaultValue": [
|
||||
new Effect("Vulnerability doesn't stack", 2)
|
||||
{name: "Vulnerability doesn't stack", value: 2}
|
||||
]
|
||||
}, Schemas.Attribute);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user