Implemented Features and Items granting effects, actions, attacks and spells

This commit is contained in:
Thaum
2015-01-06 12:25:58 +00:00
parent c55f2c51ab
commit 2d70119ee0
48 changed files with 625 additions and 442 deletions

View File

@@ -0,0 +1,29 @@
/*
* Actions are given to a character by items and features
*/
Schemas.Action = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}
},
name: {
type: String
},
description: {
type: String
},
type: {
type: String,
allowedValues: ["action, bonus, reaction, free"],
defaultValue: "action"
},
selfBuffs: {
type: [Schemas.Buff], defaultValue: []
},
selfAdjustments: {
type: [Schemas.Adjustment], defaultValue: []
}
});

View File

@@ -0,0 +1,25 @@
/*
* Adjustments make instantaneous changes to the value of some attribute
* Damage, healing and resource cost/recovery are all adjustments
*/
Schemas.Adjustment = new SimpleSchema({
name: {
type: String,
optional: true
},
//which stat the adjustment is applied to
stat: {
type: String,
optional: true
},
//the value added to the stat
value: {
type: Number,
decimal: true,
optional: true
},
calculation: {
type: String,
optional: true
}
});

View File

@@ -0,0 +1,31 @@
/*
* Attacks are given to a character by items and features
*/
Schemas.Attack = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}
},
name: {
type: String
},
range: {
type: String,
optional: true
},
attackBonus: {
type: String,
optional: true
},
damage: {
type: String
},
damageType: {
type: String,
allowedValues: ["acid", "bludgeoning", "cold", "fire", "force", "lightning", "necrotic",
"piercing", "poison", "psychic", "radiant", "slashing", "thunder"]
}
});

View File

@@ -0,0 +1,18 @@
//buffs are temporary once applied and store things which expire and their expiry time
Schemas.Buff = new SimpleSchema({
//buff id
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function(){
if(!this.isSet) return Random.id();
}},
//things that expire
effects: { type: [Schemas.Effect], defaultValue: [] },
actions: { type: [Schemas.Action], defaultValue: [] },
//expiry time
expiry: { type: Number, optional: true},
duration: { type: Number }
});

View File

@@ -1,5 +1,5 @@
/*
* Effects are reason-value pairs attached to skills and abilities
* Effects are reason-value attached to skills and abilities
* that modify their final value or presentation in some way
*/
Schemas.Effect = new SimpleSchema({
@@ -16,7 +16,7 @@ Schemas.Effect = new SimpleSchema({
operation: {
type: String,
defaultValue: "add",
allowedValues: ["proficiency","add","mul","min","max","advantage","disadvantage","passiveAdd","fail","conditional","passiveAdd"]
allowedValues: ["base", "proficiency","add","mul","min","max","advantage","disadvantage","passiveAdd","fail","conditional","passiveAdd"]
},
value: {
type: Number,
@@ -32,5 +32,10 @@ Schemas.Effect = new SimpleSchema({
type: String,
defaultValue: "editable",
allowedValues: ["editable", "feat", "buff", "equipment", "inate"]
},
//which stat the effect is applied to
stat: {
type: String,
optional: true
}
});

View File

@@ -1,12 +0,0 @@
/*
* 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
}
});

View File

@@ -1,13 +0,0 @@
//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 },
effectIds: { type: [String], regEx: SimpleSchema.RegEx.Id },
featureIds:{ type: [String], regEx: SimpleSchema.RegEx.Id },
expiry: { type: Number }
});

View File

@@ -1,22 +0,0 @@
Schemas.Feature = new SimpleSchema({
_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"]
}
});

View File

@@ -13,8 +13,10 @@ Schemas.Spell = new SimpleSchema({
duration: {type: Number},
"components.verbal": {type: Boolean},
"components.somatic": {type: Boolean},
"components.material": {type: String},
"components.material": {type: String, optional: true},
"components.concentration": {type: Boolean},
buffs: {type: [Schemas.Buff], optional: true},
ritual: {type: Boolean},
selfBuffs: {type: [Schemas.Buff], defaultValue: []},
level: {type: Number},
class: {type: String}
});