1
0
Fork 0
spacetac/src/core/equipments/Engines.spec.ts

100 lines
5.4 KiB
TypeScript
Raw Normal View History

2017-09-24 22:23:22 +00:00
module TK.SpaceTac.Equipments {
2017-07-31 22:49:00 +00:00
describe("Engines", function () {
it("generates RocketEngine based on level", function () {
let template = new RocketEngine();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_materials": 1 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 2)]);
expect(equipment.cooldown).toEqual(new Cooldown(2, 0));
expect(equipment.action).toEqual(new MoveAction(equipment, 200, 120, 70));
2017-07-31 22:49:00 +00:00
expect(equipment.price).toEqual(120);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_materials": 2 });
2017-09-17 22:49:53 +00:00
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 2)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(2, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 210, 120, 70));
expect(equipment.price).toEqual(420);
2017-07-31 22:49:00 +00:00
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_materials": 3 });
2017-09-17 22:49:53 +00:00
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 3)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(2, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 220, 120, 70));
expect(equipment.price).toEqual(1020);
2017-07-31 22:49:00 +00:00
equipment = template.generate(10);
2017-09-17 22:49:53 +00:00
expect(equipment.requirements).toEqual({ "skill_materials": 17 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 14)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(2, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 290, 120, 70));
expect(equipment.price).toEqual(13620);
2017-07-31 22:49:00 +00:00
});
it("generates IonThruster based on level", function () {
let template = new IonThruster();
2017-07-31 22:49:00 +00:00
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_photons": 1 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 1)]);
expect(equipment.cooldown).toEqual(new Cooldown(3, 1));
expect(equipment.action).toEqual(new MoveAction(equipment, 120, 120, 80));
2017-07-31 22:49:00 +00:00
expect(equipment.price).toEqual(150);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_photons": 2 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 2)]);
expect(equipment.cooldown).toEqual(new Cooldown(3, 1));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 130, 120, 80));
expect(equipment.price).toEqual(525);
2017-07-31 22:49:00 +00:00
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_photons": 3 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 3)]);
expect(equipment.cooldown).toEqual(new Cooldown(3, 1));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 140, 120, 80));
expect(equipment.price).toEqual(1275);
2017-07-31 22:49:00 +00:00
equipment = template.generate(10);
2017-09-17 22:49:53 +00:00
expect(equipment.requirements).toEqual({ "skill_photons": 17 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", 17)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(3, 1));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 210, 120, 80));
expect(equipment.price).toEqual(17025);
2017-07-31 22:49:00 +00:00
});
it("generates VoidhawkEngine based on level", function () {
let template = new VoidhawkEngine();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_gravity": 2 });
2017-09-17 22:49:53 +00:00
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", -3)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 2000, 270, 0));
expect(equipment.price).toEqual(300);
2017-07-31 22:49:00 +00:00
equipment = template.generate(2);
2017-09-17 22:49:53 +00:00
expect(equipment.requirements).toEqual({ "skill_gravity": 3 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", -4)]);
2017-07-31 22:49:00 +00:00
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 2000, 245, 0));
expect(equipment.price).toEqual(1050);
2017-07-31 22:49:00 +00:00
equipment = template.generate(3);
2017-09-17 22:49:53 +00:00
expect(equipment.requirements).toEqual({ "skill_gravity": 5 });
2017-07-31 22:49:00 +00:00
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", -4)]);
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
2017-09-17 22:49:53 +00:00
expect(equipment.action).toEqual(new MoveAction(equipment, 2000, 224, 0));
expect(equipment.price).toEqual(2550);
2017-07-31 22:49:00 +00:00
equipment = template.generate(10);
2017-09-17 22:49:53 +00:00
expect(equipment.requirements).toEqual({ "skill_gravity": 26 });
expect(equipment.effects).toEqual([new AttributeEffect("maneuvrability", -5)]);
expect(equipment.cooldown).toEqual(new Cooldown(2, 0));
expect(equipment.action).toEqual(new MoveAction(equipment, 2000, 155, 0));
expect(equipment.price).toEqual(34050);
2017-07-31 22:49:00 +00:00
});
});
}