Implemented and cleaned up character schemas
This commit is contained in:
17
rpg-docs/Model/Character/SubSchemas/Effect/Buff.js
Normal file
17
rpg-docs/Model/Character/SubSchemas/Effect/Buff.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* A buff becomes an effect when applied on a creature.
|
||||
* It is the effect plus the stat to which it should be applied
|
||||
*/
|
||||
Schemas.Buff = new SimpleSchema({
|
||||
stat: {
|
||||
type: String
|
||||
},
|
||||
effect: {
|
||||
type: Schemas.Effect
|
||||
}
|
||||
});
|
||||
|
||||
Buff = function(name, stat, value){
|
||||
this.stat = stat;
|
||||
this.effect = new Effect(name, value);
|
||||
};
|
||||
35
rpg-docs/Model/Character/SubSchemas/Effect/Effect.js
Normal file
35
rpg-docs/Model/Character/SubSchemas/Effect/Effect.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Effects are reason-value pairs attached to skills and abilities
|
||||
* that modify their final value or presentation in some way
|
||||
*/
|
||||
Schemas.Effect = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue: function(){
|
||||
if(!isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: String
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true
|
||||
},
|
||||
calculation: {
|
||||
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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user