2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac {
|
2017-11-14 00:07:06 +00:00
|
|
|
testing("ShipAttribute", test => {
|
|
|
|
test.case("applies cumulative, multiplier and limit", check => {
|
|
|
|
let attribute = new ShipAttribute();
|
|
|
|
check.equals(attribute.get(), 0, "initial");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(4);
|
|
|
|
check.equals(attribute.get(), 4, "added 4");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(2);
|
|
|
|
check.equals(attribute.get(), 6, "added 6");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(undefined, 20);
|
|
|
|
check.equals(attribute.get(), 7, "added 20%");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(undefined, 5);
|
|
|
|
check.equals(attribute.get(), 8, "added 5%");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(undefined, undefined, 6);
|
|
|
|
check.equals(attribute.get(), 6, "limited to 6");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(undefined, undefined, 4);
|
|
|
|
check.equals(attribute.get(), 4, "limited to 4");
|
2017-02-07 19:15:21 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
attribute.addModifier(undefined, undefined, 10);
|
|
|
|
check.equals(attribute.get(), 4, "limited to 10");
|
2017-02-07 19:15:21 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|