1
0
Fork 0

Added Prokhorov Laser and Kelvin Generator

This commit is contained in:
Michaël Lemaire 2017-10-02 18:02:30 +02:00
parent c559418d0e
commit 08e1b506b1
25 changed files with 1111 additions and 293 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View file

@ -16,13 +16,61 @@
version="1.1"
inkscape:version="0.92.1 r15371"
sodipodi:docname="actions.svg"
inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/equipment/gravitshield.png"
inkscape:export-filename="/home/michael/workspace/perso/spacetac/graphics/exported/equipment/kelvingenerator.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
viewBox="0 0 256 256"
enable-background="new">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient5480">
<stop
style="stop-color:#4ebdf1;stop-opacity:0.0627451"
offset="0"
id="stop5475" />
<stop
id="stop5928"
offset="0.52865803"
style="stop-color:#aab7bd;stop-opacity:0.47058824;" />
<stop
style="stop-color:#ffffff;stop-opacity:0.35686275"
offset="0.64131236"
id="stop5930" />
<stop
id="stop5932"
offset="0.78862953"
style="stop-color:#aab7bd;stop-opacity:0.20784314;" />
<stop
style="stop-color:#aab7bd;stop-opacity:0;"
offset="1"
id="stop5478" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5892">
<stop
style="stop-color:#e0bd3f;stop-opacity:1;"
offset="0"
id="stop5888" />
<stop
style="stop-color:#e0bd3f;stop-opacity:0;"
offset="1"
id="stop5890" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5405">
<stop
style="stop-color:#d6510f;stop-opacity:1"
offset="0"
id="stop5401" />
<stop
style="stop-color:#f9df58;stop-opacity:0"
offset="1"
id="stop5403" />
</linearGradient>
<linearGradient
id="linearGradient5049"
inkscape:collect="always">
@ -1053,6 +1101,338 @@
y1="154.3677"
x2="55.914527"
y2="154.3677" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5405"
id="radialGradient5407"
cx="-12.317451"
cy="160.18842"
fx="-12.317451"
fy="160.18842"
r="102.20782"
gradientTransform="matrix(2.8065656,6.6698942e-8,0,0.91572166,22.252283,13.500414)"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter5540"
x="-0.25555526"
width="1.5111105"
y="-0.22131736"
height="1.4426347">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="21.616715"
id="feGaussianBlur5542" />
</filter>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter5826"
x="-0.047145695"
width="1.0942914"
y="-0.98874995"
height="2.9774999">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="7.6811109"
id="feGaussianBlur5828" />
</filter>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter5872"
x="-0.228288"
width="1.456576"
y="-1.4268"
height="3.8536">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.6125488"
id="feGaussianBlur5874" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5892"
id="radialGradient5905"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.42330507,0,53.65347)"
cx="166.80907"
cy="93.03614"
fx="166.80907"
fy="93.03614"
r="20.003027" />
<filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow"
id="filter5094">
<feFlood
flood-opacity="0.690196"
flood-color="rgb(255,255,255)"
result="flood"
id="feFlood5084" />
<feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite5086" />
<feGaussianBlur
in="composite1"
stdDeviation="3.9"
result="blur"
id="feGaussianBlur5088" />
<feOffset
dx="0"
dy="0"
result="offset"
id="feOffset5090" />
<feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="composite2"
id="feComposite5092" />
</filter>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter5827"
x="-0.097199997"
width="1.1944"
y="-0.048600001"
height="1.0972">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.87953075"
id="feGaussianBlur5829" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5480"
id="radialGradient5985"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1.6027397,0,0,-1.5594224,-214.87292,419.72285)"
cx="-82.598846"
cy="161.29422"
fx="-82.598846"
fy="161.29422"
r="13.549804" />
<filter
inkscape:label="Ridged Border"
inkscape:menu="Bevels"
inkscape:menu-tooltip="Ridged border with inner bevel"
style="color-interpolation-filters:sRGB;"
id="filter6111">
<feMorphology
radius="4.3"
in="SourceAlpha"
result="result91"
id="feMorphology6097" />
<feComposite
operator="out"
in="SourceGraphic"
in2="result91"
id="feComposite6099" />
<feGaussianBlur
result="result0"
stdDeviation="1.2"
id="feGaussianBlur6101" />
<feDiffuseLighting
diffuseConstant="1"
id="feDiffuseLighting6105">
<feDistantLight
elevation="66"
azimuth="225"
id="feDistantLight6103" />
</feDiffuseLighting>
<feBlend
mode="multiply"
in2="SourceGraphic"
id="feBlend6107" />
<feComposite
operator="in"
in2="SourceAlpha"
id="feComposite6109" />
</filter>
<filter
inkscape:label="Matte Bevel"
inkscape:menu="Bevels"
inkscape:menu-tooltip="Soft, pastel-colored, blurry bevel"
x="-0.25"
y="-0.25"
width="1.5"
height="1.5"
style="color-interpolation-filters:sRGB;"
id="filter6209">
<feGaussianBlur
stdDeviation="1"
result="result6"
id="feGaussianBlur6185" />
<feComposite
operator="in"
in="result6"
in2="result6"
result="result7"
id="feComposite6187" />
<feGaussianBlur
stdDeviation="8"
result="result3"
in="result7"
id="feGaussianBlur6189" />
<feComposite
in2="result7"
operator="over"
result="result91"
id="feComposite6191" />
<feComposite
operator="in"
in="result3"
result="result5"
in2="result91"
id="feComposite6193" />
<feColorMatrix
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0 "
result="result4"
id="feColorMatrix6195" />
<feSpecularLighting
surfaceScale="3"
specularConstant="2"
specularExponent="45"
in="result4"
result="result11"
id="feSpecularLighting6199">
<fePointLight
x="-5000"
y="-10000"
z="20000"
id="fePointLight6197" />
</feSpecularLighting>
<feComposite
operator="arithmetic"
k1="1"
in2="result4"
result="result10"
id="feComposite6201" />
<feComposite
operator="arithmetic"
k2="0.5"
k3="1"
in="result5"
result="result8"
in2="result10"
id="feComposite6203" />
<feComposite
result="result9"
in2="result8"
id="feComposite6205" />
<feBlend
mode="normal"
in2="result9"
id="feBlend6207" />
</filter>
<filter
inkscape:label="Neon"
inkscape:menu="Bevels"
inkscape:menu-tooltip="Neon light effect"
x="-0.25"
y="-0.25"
width="1.5"
height="1.5"
style="color-interpolation-filters:sRGB;"
id="filter6233">
<feGaussianBlur
stdDeviation="1"
result="result1"
id="feGaussianBlur6211" />
<feComposite
in="result1"
in2="result1"
result="result4"
operator="in"
id="feComposite6213" />
<feGaussianBlur
stdDeviation="7"
result="result6"
in="result4"
id="feGaussianBlur6215" />
<feComposite
operator="over"
in="result6"
in2="result4"
result="result8"
id="feComposite6217" />
<feComposite
operator="in"
result="fbSourceGraphic"
in="result6"
in2="result8"
id="feComposite6219" />
<feSpecularLighting
specularExponent="45"
specularConstant="2"
surfaceScale="2.5"
lighting-color="rgb(255,255,255)"
result="result1"
in="fbSourceGraphic"
id="feSpecularLighting6223">
<fePointLight
z="20000"
y="-10000"
x="-5000"
id="fePointLight6221" />
</feSpecularLighting>
<feComposite
operator="in"
result="result2"
in="result1"
in2="fbSourceGraphic"
id="feComposite6225" />
<feComposite
k3="1.5"
k2="1.2"
operator="arithmetic"
result="result4"
in="fbSourceGraphic"
in2="result2"
id="feComposite6227" />
<feComposite
operator="over"
in="result9"
in2="result4"
result="result9"
id="feComposite6229" />
<feBlend
mode="screen"
in2="result9"
id="feBlend6231" />
</filter>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter6299"
x="-0.058554495"
width="1.117109"
y="-0.87426646"
height="2.7485329">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="6.0357736"
id="feGaussianBlur6301" />
</filter>
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter6360"
x="-0.8500001"
width="2.7000002"
y="-0.082258064"
height="1.1645161">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="4.4929359"
id="feGaussianBlur6362" />
</filter>
</defs>
<sodipodi:namedview
id="base"
@ -1061,11 +1441,11 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.56"
inkscape:cx="130.38994"
inkscape:cy="132.56959"
inkscape:zoom="1.8101934"
inkscape:cx="146.28821"
inkscape:cy="148.49265"
inkscape:document-units="px"
inkscape:current-layer="g5022"
inkscape:current-layer="g4967"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1030"
@ -2195,7 +2575,7 @@
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#38454d;stroke-width:8.99291325;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
style="display:inline"
style="display:none"
inkscape:label="GravitShield"
id="g5022"
inkscape:groupmode="layer">
@ -2948,4 +3328,333 @@
height="100%"
transform="rotate(-80.838515,124.57679,104.88647)" />
</g>
<g
inkscape:groupmode="layer"
id="layer13"
inkscape:label="ProkhorovLaser"
style="display:none">
<g
id="g5832"
transform="rotate(-65.572632,136.25712,131.08114)">
<path
transform="matrix(2.364121,0,0,0.99655341,147.31341,-32.593524)"
inkscape:transform-center-x="79.989792"
d="M -113.58777,160.18842 89.421604,42.980894 l 1.1e-5,234.415036 z"
inkscape:randomized="0"
inkscape:rounded="0"
inkscape:flatsided="true"
sodipodi:arg2="-2.0943951"
sodipodi:arg1="-3.1415927"
sodipodi:r2="67.669792"
sodipodi:r1="135.33958"
sodipodi:cy="160.18842"
sodipodi:cx="21.751818"
sodipodi:sides="3"
id="path5399"
style="fill:url(#radialGradient5407);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.93749994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter5540)"
sodipodi:type="star" />
<rect
y="117.72057"
x="-62.353645"
height="18.644417"
width="391.01483"
id="rect5544"
style="fill:#f1a581;fill-opacity:1;fill-rule:evenodd;stroke:#ff2300;stroke-width:7.31692886;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter5826)" />
<path
transform="rotate(-10.507345,166.80907,93.03614)"
style="fill:url(#radialGradient5905);fill-opacity:1;fill-rule:evenodd;stroke:#a31c10;stroke-width:0.93749994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter5872)"
d="m 153.7426,92.266077 26.79938,-1.427202 v 4.394531 l -26.79938,1.427202 -24.35121,-7.458636 z"
id="rect5834"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5878"
width="100%"
height="100%"
transform="rotate(14.805834,-123.41264,76.287998)" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5880"
width="100%"
height="100%"
transform="matrix(0.88390545,-0.19641677,0.20689257,0.93104812,-56.645555,22.699624)"
style="opacity:0.47400004" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5882"
width="100%"
height="100%"
transform="matrix(1.0190079,0.18142093,0.18460809,-1.0253917,47.756816,230.90157)" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5884"
width="100%"
height="100%"
transform="matrix(0.85215425,0.36422828,0.38051926,-0.85018536,-95.744152,198.82421)" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5886"
width="100%"
height="100%"
transform="translate(-136.96288,-1.0986328)" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5896"
width="100%"
height="100%"
transform="matrix(0.47859285,-0.5185799,0.5185799,0.47859285,99.84102,114.29752)" />
<use
x="0"
y="0"
xlink:href="#rect5834"
id="use5901"
width="100%"
height="100%"
transform="rotate(34.54734,72.878973,25.745536)" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer14"
inkscape:label="KelvinGenerator"
style="display:inline">
<g
id="g4987"
transform="matrix(0.77942184,0,0,0.77942184,28.096496,22.946262)">
<g
id="g4980">
<circle
style="fill:#5b706b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.46182883px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6209)"
id="path4977"
cx="128.17381"
cy="37.005871"
r="60.528847" />
<circle
r="33.581779"
cy="37.005871"
cx="128.17381"
id="circle5936"
style="fill:#5b706b;fill-opacity:1;fill-rule:evenodd;stroke:#212121;stroke-width:22.34348297;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<use
transform="translate(0,195.55663)"
height="100%"
width="100%"
id="use4982"
xlink:href="#g4980"
y="0"
x="0" />
</g>
<rect
style="fill:#93c2dc;fill-opacity:1;fill-rule:evenodd;stroke:#d1d1d1;stroke-width:2.92283177;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.3851064"
id="rect4971"
width="126.16129"
height="99.045174"
x="64.91732"
y="78.477409" />
<g
id="g4997"
transform="matrix(0.77942184,0,0,0.77942184,28.52464,28.654989)">
<g
style="fill:#98a945;fill-opacity:1"
id="g4962">
<path
style="fill:#45a9a6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.93749994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6299)"
d="m 4.2246094,9.1738281 c 1.4194559,4.7309349 -3.53126679,15.8320479 4,14.4511719 80.9329426,0 161.8658806,0 242.7988306,0 -1.16719,-4.9832 2.44157,-14.7423573 -2,-16.4511719 -81.59961,0 -163.199221,0 -244.7988306,0 v 1 z"
id="rect5942"
inkscape:connector-curvature="0"
transform="matrix(1.1930183,0,0,0.93280658,-24.632089,1.0387032)" />
<rect
style="opacity:0.747;fill:#8eba63;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.98898703px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6233)"
id="rect4959"
width="289.66226"
height="11.614534"
x="-17.204851"
y="9.5961218" />
<rect
y="18.366442"
x="112.18121"
height="8.7144041"
width="30.886587"
id="rect5938"
style="fill:#98a945;fill-opacity:1;fill-rule:evenodd;stroke:#303030;stroke-width:3.56062484;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.29148937" />
<use
x="0"
y="0"
xlink:href="#rect5938"
id="use5940"
width="100%"
height="100%"
transform="translate(0,15.019113)" />
</g>
<use
transform="matrix(1,0,0,-1,0,254.91975)"
height="100%"
width="100%"
id="use4964"
xlink:href="#g4962"
y="0"
x="0" />
</g>
<g
id="g5020"
transform="matrix(0.77942184,0,0,0.77942184,28.23197,33.079127)"
style="filter:url(#filter5094)">
<g
transform="translate(-11.52636,-16.11328)"
id="g5004">
<rect
style="fill:#3c4c88;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.93749994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect5001"
width="145.75194"
height="9.5214834"
x="66.650391"
y="87.909187" />
</g>
<use
transform="translate(4.4189454e-7,45.227048)"
height="100%"
width="100%"
id="use5006"
xlink:href="#g5004"
y="0"
x="0" />
<use
transform="translate(4.4189453e-7,67.840572)"
height="100%"
width="100%"
id="use5008"
xlink:href="#g5004"
y="0"
x="0" />
<use
transform="translate(4.4189453e-7,90.454096)"
height="100%"
width="100%"
id="use5010"
xlink:href="#g5004"
y="0"
x="0" />
<use
transform="translate(4.4189453e-7,22.613525)"
height="100%"
width="100%"
id="use5012"
xlink:href="#g5004"
y="0"
x="0" />
</g>
<g
id="g4992"
transform="matrix(0.77942184,0,0,0.77942184,26.812044,30.367516)">
<g
style="fill:#292d30;fill-opacity:1"
id="g4967">
<path
style="fill:#435562;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.88435751px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 21.213661,34.415821 68.168373,3.758796 V 212.35078 l -68.168373,3.7588 z"
id="rect4957"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
transform="matrix(-0.88780486,-0.03711008,0,1.919085,83.526135,-115.12708)"
style="fill:#373d43;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.70119572px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6111)"
d="m 30.820477,85.271282 31.955738,-0.21545 V 167.27949 L 30.820477,165.5363 Z"
id="rect6093"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<rect
style="opacity:0.55699978;fill:#262633;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.20281458px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6360)"
id="rect6330"
width="12.685935"
height="131.08801"
x="84.359238"
y="59.260765" />
</g>
<use
transform="matrix(-1,0,0,1,259.64354,0)"
height="100%"
width="100%"
id="use4969"
xlink:href="#g4967"
y="0"
x="0" />
</g>
<g
id="g5122"
transform="matrix(0.77942184,0,0,0.77942184,28.23197,28.234004)">
<g
transform="translate(0.25895022)"
id="g5111">
<path
style="opacity:1;fill:url(#radialGradient5985);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.59133244;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter5827)"
id="path5096"
sodipodi:type="arc"
sodipodi:cx="-82.48848"
sodipodi:cy="168.49051"
sodipodi:rx="21.716808"
sodipodi:ry="21.716808"
sodipodi:start="0"
sodipodi:end="3.1415927"
sodipodi:open="true"
d="m -60.771671,168.49051 a 21.716808,21.716808 0 0 1 -10.858405,18.80731 21.716808,21.716808 0 0 1 -21.716808,0 21.716808,21.716808 0 0 1 -10.858406,-18.80731"
transform="matrix(0,-2.161208,2.161208,0,-195.48214,-96.127064)"
inkscape:transform-center-x="-23.784385"
inkscape:transform-center-y="-0.63425384" />
<use
x="0"
y="0"
xlink:href="#path5096"
id="use5098"
width="100%"
height="100%"
transform="translate(0,23.04657)" />
<use
x="0"
y="0"
xlink:href="#path5096"
id="use5100"
width="100%"
height="100%"
transform="translate(0,45.316289)" />
<use
x="0"
y="0"
xlink:href="#path5096"
id="use5102"
width="100%"
height="100%"
transform="translate(0,68.362859)" />
<use
x="0"
y="0"
xlink:href="#path5096"
id="use5104"
width="100%"
height="100%"
transform="translate(0,91.150479)" />
</g>
<use
transform="matrix(-1,0,0,1,255.8542,0)"
height="100%"
width="100%"
id="use5113"
xlink:href="#g5111"
y="0"
x="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View file

@ -21,11 +21,11 @@
"author": "Michael Lemaire",
"license": "MIT",
"devDependencies": {
"@types/jasmine": "^2.5.53",
"babel-polyfill": "^6.23.0",
"@types/jasmine": "^2.6.0",
"babel-polyfill": "^6.26.0",
"codecov": "^2.3.0",
"gamefroot-texture-packer": "Gamefroot/Gamefroot-Texture-Packer.git#f3687111afc94f80ea8f2877c188fb8e2004e8ff",
"jasmine": "^2.7.0",
"jasmine": "^2.8.0",
"karma": "^1.7.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.1.0",
@ -33,12 +33,12 @@
"karma-spec-reporter": "^0.0.31",
"live-server": "^1.2.0",
"remap-istanbul": "^0.9.5",
"typescript": "^2.4.2"
"typescript": "^2.5.3"
},
"dependencies": {
"jasmine-core": "^2.6.3",
"jasmine-core": "^2.8.0",
"parse": "^1.9.2",
"phaser": "^2.6.2",
"phaser-plugin-scene-graph": "^1.0.4"
}
}
}

View file

@ -67,12 +67,14 @@ module TK.SpaceTac {
this.ai_playing = false;
}
// Create a quick random battle, for testing purposes
/**
* Create a quick random battle, for testing purposes, or quick skirmish
*/
static newQuickRandom(start = true, level = 1, shipcount = 5): Battle {
var player1 = Player.newQuickRandom("Player", level, shipcount, true);
var player2 = Player.newQuickRandom("Enemy", level, shipcount, true);
let player1 = Player.newQuickRandom("Player", level, shipcount, true);
let player2 = Player.newQuickRandom("Enemy", level, shipcount, true);
var result = new Battle(player1.fleet, player2.fleet);
let result = new Battle(player1.fleet, player2.fleet);
if (start) {
result.start();
}

View file

@ -72,10 +72,8 @@ module TK.SpaceTac {
/**
* Apply one cooling-down step if necessary
*/
cool(): void {
if (this.heat > 0) {
this.heat -= 1;
}
cool(steps = 1): void {
this.heat = Math.max(this.heat - steps, 0);
if (this.heat == 0) {
this.uses = 0;

View file

@ -18,7 +18,7 @@ module TK.SpaceTac {
let models = this.random.sample(ShipModel.getDefaultCollection(), ship_count);
range(ship_count).forEach(i => {
var ship = ship_generator.generate(level, models[i] || null, upgrade, i < ship_count * 0.6);
var ship = ship_generator.generate(level, models[i] || null, upgrade);
ship.name = ship.model.name;
fleet.addShip(ship);
});

View file

@ -94,7 +94,7 @@ module TK.SpaceTac {
// Start a new "quick battle" game
startQuickBattle(with_ai: boolean = false): void {
var battle = Battle.newQuickRandom();
let battle = Battle.newQuickRandom(true, RandomGenerator.global.randInt(1, 10));
this.player = battle.fleets[0].player;
this.player.setBattle(battle);
}

View file

@ -67,21 +67,13 @@ module TK.SpaceTac {
*/
generateHighest(skills: ShipSkills, quality = EquipmentQuality.COMMON, slot: SlotType | null = null): Equipment | null {
let templates = this.templates.filter(this.templatefilter).filter(template => slot == null || slot == template.slot);
let candidates: Equipment[] = [];
let level = 1;
templates.forEach(template => {
let equipment = template.generateHighest(skills, quality, this.random);
if (equipment && equipment.level >= level) {
if (equipment.level > level) {
candidates.splice(0);
level = equipment.level;
}
candidates.push(equipment);
}
});
return (candidates.length == 0) ? null : this.random.choice(candidates);
let candidates = nna(templates.map(template => template.generateHighest(skills, quality, this.random)));
if (candidates.length) {
let chosen = this.random.weighted(candidates.map(equ => equ.level));
return candidates[chosen];
} else {
return null;
}
}
}
}

View file

@ -56,6 +56,9 @@ module TK.SpaceTac {
simpleFactor(effect, 'factor');
} else if (effect instanceof ValueTransferEffect) {
simpleFactor(effect, 'amount');
} else if (effect instanceof CooldownEffect) {
simpleFactor(effect, 'cooling');
simpleFactor(effect, 'maxcount');
}
}

View file

@ -17,7 +17,7 @@ module TK.SpaceTac {
*
* If *force_damage_equipment, at least one "damaging" weapon will be chosen
*/
generate(level: number, model: ShipModel | null = null, upgrade = false, force_damage_equipment = false): Ship {
generate(level: number, model: ShipModel | null = null, upgrade = false, force_damage_equipment = true): Ship {
if (!model) {
// Get a random model
model = ShipModel.getRandomModel(level, this.random);

View file

@ -20,7 +20,7 @@ module TK.SpaceTac {
// Equipment cannot be null
equipment: Equipment
constructor(equipment: Equipment, power = 1, range = 0, blast = 0, effects: BaseEffect[] = [], name = "Fire") {
constructor(equipment: Equipment, power = 1, range = 0, blast = 0, effects: BaseEffect[] = [], name = range ? "Fire" : "Trigger") {
super("fire-" + equipment.code, name, equipment);
this.power = power;
@ -116,9 +116,17 @@ module TK.SpaceTac {
return "";
}
let desc = `${this.name} (power usage ${this.power}, max range ${this.range}km)`;
let info: string[] = [];
if (this.power) {
info.push(`power usage ${this.power}`);
}
if (this.range) {
info.push(`max range ${this.range}km`);
}
let desc = `${this.name} (${info.join(", ")})`;
let effects = this.effects.map(effect => {
let suffix = this.blast ? `in ${this.blast}km radius` : "on target";
let suffix = this.blast ? `in ${this.blast}km radius` : (this.range ? "on target" : "on self");
return "• " + effect.getDescription() + " " + suffix;
});
return `${desc}:\n${effects.join("\n")}`;

View file

@ -0,0 +1,34 @@
module TK.SpaceTac {
describe("CooldownEffect", function () {
it("cools down equipment", function () {
let ship = new Ship();
let weapons = [TestTools.addWeapon(ship), TestTools.addWeapon(ship), TestTools.addWeapon(ship)];
weapons.forEach(weapon => weapon.cooldown.configure(1, 3));
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([0, 0, 0]);
new CooldownEffect(0, 0).applyOnShip(ship, ship);
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([0, 0, 0]);
weapons.forEach(weapon => weapon.cooldown.use());
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([3, 3, 3]);
new CooldownEffect(0, 0).applyOnShip(ship, ship);
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([0, 0, 0]);
weapons.forEach(weapon => weapon.cooldown.use());
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([3, 3, 3]);
new CooldownEffect(1, 0).applyOnShip(ship, ship);
expect(weapons.map(weapon => weapon.cooldown.heat)).toEqual([2, 2, 2]);
new CooldownEffect(1, 2).applyOnShip(ship, ship);
expect(weapons.map(weapon => weapon.cooldown.heat).sort()).toEqual([1, 1, 2]);
})
it("builds a textual description", function () {
expect(new CooldownEffect(0, 0).getDescription()).toBe("Full cooling (all equipments)");
expect(new CooldownEffect(1, 1).getDescription()).toBe("1 cooling (1 equipment)");
expect(new CooldownEffect(2, 2).getDescription()).toBe("2 cooling (2 equipments)");
})
})
}

View file

@ -0,0 +1,42 @@
/// <reference path="BaseEffect.ts"/>
module TK.SpaceTac {
/**
* Cools down equipment of affected ships
*/
export class CooldownEffect extends BaseEffect {
// Number of cooling steps to apply
cooling: number
// Maximal number of equipment to cool on one ship (will be chosen at random)
maxcount: number
constructor(cooling = 0, maxcount = 0) {
super("cooldown");
this.cooling = cooling;
this.maxcount = maxcount;
}
applyOnShip(ship: Ship, source: Ship | Drone): boolean {
let equipments = ship.listEquipment().filter(equ => equ.cooldown.heat > 0);
if (this.maxcount && equipments.length > this.maxcount) {
let random = RandomGenerator.global;
equipments = random.sample(equipments, this.maxcount);
}
equipments.forEach(equ => equ.cooldown.cool(this.cooling || equ.cooldown.heat));
return true;
}
isBeneficial(): boolean {
return true;
}
getDescription(): string {
return `${this.cooling ? this.cooling : "Full"} cooling (${this.maxcount ? this.maxcount : "all"} equipment${this.maxcount != 1 ? "s" : ""})`;
}
}
}

View file

@ -1,31 +0,0 @@
module TK.SpaceTac.Equipments {
describe("GatlingGun", function () {
it("generates equipment based on level", function () {
let template = new GatlingGun();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_materials": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 500, 0, [new DamageEffect(30, 20)]));
expect(equipment.price).toEqual(100);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_materials": 2 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 512, 0, [new DamageEffect(42, 28)]));
expect(equipment.price).toEqual(350);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_materials": 4 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 526, 0, [new DamageEffect(56, 37)]));
expect(equipment.price).toEqual(850);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_materials": 23 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 694, 0, [new DamageEffect(224, 149)]));
expect(equipment.price).toEqual(11350);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
});
});
}

View file

@ -1,15 +0,0 @@
/// <reference path="../LootTemplate.ts"/>
module TK.SpaceTac.Equipments {
export class GatlingGun extends LootTemplate {
constructor() {
super(SlotType.Weapon, "Gatling Gun", "Mechanical weapon using loads of metal bullets propelled by guided explosions");
this.setSkillsRequirements({ "skill_materials": leveled(1, 1.4) });
this.setCooldown(irepeat(2), irepeat(2));
this.addFireAction(irepeat(3), leveled(500, 12), irepeat(0), [
new EffectTemplate(new DamageEffect(), { base: leveled(30), span: leveled(20) })
]);
}
}
}

View file

@ -0,0 +1,91 @@
module TK.SpaceTac.Equipments {
describe("Generators", function () {
it("generates NuclearReactor based on level", function () {
let template = new NuclearReactor();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_photons": 1 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 1),
new AttributeEffect("power_capacity", 7),
new AttributeEffect("power_generation", 4),
]);
expect(equipment.price).toEqual(395);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_photons": 3 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 2),
new AttributeEffect("power_capacity", 7),
new AttributeEffect("power_generation", 5),
]);
expect(equipment.price).toEqual(1382);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_photons": 5 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 3),
new AttributeEffect("power_capacity", 8),
new AttributeEffect("power_generation", 5),
]);
expect(equipment.price).toEqual(3357);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_photons": 33 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 10),
new AttributeEffect("power_capacity", 15),
new AttributeEffect("power_generation", 12),
]);
expect(equipment.price).toEqual(44832);
})
it("generates KelvinGenerator based on level", function () {
let template = new KelvinGenerator();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_time": 1 });
expect(equipment.effects).toEqual([
new AttributeEffect("power_capacity", 5),
new AttributeEffect("power_generation", 4),
]);
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 1, 0, 0, [
new CooldownEffect(1, 1)
]));
expect(equipment.price).toEqual(420);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_time": 2 });
expect(equipment.effects).toEqual([
new AttributeEffect("power_capacity", 6),
new AttributeEffect("power_generation", 4),
]);
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 1, 0, 0, [
new CooldownEffect(1, 1)
]));
expect(equipment.price).toEqual(1470);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_time": 4, "skill_gravity": 1 });
expect(equipment.effects).toEqual([
new AttributeEffect("power_capacity", 6),
new AttributeEffect("power_generation", 5),
]);
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 1, 0, 0, [
new CooldownEffect(1, 1)
]));
expect(equipment.price).toEqual(3570);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_time": 28, "skill_gravity": 6 });
expect(equipment.effects).toEqual([
new AttributeEffect("power_capacity", 13),
new AttributeEffect("power_generation", 12),
]);
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 7, 0, 0, [
new CooldownEffect(4, 7)
]));
expect(equipment.price).toEqual(47670);
})
})
}

View file

@ -0,0 +1,27 @@
/// <reference path="../LootTemplate.ts"/>
module TK.SpaceTac.Equipments {
export class NuclearReactor extends LootTemplate {
constructor() {
super(SlotType.Power, "Nuclear Reactor", "A standard nuclear power core, drawing power from atom fusion cycles", 395);
this.setSkillsRequirements({ "skill_photons": leveled(1, 2) });
this.addAttributeEffect("maneuvrability", leveled(1, 1, 0));
this.addAttributeEffect("power_capacity", leveled(7, 0.5));
this.addAttributeEffect("power_generation", leveled(4.5, 0.5));
}
}
export class KelvinGenerator extends LootTemplate {
constructor() {
super(SlotType.Power, "Kelvin Generator", "A power generator operating at ultra-low temperature, improving equipment cooldown", 420);
this.setSkillsRequirements({ "skill_time": leveled(1, 1.7), "skill_gravity": leveled(0.3, 0.4) });
this.addAttributeEffect("power_capacity", leveled(5.5, 0.5));
this.addAttributeEffect("power_generation", leveled(4, 0.5));
this.addFireAction(leveled(1, 0.4), irepeat(0), irepeat(0), [
new EffectTemplate(new CooldownEffect(), { cooling: leveled(1, 0.2), maxcount: leveled(1, 0.4) })
])
}
}
}

View file

@ -1,43 +0,0 @@
module TK.SpaceTac.Equipments {
describe("NuclearReactor", function () {
it("generates equipment based on level", function () {
let template = new NuclearReactor();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_photons": 1 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 1),
new AttributeEffect("power_capacity", 7),
new AttributeEffect("power_generation", 4),
]);
expect(equipment.price).toEqual(395);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_photons": 3 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 2),
new AttributeEffect("power_capacity", 7),
new AttributeEffect("power_generation", 5),
]);
expect(equipment.price).toEqual(1382);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_photons": 5 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 3),
new AttributeEffect("power_capacity", 8),
new AttributeEffect("power_generation", 5),
]);
expect(equipment.price).toEqual(3357);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_photons": 33 });
expect(equipment.effects).toEqual([
new AttributeEffect("maneuvrability", 10),
new AttributeEffect("power_capacity", 15),
new AttributeEffect("power_generation", 12),
]);
expect(equipment.price).toEqual(44832);
});
});
}

View file

@ -1,14 +0,0 @@
/// <reference path="../LootTemplate.ts"/>
module TK.SpaceTac.Equipments {
export class NuclearReactor extends LootTemplate {
constructor() {
super(SlotType.Power, "Nuclear Reactor", "A standard nuclear power core, drawing power from atom fusion cycles", 395);
this.setSkillsRequirements({ "skill_photons": leveled(1, 2) });
this.addAttributeEffect("maneuvrability", leveled(1, 1, 0));
this.addAttributeEffect("power_capacity", leveled(7, 0.5));
this.addAttributeEffect("power_generation", leveled(4.5, 0.5));
}
}
}

View file

@ -0,0 +1,87 @@
module TK.SpaceTac.Equipments {
describe("RawWeapons", function () {
it("generates GatlingGun based on level", function () {
let template = new GatlingGun();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_materials": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 500, 0, [new DamageEffect(30, 20)]));
expect(equipment.price).toEqual(100);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_materials": 2 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 512, 0, [new DamageEffect(42, 28)]));
expect(equipment.price).toEqual(350);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_materials": 4 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 526, 0, [new DamageEffect(56, 37)]));
expect(equipment.price).toEqual(850);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_materials": 23 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 3, 694, 0, [new DamageEffect(224, 149)]));
expect(equipment.price).toEqual(11350);
expect(equipment.cooldown).toEqual(new Cooldown(2, 2));
});
it("generates SubMunitionMissile based on level", function () {
let template = new SubMunitionMissile();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_materials": 1, "skill_photons": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 500, 150, [new DamageEffect(26, 4)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(163);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_materials": 2, "skill_photons": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 520, 155, [new DamageEffect(28, 5)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(570);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_materials": 3, "skill_photons": 2 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 544, 161, [new DamageEffect(30, 6)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(1385);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_materials": 20, "skill_photons": 13 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 824, 231, [new DamageEffect(58, 20)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(18500);
});
it("generates ProkhorovLaser based on level", function () {
let template = new ProkhorovLaser();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_photons": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 5, 0, 250, [new DamageEffect(20, 25)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 1));
expect(equipment.price).toEqual(152);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_antimatter": 1, "skill_photons": 2 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 5, 0, 260, [new DamageEffect(28, 35)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 1));
expect(equipment.price).toEqual(532);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_antimatter": 1, "skill_photons": 3 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 5, 0, 272, [new DamageEffect(37, 47)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 1));
expect(equipment.price).toEqual(1292);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_antimatter": 11, "skill_photons": 22 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 5, 0, 412, [new DamageEffect(149, 187)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 1));
expect(equipment.price).toEqual(17252);
});
});
}

View file

@ -0,0 +1,41 @@
/// <reference path="../LootTemplate.ts"/>
module TK.SpaceTac.Equipments {
export class GatlingGun extends LootTemplate {
constructor() {
super(SlotType.Weapon, "Gatling Gun", "Mechanical weapon using loads of metal bullets propelled by guided explosions");
this.setSkillsRequirements({ "skill_materials": leveled(1, 1.4) });
this.setCooldown(irepeat(2), irepeat(2));
this.addFireAction(irepeat(3), leveled(500, 12), irepeat(0), [
new EffectTemplate(new DamageEffect(), { base: leveled(30), span: leveled(20) })
]);
}
}
export class SubMunitionMissile extends LootTemplate {
constructor() {
super(SlotType.Weapon, "SubMunition Missile", "Explosive missile releasing small shelled payloads, that will in turn explode on impact", 163);
this.setSkillsRequirements({ "skill_materials": leveled(1, 1.2), "skill_photons": leveled(1, 0.8) });
this.setCooldown(irepeat(1), irepeat(0));
this.addFireAction(irepeat(4), leveled(500, 20), leveled(150, 5), [
new EffectTemplate(new DamageEffect(), { base: leveled(26, 2), span: leveled(4, 1) })
]);
}
}
export class ProkhorovLaser extends LootTemplate {
constructor() {
super(SlotType.Weapon, "Prokhorov Laser", "Powerful mid-range perforating laser, using antimatter to contain the tremendous photonic energy", 152);
// TODO increased damage to hull
// TODO cone targetting
this.setSkillsRequirements({ "skill_antimatter": leveled(0.3, 0.7), "skill_photons": leveled(1, 1.3) });
this.setCooldown(irepeat(1), irepeat(1));
this.addFireAction(irepeat(5), irepeat(0), leveled(250, 10), [
new EffectTemplate(new DamageEffect(), { base: leveled(20), span: leveled(25) })
]);
}
}
}

View file

@ -1,105 +0,0 @@
module TK.SpaceTac.Equipments {
describe("SubMunitionMissile", function () {
it("generates equipment based on level", function () {
let template = new SubMunitionMissile();
let equipment = template.generate(1);
expect(equipment.requirements).toEqual({ "skill_materials": 1, "skill_photons": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 500, 150, [new DamageEffect(26, 4)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(163);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_materials": 2, "skill_photons": 1 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 520, 155, [new DamageEffect(28, 5)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(570);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_materials": 3, "skill_photons": 2 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 544, 161, [new DamageEffect(30, 6)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(1385);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_materials": 20, "skill_photons": 13 });
expect(equipment.action).toEqual(new FireWeaponAction(equipment, 4, 824, 231, [new DamageEffect(58, 20)]));
expect(equipment.cooldown).toEqual(new Cooldown(1, 0));
expect(equipment.price).toEqual(18500);
});
it("hits several targets in circle", function () {
var battle = TestTools.createBattle(1, 2);
var ship = battle.fleets[0].ships[0];
ship.setArenaPosition(0, 0);
TestTools.setShipAP(ship, 100);
TestTools.setShipHP(ship, 50, 30);
var enemy1 = battle.fleets[1].ships[0];
enemy1.setArenaPosition(1, 0);
TestTools.setShipHP(enemy1, 50, 30);
var enemy2 = battle.fleets[1].ships[1];
enemy2.setArenaPosition(2, 0);
TestTools.setShipHP(enemy2, 50, 30);
var template = new Equipments.SubMunitionMissile();
var equipment = template.generate(1);
let action = <FireWeaponAction>nn(equipment.action);
action.range = 5;
action.blast = 1.5;
(<DamageEffect>action.effects[0]).base = 20;
(<DamageEffect>action.effects[0]).span = 0;
var checkHP = (h1: number, s1: number, h2: number, s2: number, h3: number, s3: number): void => {
expect(ship.values.hull.get()).toBe(h1);
expect(ship.values.shield.get()).toBe(s1);
expect(enemy1.values.hull.get()).toBe(h2);
expect(enemy1.values.shield.get()).toBe(s2);
expect(enemy2.values.hull.get()).toBe(h3);
expect(enemy2.values.shield.get()).toBe(s3);
};
checkHP(50, 30, 50, 30, 50, 30);
battle.log.clear();
battle.log.addFilter("value");
// Fire at a ship
var target = Target.newFromShip(enemy1);
expect(action.checkCannotBeApplied(ship)).toBe(null);
action.apply(ship, target);
checkHP(50, 10, 50, 10, 50, 10);
expect(battle.log.events.length).toBe(5);
expect(battle.log.events[0]).toEqual(new ActionAppliedEvent(ship, action, Target.newFromLocation(1, 0), 4));
expect(battle.log.events[1]).toEqual(new FireEvent(ship, equipment, Target.newFromLocation(1, 0)));
expect(battle.log.events[2]).toEqual(new DamageEvent(ship, 0, 20));
expect(battle.log.events[3]).toEqual(new DamageEvent(enemy1, 0, 20));
expect(battle.log.events[4]).toEqual(new DamageEvent(enemy2, 0, 20));
battle.log.clear();
equipment.cooldown.cool();
// Fire in space
target = Target.newFromLocation(2.4, 0);
expect(action.checkCannotBeApplied(ship)).toBe(null);
action.apply(ship, target);
checkHP(50, 10, 40, 0, 40, 0);
expect(battle.log.events.length).toBe(4);
expect(battle.log.events[0]).toEqual(new ActionAppliedEvent(ship, action, target, 4));
expect(battle.log.events[1]).toEqual(new FireEvent(ship, equipment, target));
expect(battle.log.events[2]).toEqual(new DamageEvent(enemy1, 10, 10));
expect(battle.log.events[3]).toEqual(new DamageEvent(enemy2, 10, 10));
battle.log.clear();
equipment.cooldown.cool();
// Fire far away
target = Target.newFromLocation(5, 0);
expect(action.checkCannotBeApplied(ship)).toBe(null);
action.apply(ship, target);
checkHP(50, 10, 40, 0, 40, 0);
expect(battle.log.events.length).toBe(2);
expect(battle.log.events[0]).toEqual(new ActionAppliedEvent(ship, action, target, 4));
expect(battle.log.events[1]).toEqual(new FireEvent(ship, equipment, target));
});
});
}

View file

@ -1,15 +0,0 @@
/// <reference path="../LootTemplate.ts"/>
module TK.SpaceTac.Equipments {
export class SubMunitionMissile extends LootTemplate {
constructor() {
super(SlotType.Weapon, "SubMunition Missile", "Explosive missile releasing small shelled payloads, that will in turn explode on impact", 163);
this.setSkillsRequirements({ "skill_materials": leveled(1, 1.2), "skill_photons": leveled(1, 0.8) });
this.setCooldown(irepeat(1), irepeat(0));
this.addFireAction(irepeat(4), leveled(500, 20), leveled(150, 5), [
new EffectTemplate(new DamageEffect(), { base: leveled(26, 2), span: leveled(4, 1) })
]);
}
}
}

View file

@ -2,13 +2,9 @@
# yarn lockfile v1
"@types/jasmine@^2.5.53":
version "2.5.53"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.53.tgz#4e0cefad09df5ec48c8dd40433512f84b1568d61"
"@types/phaser@thunderk/phaser#v2.6.2a":
version "2.6.2"
resolved "https://codeload.github.com/thunderk/phaser/tar.gz/a0390d5540e9c080f9c5c48aae94bafaedc85a0e"
"@types/jasmine@^2.6.0":
version "2.6.0"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.6.0.tgz#997b41a27752b4850af2683bc4a8d8222c25bd02"
abbrev@1, abbrev@1.0.x:
version "1.0.9"
@ -160,21 +156,28 @@ aws4@^1.2.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
babel-polyfill@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d"
babel-polyfill@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
dependencies:
babel-runtime "^6.22.0"
core-js "^2.4.0"
regenerator-runtime "^0.10.0"
babel-runtime "^6.26.0"
core-js "^2.5.0"
regenerator-runtime "^0.10.5"
babel-runtime@^6.11.6, babel-runtime@^6.22.0:
babel-runtime@^6.11.6:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.10.0"
babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
backo2@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947"
@ -462,6 +465,10 @@ core-js@^2.2.0, core-js@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
core-js@^2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@ -1308,21 +1315,17 @@ istanbul@0.4.5, istanbul@^0.4.0:
which "^1.1.1"
wordwrap "^1.0.0"
jasmine-core@^2.6.3:
version "2.6.4"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.6.4.tgz#dec926cd0a9fa287fb6db5c755fa487e74cecac5"
jasmine-core@^2.8.0, jasmine-core@~2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
jasmine-core@~2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.7.0.tgz#50ff8c4f92d8ef5c0b2c1b846dd263ed85152091"
jasmine@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.7.0.tgz#5cf0bb4e594b4600bb4235560366212ac5aea1b2"
jasmine@^2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e"
dependencies:
exit "^0.1.2"
glob "^7.0.6"
jasmine-core "~2.7.0"
jasmine-core "~2.8.0"
js-yaml@3.x:
version "3.8.4"
@ -2126,10 +2129,14 @@ redent@^1.0.0:
indent-string "^2.1.0"
strip-indent "^1.0.1"
regenerator-runtime@^0.10.0:
regenerator-runtime@^0.10.0, regenerator-runtime@^0.10.5:
version "0.10.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
regenerator-runtime@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1"
regex-cache@^0.4.2:
version "0.4.3"
resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145"
@ -2577,9 +2584,9 @@ typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"
typescript@^2.5.3:
version "2.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
uglify-js@^2.6:
version "2.8.29"