diff --git a/TODO b/TODO index bfd0d4d..ed22cb4 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ * Restore serialization * Drones: add hooks on game events * Drones: add sprite, radius and tooltip -* Repair drone: add graphics and proper description * Allow to cancel last moves * Effect should be random in a range (eg. "damage target 50-75") * Add an overload/cooling system diff --git a/graphics/ui/actions.svg b/graphics/ui/actions.svg index 7afe7eb..1908227 100644 --- a/graphics/ui/actions.svg +++ b/graphics/ui/actions.svg @@ -10,15 +10,16 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="256" - height="256" + width="273.06668" + height="273.06668" id="svg2" version="1.1" - inkscape:version="0.91 r13725" + inkscape:version="0.92.0 r15299" sodipodi:docname="actions.svg" inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/actions/fire-submunitionmissile.png" inkscape:export-xdpi="90" - inkscape:export-ydpi="90"> + inkscape:export-ydpi="90" + viewBox="0 0 256 256"> @@ -172,9 +173,9 @@ xlink:href="#linearGradient10423" id="linearGradient10429" x1="87.630737" - y1="128.00001" + y1="128.00002" x2="239.40616" - y2="128.00001" + y2="128.00002" gradientUnits="userSpaceOnUse" /> + height="2.0060079"> @@ -262,7 +263,7 @@ height="168.81219" x="-227.39804" y="-205.73518" - transform="matrix(0,1,-1,0,0,0)" /> + transform="rotate(90)" /> + id="grid3004" + originx="0" + originy="0" + spacingx="1" + spacingy="1" /> @@ -334,7 +339,7 @@ image/svg+xml - + @@ -350,13 +355,13 @@ sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="path3935" - d="m 21.185297,881.63628 73.244367,128.17762 0,-79.34804 z" + d="M 21.185297,881.63628 94.429664,1009.8139 V 930.46586 Z" style="fill:#39c731;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> @@ -367,13 +372,13 @@ style="display:none"> @@ -409,7 +414,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/out/assets/images/battle/actions/deploy-repairdrone.png b/out/assets/images/battle/actions/deploy-repairdrone.png new file mode 100644 index 0000000..a4c48dd Binary files /dev/null and b/out/assets/images/battle/actions/deploy-repairdrone.png differ diff --git a/src/game/Equipment.spec.ts b/src/game/Equipment.spec.ts index 6feb3e0..49f4918 100644 --- a/src/game/Equipment.spec.ts +++ b/src/game/Equipment.spec.ts @@ -41,7 +41,7 @@ module TS.SpaceTac.Game.Specs { expect(equipment.getActionDescription()).toEqual("- 50 damage on target"); equipment.blast = 20; - expect(equipment.getActionDescription()).toEqual("- 50 damage on all ships in 20km of impact"); + expect(equipment.getActionDescription()).toEqual("- 50 damage in 20km radius"); equipment.blast = 0; equipment.target_effects.push(new StickyEffect(new AttributeLimitEffect("shield_capacity", 200), 3)); diff --git a/src/game/Equipment.ts b/src/game/Equipment.ts index 054a556..7a578b3 100644 --- a/src/game/Equipment.ts +++ b/src/game/Equipment.ts @@ -81,7 +81,7 @@ module TS.SpaceTac.Game { } else { var result: string[] = []; this.target_effects.forEach(effect => { - let suffix = this.blast ? `on all ships in ${this.blast}km of impact` : "on target"; + let suffix = this.blast ? `in ${this.blast}km radius` : "on target"; if (effect instanceof StickyEffect) { suffix = `for ${effect.duration} turn${effect.duration > 1 ? "s" : ""} ${suffix}`; } diff --git a/src/game/effects/ValueEffect.spec.ts b/src/game/effects/ValueEffect.spec.ts index f971327..b8ffd35 100644 --- a/src/game/effects/ValueEffect.spec.ts +++ b/src/game/effects/ValueEffect.spec.ts @@ -14,5 +14,13 @@ module TS.SpaceTac.Game { effect.applyOnShip(ship); expect(ship.values.shield.get()).toEqual(80); }); + + it("has a description", function () { + let effect = new ValueEffect("power", 12); + expect(effect.getDescription()).toEqual("power +12"); + + effect = new ValueEffect("power", -4); + expect(effect.getDescription()).toEqual("power -4"); + }); }); } diff --git a/src/game/effects/ValueEffect.ts b/src/game/effects/ValueEffect.ts index 9a28183..e97adc7 100644 --- a/src/game/effects/ValueEffect.ts +++ b/src/game/effects/ValueEffect.ts @@ -31,5 +31,10 @@ module TS.SpaceTac.Game { getFullCode(): string { return `${this.code}-${this.valuetype}`; } + + getDescription(): string { + let attrname = SHIP_VALUES[this.valuetype].name; + return `${attrname} ${this.value > 0 ? "+" : "-"}${Math.abs(this.value)}`; + } } } diff --git a/src/game/equipments/RepairDrone.spec.ts b/src/game/equipments/RepairDrone.spec.ts index e12f1b8..f006562 100644 --- a/src/game/equipments/RepairDrone.spec.ts +++ b/src/game/equipments/RepairDrone.spec.ts @@ -5,6 +5,22 @@ module TS.SpaceTac.Game.Equipments { let equipment = template.generateFixed(0); expect(equipment.target_effects).toEqual([new ValueEffect("hull", 10)]); + + let battle = new Battle(); + let ship = new Ship(); + battle.playing_ship = ship; + TestTools.setShipAP(ship, 10); + let result = equipment.action.apply(battle, ship, new Target(5, 5, null)); + expect(result).toBe(true); + + expect(battle.drones.length).toBe(1); + let drone = battle.drones[0]; + ship.setAttribute("hull_capacity", 100); + ship.setValue("hull", 85); + drone.singleApply(ship); + expect(ship.getValue("hull")).toBe(95); + drone.singleApply(ship); + expect(ship.getValue("hull")).toBe(100); }); }); } diff --git a/src/view/Preload.ts b/src/view/Preload.ts index 4ea0fa4..bbc2e85 100644 --- a/src/view/Preload.ts +++ b/src/view/Preload.ts @@ -53,6 +53,7 @@ module TS.SpaceTac.View { this.loadImage("battle/actions/fire-gatlinggun.png"); this.loadImage("battle/actions/fire-powerdepleter.png"); this.loadImage("battle/actions/fire-submunitionmissile.png"); + this.loadImage("battle/actions/deploy-repairdrone.png"); this.loadImage("battle/weapon/bullet.png"); this.loadImage("battle/attributes/power.png"); this.loadImage("battle/attributes/effect-increase.png");