Added ability to add/remove basic conditions

Conditions are those listed in ./lib/methods/conditions.js
This commit is contained in:
Jacob
2017-07-16 04:27:32 +01:00
parent be92ef224c
commit b3ef43eb70
16 changed files with 316 additions and 54 deletions

View File

@@ -43,6 +43,7 @@ Meteor.methods({
var newEffect = {
stat: effect.stat,
operation: effect.operation,
calculation: effect.calculation,
value: effect.value,
charId: charId,
parent: {
@@ -78,6 +79,21 @@ Meteor.methods({
Buffs.remove(buff);
//dont remove the effects, they get removed automatically through parenting
},
getConditions: function() {
return Object.keys(CONDITIONS);
},
getConditionName: function(conditionName) {
//get condition from constant
var condition = CONDITIONS[conditionName];
//check that condition exists
if (!condition) {
throw new Meteor.Error(
"Invalid condition",
conditionName + " is not a known condition"
);
}
return condition.buff.name;
},
});
trackEncumbranceConditions = function(charId, templateInstance) {
@@ -150,7 +166,7 @@ CONDITIONS = {
{
stat: "perception",
operation: "conditional",
calculation: "You fail your perception check if it requires sight",
calculation: "You fail your Perception check if it requires sight",
}
],
},
@@ -164,7 +180,7 @@ CONDITIONS = {
{
stat: "perception",
operation: "conditional",
calculation: "You fail your perception check if it requires hearing",
calculation: "You fail your Perception check if it requires hearing",
}
],
},
@@ -207,7 +223,7 @@ CONDITIONS = {
paralyzed: {
buff: {
name: "Paralyzed",
description: "A paralyzed creature is incapacitated and cant move or speak.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
description: "A paralyzed creature is **incapacitated** and cant move or speak.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
},
effects: [
{
@@ -232,7 +248,7 @@ CONDITIONS = {
petrified: {
buff: {
name: "Petrified",
description: "A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone). Its weight increases by a factor of ten, and it ceases aging.\n\nA petrified creature is incapacitated and cant move or speak, and is unaware of its surroundings.\n\nAttack rolls against the creature have advantage.\n\nThe creature is immune to poison and disease, although a poison or disease already in its system is suspended, not neutralized.",
description: "A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone). Its weight increases by a factor of ten, and it ceases aging.\n\nA petrified creature is **incapacitated** and cant move or speak, and is unaware of its surroundings.\n\nAttack rolls against the creature have advantage.\n\nThe creature is immune to poison and disease, although a poison or disease already in its system is suspended, not neutralized.",
},
effects: (function() {
var effects = [
@@ -294,7 +310,7 @@ CONDITIONS = {
stunned: {
buff: {
name: "Stunned",
description: "A stunned creature is incapacitated, cant move, and can speak only falteringly\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.",
description: "A stunned creature is **incapacitated**, cant move, and can speak only falteringly\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.",
},
effects: [
{
@@ -317,7 +333,7 @@ CONDITIONS = {
unconscious: {
buff: {
name: "Unconscious",
description: "An unconscious creature is incapacitated, cant move or speak, and is unaware of its surroundings.\n\nThe creature drops whatever its holding and falls prone.\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
description: "An unconscious creature is **incapacitated**, cant move or speak, and is unaware of its surroundings.\n\nThe creature drops whatever its holding and falls **prone**.\n\nThe creature automatically fails Strength and Dexterity saving throws.\n\nAttack rolls against the creature have advantage.\n\nAny attack that hits the creature is a critical hit if the attacker is within 5 feet of the creature.",
},
subConditions: ["incapacitated", "prone"],
},