Merge branch 'feature-carry-capacity-modifier'

This commit is contained in:
Stefan Zermatten
2015-09-03 14:09:51 +02:00
8 changed files with 78 additions and 10 deletions

View File

@@ -33,6 +33,7 @@ Schemas.Character = new SimpleSchema({
age: {type: Schemas.Attribute}, age: {type: Schemas.Attribute},
ageRate: {type: Schemas.Attribute}, ageRate: {type: Schemas.Attribute},
armor: {type: Schemas.Attribute}, armor: {type: Schemas.Attribute},
carryMultiplier: {type: Schemas.Attribute},
//resources //resources
level1SpellSlots: {type: Schemas.Attribute}, level1SpellSlots: {type: Schemas.Attribute},

View File

@@ -107,6 +107,18 @@ if (Meteor.isServer) Characters.after.insert(function(userId, char) {
group: "Inate", 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");

View File

@@ -42,6 +42,7 @@ var stats = [
{stat: "rageDamage", name: "Rage Damage", group: "Stats"}, {stat: "rageDamage", name: "Rage Damage", group: "Stats"},
{stat: "expertiseDice", name: "Expertise Dice", group: "Stats"}, {stat: "expertiseDice", name: "Expertise Dice", group: "Stats"},
{stat: "superiorityDice", name: "Superiority Dice", group: "Stats"}, {stat: "superiorityDice", name: "Superiority Dice", group: "Stats"},
{stat: "carryMultiplier", name: "Carry Capacity Multiplier", group: "Stats"},
{stat: "level1SpellSlots", name: "level 1", group: "Spell Slots"}, {stat: "level1SpellSlots", name: "level 1", group: "Spell Slots"},
{stat: "level2SpellSlots", name: "level 2", group: "Spell Slots"}, {stat: "level2SpellSlots", name: "level 2", group: "Spell Slots"},
{stat: "level3SpellSlots", name: "level 3", group: "Spell Slots"}, {stat: "level3SpellSlots", name: "level 3", group: "Spell Slots"},

View File

@@ -14,7 +14,9 @@ var getFractionCarried = function(char) {
}); });
//get strength //get strength
var strength = Characters.calculate.attributeValue(char._id, "strength"); var strength = Characters.calculate.attributeValue(char._id, "strength");
var capacity = strength * 15; var carryMultiplier = Characters.calculate
.attributeValue(char._id, "carryMultiplier");
var capacity = strength * 15 * carryMultiplier;
return weight / capacity; return weight / capacity;
}; };

View File

@@ -2,27 +2,27 @@
<table class="carryCapacityTable strengthTable"> <table class="carryCapacityTable strengthTable">
<tr> <tr>
<td>Encumbered</td> <td>Encumbered</td>
<td>&gt;{{evaluate charId "strength * 5"}}lbs</td> <td>&gt;{{evaluate charId "strength * 5 * carryMultiplier"}}lbs</td>
<td class="caption">Variant rule, encumbered characters move 10 feet slower</td> <td class="caption">Variant rule, encumbered characters move 10 feet slower</td>
</tr> </tr>
<tr> <tr>
<td>Heavily encumbered</td> <td>Heavily encumbered</td>
<td>&gt;{{evaluate charId "strength * 10"}}lbs</td> <td>&gt;{{evaluate charId "strength * 10 * carryMultiplier"}}lbs</td>
<td class="caption"> <td class="caption">
Variant rule, heavily encumbered characters move 20 feet slower and have disadvantage on ability checks, attack rolls, and saving thows that use Strength, Dexterity, or Constitution Variant rule, heavily encumbered characters move 20 feet slower and have disadvantage on ability checks, attack rolls, and saving thows that use Strength, Dexterity, or Constitution
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Over Encumbered</td> <td>Over Encumbered</td>
<td>&gt;{{evaluate charId "strength * 15"}}lbs</td> <td>&gt;{{evaluate charId "strength * 15 * carryMultiplier"}}lbs</td>
<td class="caption"> <td class="caption">
Characters that can only just lift, push or drag their current load can only move at 5 feet. Characters that can only just lift, push or drag their current load can only move at 5 feet.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Push, drag or lift maximum</td> <td>Push, drag or lift maximum</td>
<td>{{evaluate charId "strength * 30"}}lbs</td> <td>{{evaluate charId "strength * 30 * carryMultiplier"}}lbs</td>
<td class="caption"></td> <td class="caption"></td>
</tr> </tr>
</table> </table>
</template> </template>

View File

@@ -101,6 +101,8 @@ trackEncumbranceConditions = function(charId, templateInstance) {
{fields: {"settings": 1}} {fields: {"settings": 1}}
); );
var strength = Characters.calculate.attributeValue(charId, "strength"); var strength = Characters.calculate.attributeValue(charId, "strength");
var carryMultiplier = Characters.calculate
.attributeValue(charId, "carryMultiplier");
var give = function(condition) { var give = function(condition) {
Meteor.call("giveCondition", charId, condition); Meteor.call("giveCondition", charId, condition);
}; };
@@ -108,11 +110,11 @@ trackEncumbranceConditions = function(charId, templateInstance) {
Meteor.call("removeCondition", charId, condition); Meteor.call("removeCondition", charId, condition);
}; };
//variant encumbrance rules //variant encumbrance rules
if (weight > strength * 10 && if (weight > strength * 10 * carryMultiplier &&
character.settings.useVariantEncumbrance) { character.settings.useVariantEncumbrance) {
give("encumbered2"); give("encumbered2");
remove("encumbered"); remove("encumbered");
} else if (weight > strength * 5 && } else if (weight > strength * 5 * carryMultiplier &&
character.settings.useVariantEncumbrance){ character.settings.useVariantEncumbrance){
give("encumbered"); give("encumbered");
remove("encumbered2"); remove("encumbered2");
@@ -121,11 +123,11 @@ trackEncumbranceConditions = function(charId, templateInstance) {
remove("encumbered2"); remove("encumbered2");
} }
//normal encumbrance rules //normal encumbrance rules
if (weight > strength * 30 && if (weight > strength * 30 * carryMultiplier &&
character.settings.useStandardEncumbrance){ character.settings.useStandardEncumbrance){
give("encumbered4"); give("encumbered4");
remove("encumbered3"); remove("encumbered3");
} else if (weight > strength * 15 && } else if (weight > strength * 15 * carryMultiplier &&
character.settings.useStandardEncumbrance) { character.settings.useStandardEncumbrance) {
give("encumbered3"); give("encumbered3");
remove("encumbered4"); remove("encumbered4");

View File

@@ -252,3 +252,11 @@ ChangeLogs.insert({
"Fixed proficiencies not being disabled with their features", "Fixed proficiencies not being disabled with their features",
], ],
}); });
ChangeLogs.insert({
version: "0.7.0",
changes: [
"Added carry capacity multiplier as a stat with a default value of 1",
"Improved loading times by vulcanizing polymer imports",
],
});

View File

@@ -108,3 +108,45 @@ Migrations.add({
); );
}, },
}); });
Migrations.add({
version: 4,
name: "Adds an effect to give characters a base carry capacity",
up: function() {
//update characters
Characters.find({}).forEach(function(char){
Characters.update(char._id, {
$set: {
carryMultiplier: {
adjustment: 0,
reset: "longRest",
}
}
});
var effect = Effects.findOne({
charId: char._id, name: "Natural Carrying Capacity"
});
if (effect) return;
Effects.insert({
charId: char._id,
name: "Natural Carrying Capacity",
stat: "carryMultiplier",
operation: "base",
value: "1",
parent: {
id: char._id,
collection: "Characters",
group: "Inate",
},
});
effect = Effects.findOne({
charId: char._id, name: "Natural Carrying Capacity"
});
if (!effect) throw "Carry capacity effect should be set by now."
});
},
down: function(){
return;
},
});