2017-09-24 22:23:22 +00:00
|
|
|
module TK.SpaceTac.Specs {
|
2017-10-26 21:47:13 +00:00
|
|
|
testing("Slot", test => {
|
|
|
|
test.case("checks equipment type", check => {
|
2017-11-14 00:07:06 +00:00
|
|
|
check.patch(console, "warn", null);
|
|
|
|
|
2015-02-06 00:00:00 +00:00
|
|
|
var ship = new Ship();
|
|
|
|
var slot = ship.addSlot(SlotType.Engine);
|
|
|
|
|
|
|
|
var equipment = new Equipment();
|
2017-04-18 19:51:23 +00:00
|
|
|
equipment.slot_type = SlotType.Weapon;
|
2015-02-06 00:00:00 +00:00
|
|
|
|
2017-10-26 21:47:13 +00:00
|
|
|
check.equals(slot.attached, null);
|
2015-02-06 00:00:00 +00:00
|
|
|
slot.attach(equipment);
|
2017-10-26 21:47:13 +00:00
|
|
|
check.equals(slot.attached, null);
|
2015-02-06 00:00:00 +00:00
|
|
|
|
2017-04-18 19:51:23 +00:00
|
|
|
equipment.slot_type = SlotType.Engine;
|
2015-02-06 00:00:00 +00:00
|
|
|
|
|
|
|
slot.attach(equipment);
|
2017-10-26 21:47:13 +00:00
|
|
|
check.same(slot.attached, equipment);
|
2015-02-06 00:00:00 +00:00
|
|
|
});
|
|
|
|
|
2017-10-26 21:47:13 +00:00
|
|
|
test.case("checks equipment capabilities", check => {
|
2017-11-14 00:07:06 +00:00
|
|
|
check.patch(console, "warn", null);
|
|
|
|
|
2015-02-06 00:00:00 +00:00
|
|
|
var ship = new Ship();
|
|
|
|
var slot = ship.addSlot(SlotType.Shield);
|
|
|
|
|
|
|
|
var equipment = new Equipment();
|
2017-04-18 19:51:23 +00:00
|
|
|
equipment.slot_type = SlotType.Shield;
|
2017-02-07 19:15:21 +00:00
|
|
|
equipment.requirements["skill_gravity"] = 5;
|
2015-02-06 00:00:00 +00:00
|
|
|
|
2017-10-26 21:47:13 +00:00
|
|
|
check.equals(slot.attached, null);
|
2015-02-06 00:00:00 +00:00
|
|
|
slot.attach(equipment);
|
2017-10-26 21:47:13 +00:00
|
|
|
check.equals(slot.attached, null);
|
2015-02-06 00:00:00 +00:00
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
TestTools.setAttribute(ship, "skill_gravity", 6);
|
2015-02-06 00:00:00 +00:00
|
|
|
|
|
|
|
slot.attach(equipment);
|
2017-10-26 21:47:13 +00:00
|
|
|
check.same(slot.attached, equipment);
|
2015-02-06 00:00:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|