Added fields to features, made features able to expire

This commit is contained in:
Stefan Zermatten
2014-11-28 09:19:53 +02:00
parent 19059d4cd5
commit cd6682a78a
9 changed files with 464 additions and 452 deletions

View File

@@ -1,6 +1,6 @@
Schemas.Attribute = new SimpleSchema({
//the temporary shift of the attribute
//should be zero for most attributes after a long rest
//should be zero after reset
adjustment: {
type: Number,
defaultValue: 0
@@ -10,7 +10,12 @@ Schemas.Attribute = new SimpleSchema({
mul: { type: [Schemas.Effect], defaultValue: [] },
min: { type: [Schemas.Effect], defaultValue: [] },
max: { type: [Schemas.Effect], defaultValue: [] },
conditional:{ type: [Schemas.Effect], defaultValue: [] }
conditional:{ type: [Schemas.Effect], defaultValue: [] },
reset: {
type: String,
defaultValue: "longRest",
allowedValues: ["longRest", "shortRest"]
}
});
//note that to make an invulnerability add a new max of zero value
@@ -24,4 +29,9 @@ Schemas.Vulnerability = new SimpleSchema({
mul: { type: [Schemas.Effect], defaultValue: [] },
min: { type: [Schemas.Effect], defaultValue: [{name: "Resistance doesn't stack", value: 0.5}] },
max: { type: [Schemas.Effect], defaultValue: [{name: "Vulnerability doesn't stack", value: 2}] },
});
reset: {
type: String,
defaultValue: "longRest",
allowedValues: ["longRest", "shortRest"]
}
});

View File

@@ -26,6 +26,6 @@ Schemas.Effect = new SimpleSchema({
type: {
type: String,
defaultValue: "default",
allowedValues: ["default", "class", "race", "feat", "equippedMagic", "equippedMundane", "external"]
allowedValues: ["default", "inate", "class", "race", "feat", "equippedMagic", "equippedMundane", "external"]
}
});
});

View File

@@ -6,7 +6,8 @@ Schemas.Expiration = new SimpleSchema({
autoValue: function(){
if(!this.isSet) return Random.id();
}},
stat: { type: String },
effectId: { type: String, regEx: SimpleSchema.RegEx.Id },
expiry: { type: Number }
});
stat: { type: String },
effectIds: { type: [String], regEx: SimpleSchema.RegEx.Id },
featureIds:{ type: [String], regEx: SimpleSchema.RegEx.Id },
expiry: { type: Number }
});

View File

@@ -1,10 +1,22 @@
Schemas.Feature = new SimpleSchema({
_id: {type: String, regEx: SimpleSchema.RegEx.Id},
name: {type: String},
description:{type: String},
buffs: {type: [Schemas.Buff], optional: true},
enabled: {type: Boolean},
expires: {type: Number, optional: true},
duration: {type: Number, optional: true},
uses: {type: Number, min: 0, optional: true},
});
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}
},
name: {type: String},
description:{type: String},
source: {type: String},
buffs: {type: [Schemas.Buff], defaultValue: []},
enabled: {type: Boolean, defaultValue: false},
duration: {type: Number, optional: true},
uses: {type: Number, min: 0, optional: true},
maxUses: {type: Number, min: 0, optional: true},
reset: {
type: String,
optional: true,
allowedValues: ["longRest", "shortRest"]
}
});