2017-11-14 00:07:06 +00:00
|
|
|
/// <reference path="../../common/Testing.ts" />
|
|
|
|
|
|
|
|
module TK.SpaceTac.Specs {
|
|
|
|
testing("ShipAttributeDiff", test => {
|
|
|
|
test.case("applies and reverts", check => {
|
|
|
|
let battle = new Battle();
|
|
|
|
let ship = battle.fleets[0].addShip();
|
|
|
|
|
|
|
|
TestTools.diffChain(check, battle, [
|
2018-03-26 15:30:43 +00:00
|
|
|
new ShipAttributeDiff(ship, "power_capacity", { cumulative: 5 }, {}),
|
|
|
|
new ShipAttributeDiff(ship, "evasion", { cumulative: 8 }, {}),
|
|
|
|
new ShipAttributeDiff(ship, "power_capacity", { cumulative: 2 }, {}),
|
|
|
|
new ShipAttributeDiff(ship, "power_capacity", { cumulative: 4 }, { cumulative: 5 }),
|
|
|
|
new ShipAttributeDiff(ship, "evasion", { multiplier: 50 }, {}),
|
|
|
|
new ShipAttributeDiff(ship, "evasion", { limit: 2 }, {}),
|
|
|
|
new ShipAttributeDiff(ship, "evasion", {}, { multiplier: 50, limit: 2 }),
|
2017-11-14 00:07:06 +00:00
|
|
|
], [
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 0, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 0, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 5, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 0, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 5, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 8, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 7, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 8, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 6, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 8, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 6, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 12, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 6, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 2, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-03-26 15:30:43 +00:00
|
|
|
check.equals(ship.getAttribute("power_capacity"), 6, "power capacity value");
|
|
|
|
check.equals(ship.getAttribute("evasion"), 8, "evasion value");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
])
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|