Merge pull request #38 from ThaumRystra/feature-base-ability-scores-10
Base ability scores default to 10, closes #36
This commit is contained in:
@@ -59,71 +59,74 @@ Schemas.Effect = new SimpleSchema({
|
|||||||
|
|
||||||
Effects.attachSchema(Schemas.Effect);
|
Effects.attachSchema(Schemas.Effect);
|
||||||
|
|
||||||
if (Meteor.isServer) Characters.after.insert(function(userId, char) {
|
|
||||||
Effects.insert({
|
|
||||||
charId: char._id,
|
|
||||||
name: "Constitution modifier for each level",
|
|
||||||
stat: "hitPoints",
|
|
||||||
operation: "add",
|
|
||||||
calculation: "level * constitutionMod",
|
|
||||||
parent: {
|
|
||||||
id: char._id,
|
|
||||||
collection: "Characters",
|
|
||||||
group: "Inate",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Effects.insert({
|
|
||||||
charId: char._id,
|
|
||||||
name: "Proficiency bonus by level",
|
|
||||||
stat: "proficiencyBonus",
|
|
||||||
operation: "add",
|
|
||||||
calculation: "floor(level / 4 + 1.75)",
|
|
||||||
parent: {
|
|
||||||
id: char._id,
|
|
||||||
collection: "Characters",
|
|
||||||
group: "Inate",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Effects.insert({
|
|
||||||
charId: char._id,
|
|
||||||
name: "Dexterity Armor Bonus",
|
|
||||||
stat: "armor",
|
|
||||||
operation: "add",
|
|
||||||
calculation: "dexterityArmor",
|
|
||||||
parent: {
|
|
||||||
id: char._id,
|
|
||||||
collection: "Characters",
|
|
||||||
group: "Inate",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Effects.insert({
|
|
||||||
charId: char._id,
|
|
||||||
name: "Natural Armor",
|
|
||||||
stat: "armor",
|
|
||||||
operation: "base",
|
|
||||||
value: 10,
|
|
||||||
parent: {
|
|
||||||
id: char._id,
|
|
||||||
collection: "Characters",
|
|
||||||
group: "Inate",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
Effects.insert({
|
|
||||||
charId: char._id,
|
|
||||||
name: "Natural Carrying Capacity",
|
|
||||||
stat: "carryMultiplier",
|
|
||||||
operation: "base",
|
|
||||||
value: "1",
|
|
||||||
parent: {
|
|
||||||
id: char._id,
|
|
||||||
collection: "Characters",
|
|
||||||
group: "Inate",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Effects.attachBehaviour("softRemovable");
|
Effects.attachBehaviour("softRemovable");
|
||||||
makeChild(Effects, ["enabled"]); //children of lots of things
|
makeChild(Effects, ["enabled"]); //children of lots of things
|
||||||
|
|
||||||
Effects.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
Effects.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||||
Effects.deny(CHARACTER_SUBSCHEMA_DENY);
|
Effects.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||||
|
|
||||||
|
//give characters default character effects
|
||||||
|
Characters.after.insert(function(userId, char) {
|
||||||
|
if (Meteor.isServer) {
|
||||||
|
Effects.insert({
|
||||||
|
charId: char._id,
|
||||||
|
name: "Constitution modifier for each level",
|
||||||
|
stat: "hitPoints",
|
||||||
|
operation: "add",
|
||||||
|
calculation: "level * constitutionMod",
|
||||||
|
parent: {
|
||||||
|
id: char._id,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "Inate",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
charId: char._id,
|
||||||
|
name: "Proficiency bonus by level",
|
||||||
|
stat: "proficiencyBonus",
|
||||||
|
operation: "add",
|
||||||
|
calculation: "floor(level / 4 + 1.75)",
|
||||||
|
parent: {
|
||||||
|
id: char._id,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "Inate",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
charId: char._id,
|
||||||
|
name: "Dexterity Armor Bonus",
|
||||||
|
stat: "armor",
|
||||||
|
operation: "add",
|
||||||
|
calculation: "dexterityArmor",
|
||||||
|
parent: {
|
||||||
|
id: char._id,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "Inate",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
charId: char._id,
|
||||||
|
name: "Natural Armor",
|
||||||
|
stat: "armor",
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
parent: {
|
||||||
|
id: char._id,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "Inate",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
charId: char._id,
|
||||||
|
name: "Natural Carrying Capacity",
|
||||||
|
stat: "carryMultiplier",
|
||||||
|
operation: "base",
|
||||||
|
value: "1",
|
||||||
|
parent: {
|
||||||
|
id: char._id,
|
||||||
|
collection: "Characters",
|
||||||
|
group: "Inate",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
@@ -35,3 +35,81 @@ makeParent(Features, ["name", "enabled"]); //parents of effects and attacks
|
|||||||
|
|
||||||
Features.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
Features.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||||
Features.deny(CHARACTER_SUBSCHEMA_DENY);
|
Features.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||||
|
|
||||||
|
//give characters default feature of base ability scores of 10
|
||||||
|
Characters.after.insert(function(userId, char) {
|
||||||
|
if (Meteor.isServer){
|
||||||
|
var featureId = Features.insert({
|
||||||
|
name: "Base Ability Scores",
|
||||||
|
charId: char._id,
|
||||||
|
enabled: true,
|
||||||
|
alwaysEnabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "strength",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "dexterity",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "constitution",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "intelligence",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "wisdom",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
Effects.insert({
|
||||||
|
stat: "charisma",
|
||||||
|
charId: char._id,
|
||||||
|
parent: {
|
||||||
|
id: featureId,
|
||||||
|
collection: "Features",
|
||||||
|
},
|
||||||
|
operation: "base",
|
||||||
|
value: 10,
|
||||||
|
enabled: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user