diff --git a/graphics/exported/equipment/fractalhull.png b/graphics/exported/equipment/fractalhull.png new file mode 100644 index 0000000..6e023cf Binary files /dev/null and b/graphics/exported/equipment/fractalhull.png differ diff --git a/graphics/exported/equipment/gravitshield.png b/graphics/exported/equipment/gravitshield.png new file mode 100644 index 0000000..68b259e Binary files /dev/null and b/graphics/exported/equipment/gravitshield.png differ diff --git a/graphics/exported/equipment/harcoatedhull.png b/graphics/exported/equipment/harcoatedhull.png new file mode 100644 index 0000000..e068ffc Binary files /dev/null and b/graphics/exported/equipment/harcoatedhull.png differ diff --git a/graphics/exported/equipment/invertershield.png b/graphics/exported/equipment/invertershield.png new file mode 100644 index 0000000..7256ca5 Binary files /dev/null and b/graphics/exported/equipment/invertershield.png differ diff --git a/graphics/ui/actions.svg b/graphics/ui/actions.svg index d8e39b6..b60bb71 100644 --- a/graphics/ui/actions.svg +++ b/graphics/ui/actions.svg @@ -16,12 +16,111 @@ version="1.1" inkscape:version="0.92.1 r15371" sodipodi:docname="actions.svg" - inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/equipment/damageprotector.png" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/equipment/invertershield.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" - viewBox="0 0 256 256"> + viewBox="0 0 256 256" + enable-background="new"> + + + + + + + + + + + + + + + + + + + + + + + @@ -627,6 +726,99 @@ stdDeviation="0.52701551" id="feGaussianBlur5537" /> + + + + + + + + + + + + + + + + showguides="false" + inkscape:snap-others="true" + inkscape:snap-grids="false" + inkscape:snap-to-guides="true" + inkscape:object-paths="true"> + + + + + + + + + + + + + + + + + + + + style="display:none"> + style="opacity:0.32900002" />

SpaceTac - Loot Generator Samples

+
@@ -63,12 +66,17 @@ window.onload = function () { var generator = new TS.SpaceTac.LootGenerator(); var result = document.getElementById("result"); + var current_level = 1; + var current_name = ""; - function update(level) { + function update() { result.innerHTML = ""; generator.templates.forEach(function (template) { + if (template.name != current_name) { + return; + } TS.iterenum(TS.SpaceTac.EquipmentQuality, function (quality) { - var loot = template.generate(level, quality); + var loot = template.generate(current_level, quality); let title = document.createElement("h2"); title.textContent = loot.getFullName() + " (Price " + loot.price.toString() + ")"; @@ -81,10 +89,24 @@ }); } - update(1); + TS.sortedBy(generator.templates, function (template) { + return template.name; + }).forEach(function (template) { + var opt = document.createElement('option'); + opt.value = template.name; + opt.innerHTML = template.name; + document.getElementById("template").appendChild(opt); + }); + document.getElementById("level").onchange = function () { - update(this.value); + current_level = this.value; + update(); } + document.getElementById("template").onchange = function () { + current_name = this.value; + update(); + } + update(); }; diff --git a/src/core/LootTemplate.ts b/src/core/LootTemplate.ts index f9df747..76bfdbf 100644 --- a/src/core/LootTemplate.ts +++ b/src/core/LootTemplate.ts @@ -187,11 +187,11 @@ module TS.SpaceTac { // Modifiers applied to "common" equipment to obtain a specific quality protected quality_modifiers: QualityModifier[] - constructor(slot: SlotType, name: string, description = "") { + constructor(slot: SlotType, name: string, description = "", price_base = 100, price_inflation = 200) { this.slot = slot; this.name = name; this.description = description; - this.price = istep(100, istep(200, irepeat(200))); + this.price = istep(price_base, istep(price_inflation, irepeat(price_inflation))); this.base_modifiers = []; this.quality_modifiers = [standardQualityModifier]; } @@ -268,7 +268,7 @@ module TS.SpaceTac { addAttributeEffect(attribute: keyof ShipAttributes, value: LeveledValue): void { this.base_modifiers.push((equipment, level) => { let resolved = resolveForLevel(value, level); - if (resolved > 0) { + if (resolved != 0) { equipment.effects.push(new AttributeEffect(attribute, resolved)); } }); diff --git a/src/core/equipments/ForceField.spec.ts b/src/core/equipments/ForceField.spec.ts deleted file mode 100644 index a6eaac0..0000000 --- a/src/core/equipments/ForceField.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -module TS.SpaceTac.Equipments { - describe("ForceField", function () { - it("generates equipment based on level", function () { - let template = new ForceField(); - - let equipment = template.generate(1); - expect(equipment.requirements).toEqual({ "skill_photons": 1 }); - expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 100)]); - - equipment = template.generate(2); - expect(equipment.requirements).toEqual({ "skill_photons": 3 }); - expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 140)]); - - equipment = template.generate(3); - expect(equipment.requirements).toEqual({ "skill_photons": 5 }); - expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 180)]); - - equipment = template.generate(10); - expect(equipment.requirements).toEqual({ "skill_photons": 19 }); - expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 460)]); - }); - }); -} diff --git a/src/core/equipments/ForceField.ts b/src/core/equipments/ForceField.ts deleted file mode 100644 index f3abe36..0000000 --- a/src/core/equipments/ForceField.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -module TS.SpaceTac.Equipments { - export class ForceField extends LootTemplate { - constructor() { - super(SlotType.Shield, "Force Field", "A basic force field, generated by radiating waves of compressed energy"); - - this.setSkillsRequirements({ "skill_photons": istep(1, irepeat(2)) }); - this.addAttributeEffect("shield_capacity", istep(100, irepeat(40))); - } - } -} diff --git a/src/core/equipments/Hulls.spec.ts b/src/core/equipments/Hulls.spec.ts new file mode 100644 index 0000000..3d655d1 --- /dev/null +++ b/src/core/equipments/Hulls.spec.ts @@ -0,0 +1,99 @@ +module TS.SpaceTac.Equipments { + describe("Hulls", function () { + it("generates IronHull based on level", function () { + let template = new IronHull(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_materials": 1 }); + expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 200)]); + expect(equipment.price).toEqual(100); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_materials": 2 }); + expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 220)]); + expect(equipment.price).toEqual(300); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_materials": 3 }); + expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 240)]); + expect(equipment.price).toEqual(700); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_materials": 10 }); + expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 380)]); + expect(equipment.price).toEqual(9100); + }); + + it("generates HardCoatedHull based on level", function () { + let template = new HardCoatedHull(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_materials": 2 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 300), + new AttributeEffect("maneuvrability", -2), + ]); + expect(equipment.price).toEqual(120); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_materials": 4 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 315), + new AttributeEffect("maneuvrability", -3), + ]); + expect(equipment.price).toEqual(330); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_materials": 6 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 330), + new AttributeEffect("maneuvrability", -4), + ]); + expect(equipment.price).toEqual(750); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_materials": 20 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 435), + new AttributeEffect("maneuvrability", -11), + ]); + expect(equipment.price).toEqual(9570); + }); + + it("generates FractalHull based on level", function () { + let template = new FractalHull(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_quantum": 1 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 260), + new AttributeEffect("maneuvrability", -1), + ]); + expect(equipment.price).toEqual(250); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_quantum": 2 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 270), + new AttributeEffect("maneuvrability", -2), + ]); + expect(equipment.price).toEqual(480); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_quantum": 3 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 280), + new AttributeEffect("maneuvrability", -2), + ]); + expect(equipment.price).toEqual(940); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_quantum": 10 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("hull_capacity", 350), + new AttributeEffect("maneuvrability", -6), + ]); + expect(equipment.price).toEqual(10600); + }); + }); +} diff --git a/src/core/equipments/Hulls.ts b/src/core/equipments/Hulls.ts new file mode 100644 index 0000000..ad8f804 --- /dev/null +++ b/src/core/equipments/Hulls.ts @@ -0,0 +1,32 @@ +/// + +module TS.SpaceTac.Equipments { + export class IronHull extends LootTemplate { + constructor() { + super(SlotType.Hull, "Iron Hull", "Protective hull, based on layered iron alloys"); + + this.setSkillsRequirements({ "skill_materials": 1 }); + this.addAttributeEffect("hull_capacity", istep(200, irepeat(20))); + } + } + + export class HardCoatedHull extends LootTemplate { + constructor() { + super(SlotType.Hull, "Hard Coated Hull", "Hardened hull, with titanium coating", 120, 210); + + this.setSkillsRequirements({ "skill_materials": 2 }); + this.addAttributeEffect("hull_capacity", istep(300, irepeat(15))); + this.addAttributeEffect("maneuvrability", istep(-2, irepeat(-1))); + } + } + + export class FractalHull extends LootTemplate { + constructor() { + super(SlotType.Hull, "Fractal Hull", "Hull composed of recursively bound quantum patches", 250, 230); + + this.setSkillsRequirements({ "skill_quantum": 1 }); + this.addAttributeEffect("hull_capacity", istep(260, irepeat(10))); + this.addAttributeEffect("maneuvrability", istep(-1, irepeat(-0.5))); + } + } +} diff --git a/src/core/equipments/IronHull.spec.ts b/src/core/equipments/IronHull.spec.ts deleted file mode 100644 index 4b0f2c4..0000000 --- a/src/core/equipments/IronHull.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -module TS.SpaceTac.Equipments { - describe("IronHull", function () { - it("generates equipment based on level", function () { - let template = new IronHull(); - - let equipment = template.generate(1); - expect(equipment.requirements).toEqual({ "skill_materials": 1 }); - expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 200)]); - - equipment = template.generate(2); - expect(equipment.requirements).toEqual({ "skill_materials": 2 }); - expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 220)]); - - equipment = template.generate(3); - expect(equipment.requirements).toEqual({ "skill_materials": 3 }); - expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 240)]); - - equipment = template.generate(10); - expect(equipment.requirements).toEqual({ "skill_materials": 10 }); - expect(equipment.effects).toEqual([new AttributeEffect("hull_capacity", 380)]); - }); - }); -} diff --git a/src/core/equipments/IronHull.ts b/src/core/equipments/IronHull.ts deleted file mode 100644 index 63d5217..0000000 --- a/src/core/equipments/IronHull.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -module TS.SpaceTac.Equipments { - export class IronHull extends LootTemplate { - constructor() { - super(SlotType.Hull, "Iron Hull", "Protective hull, based on layered iron alloys"); - - this.setSkillsRequirements({ "skill_materials": 1 }); - this.addAttributeEffect("hull_capacity", istep(200, irepeat(20))); - } - } -} diff --git a/src/core/equipments/Shields.spec.ts b/src/core/equipments/Shields.spec.ts new file mode 100644 index 0000000..446bc47 --- /dev/null +++ b/src/core/equipments/Shields.spec.ts @@ -0,0 +1,99 @@ +module TS.SpaceTac.Equipments { + describe("Shields", function () { + it("generates ForceField based on level", function () { + let template = new ForceField(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_photons": 1 }); + expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 100)]); + expect(equipment.price).toEqual(100); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_photons": 3 }); + expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 140)]); + expect(equipment.price).toEqual(300); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_photons": 5 }); + expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 180)]); + expect(equipment.price).toEqual(700); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_photons": 19 }); + expect(equipment.effects).toEqual([new AttributeEffect("shield_capacity", 460)]); + expect(equipment.price).toEqual(9100); + }); + + it("generates GravitShield based on level", function () { + let template = new GravitShield(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_gravity": 2 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 160), + new AttributeEffect("precision", -1), + ]); + expect(equipment.price).toEqual(140); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_gravity": 5 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 190), + new AttributeEffect("precision", -2), + ]); + expect(equipment.price).toEqual(320); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_gravity": 8 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 220), + new AttributeEffect("precision", -3), + ]); + expect(equipment.price).toEqual(680); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_gravity": 29 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 430), + new AttributeEffect("precision", -10), + ]); + expect(equipment.price).toEqual(8240); + }); + + it("generates InverterShield based on level", function () { + let template = new InverterShield(); + + let equipment = template.generate(1); + expect(equipment.requirements).toEqual({ "skill_antimatter": 2 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 130), + new AttributeEffect("power_generation", -1), + ]); + expect(equipment.price).toEqual(300); + + equipment = template.generate(2); + expect(equipment.requirements).toEqual({ "skill_antimatter": 4 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 165), + new AttributeEffect("power_generation", -1), + ]); + expect(equipment.price).toEqual(460); + + equipment = template.generate(3); + expect(equipment.requirements).toEqual({ "skill_antimatter": 6 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 200), + new AttributeEffect("power_generation", -1), + ]); + expect(equipment.price).toEqual(780); + + equipment = template.generate(10); + expect(equipment.requirements).toEqual({ "skill_antimatter": 20 }); + expect(equipment.effects).toEqual([ + new AttributeEffect("shield_capacity", 445), + new AttributeEffect("power_generation", -3), + ]); + expect(equipment.price).toEqual(7500); + }); + }); +} diff --git a/src/core/equipments/Shields.ts b/src/core/equipments/Shields.ts new file mode 100644 index 0000000..fd3c839 --- /dev/null +++ b/src/core/equipments/Shields.ts @@ -0,0 +1,32 @@ +/// + +module TS.SpaceTac.Equipments { + export class ForceField extends LootTemplate { + constructor() { + super(SlotType.Shield, "Force Field", "A basic force field, generated by radiating waves of compressed energy"); + + this.setSkillsRequirements({ "skill_photons": istep(1, irepeat(2)) }); + this.addAttributeEffect("shield_capacity", istep(100, irepeat(40))); + } + } + + export class GravitShield extends LootTemplate { + constructor() { + super(SlotType.Shield, "Gravit Shield", "A shield with micro-gravity wells to help absorb damage", 140, 180); + + this.setSkillsRequirements({ "skill_gravity": istep(2, irepeat(3)) }); + this.addAttributeEffect("shield_capacity", istep(160, irepeat(30))); + this.addAttributeEffect("precision", istep(-1, irepeat(-1))); + } + } + + export class InverterShield extends LootTemplate { + constructor() { + super(SlotType.Shield, "Inverter Shield", "An antimatter shield that tries to cancel inbound energy", 300, 160); + + this.setSkillsRequirements({ "skill_antimatter": istep(2, irepeat(2)) }); + this.addAttributeEffect("shield_capacity", istep(130, irepeat(35))); + this.addAttributeEffect("power_generation", istep(-0.2, irepeat(-0.3))); + } + } +}