Add more weapons
This commit is contained in:
parent
4dd64ed203
commit
381beca3d5
@ -49,6 +49,16 @@
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<!--Semi-Automatic Firearms-->
|
||||
|
||||
<g id="pistol" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#semi-auto" />
|
||||
<line x1="0" y1="-5" x2="0" y2="5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="rifle" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -58,63 +68,6 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="smg" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="blazer" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<use href="#laser"/>
|
||||
<polyline points="-2,-3.5 0,-5 2,-3.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="lmg" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
<line x1="0" y1="-4.5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="0.5" x2="2" y2="0.5"/>
|
||||
<polyline points="-2,-3.25 0,-4.75 2,-3.25"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="srm" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="0" y1="-4.75" x2="0" y2="5"/>
|
||||
<line x1="-2" y1="0.5" x2="2" y2="0.5"/>
|
||||
<path d="M -2,4.75 V -2.5 C -2,-5.5 2,-5.5 2,-2.5 V 4.75"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="hsplaser" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
<use href="#auto"/>
|
||||
<polyline points="0,-5 0,-3 -3,-2.5 3,-1.5 0,-1 0,2.5 0,4.5"/>
|
||||
<polyline points="-2,-3.5 0,-5 2,-3.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="smggl" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<circle cy="-2.25" r="1"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="riflegl" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -125,14 +78,6 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="pistol" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#semi-auto" />
|
||||
<line x1="0" y1="-5" x2="0" y2="5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="laserpistol" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -160,6 +105,17 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!--Automatic Firearms-->
|
||||
|
||||
<g id="blazer" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<use href="#laser"/>
|
||||
<polyline points="-2,-3.5 0,-5 2,-3.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="autopistol" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -168,6 +124,62 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="smg" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="smggl" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<use href="#auto"/>
|
||||
<circle cy="-2.25" r="1"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!--Hand-to-Hand Weapons-->
|
||||
|
||||
<g id="nonlethalhand" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="-2" y1="-4.25" x2="2" y2="-4.25"/>
|
||||
<line x1="0" y1="-4.25" x2="0" y2="5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="lethalhand" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="0" y1="-5" x2="0" y2="5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!--Area-Effect Weapons-->
|
||||
|
||||
<g id="srm" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="0" y1="-4.75" x2="0" y2="5"/>
|
||||
<line x1="-2" y1="0.5" x2="2" y2="0.5"/>
|
||||
<path d="M -2,4.75 V -2.5 C -2,-5.5 2,-5.5 2,-2.5 V 4.75"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="hsrm" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="0" y1="-4.75" x2="0" y2="5"/>
|
||||
<use href="#auto" />
|
||||
<path d="M -2,4.75 V -2.5 C -2,-5.5 2,-5.5 2,-2.5 V 4.75"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="law" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -178,12 +190,11 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="hsrm" style="r: inherit;" class="weapon-symbol">
|
||||
<g id="grenade" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="0" y1="-4.75" x2="0" y2="5"/>
|
||||
<use href="#auto" />
|
||||
<path d="M -2,4.75 V -2.5 C -2,-5.5 2,-5.5 2,-2.5 V 4.75"/>
|
||||
<circle cy="-2.25" r="1"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
@ -248,6 +259,18 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!--Support Weapons-->
|
||||
|
||||
<g id="lmg" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
<line x1="0" y1="-4.5" x2="0" y2="4.5"/>
|
||||
<line x1="-2" y1="0.5" x2="2" y2="0.5"/>
|
||||
<polyline points="-2,-3.25 0,-4.75 2,-3.25"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="mmg" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
@ -278,12 +301,24 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="hsplaser" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
<use href="#auto"/>
|
||||
<polyline points="0,-5 0,-3 -3,-2.5 3,-1.5 0,-1 0,2.5 0,4.5"/>
|
||||
<polyline points="-2,-3.5 0,-5 2,-3.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="mpppc" style="r: inherit;" class="weapon-symbol">
|
||||
<use style="r: inherit;" href="#counter-base"/>
|
||||
<g style="stroke: white; stroke-width: 0.5px; fill: none;">
|
||||
<polyline points="-2,-3.5 0,-5 2,-3.5"/>
|
||||
<path d="M -3,-2 h 2 m 2,0 h 2 m -1, -1 v 2"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="5"/>
|
||||
<circle cx="-1.5" cy="-2" style="fill: white;" r="0.25" />
|
||||
<circle cx="1.5" cy="-2" style="fill: white;" r="0.25" />
|
||||
<line x1="-2" y1="4.5" x2="2" y2="4.5"/>
|
||||
<line x1="0" y1="-5" x2="0" y2="4.5"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 20 KiB |
@ -1,23 +1,6 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 200 300">
|
||||
<defs>
|
||||
<g id="building1" class="building">
|
||||
<g class="footprint">
|
||||
<g data-q="0" data-r="0" data-s="0" data-left="1" data-top="3" data-right="2" data-bottom="4" data-offset="left" />
|
||||
</g>
|
||||
|
||||
<g class="structure">
|
||||
<path id="building1-floor" class="floor" d="M -30.309999,-52.5 H 38.97 l 0,119.999999 H -30.31 Z" />
|
||||
<path id="building1-outer-wall" class="outer-wall" d="M 38.969998,-7.500001 21.65,-7.5 V 7.4999997 L 12.989997,7.5 m 0,30 25.980001,0 M 12.989997,67.5 v -60 l -17.319997,0 0,-30.0000007 M -4.330003,67.5 v -45 H -30.31 m 0,-74.999999 L 38.97,-52.5 38.969999,67.499999 -30.31,67.5 Z" />
|
||||
<path id="building1-inner-wall" class="inner-wall" d="M 38.969998,-7.500001 21.65,-7.5 V 7.4999997 L 12.989997,7.5 m 0,30 25.980001,0 M 12.989997,67.5 v -60 l -17.319997,0 0,-30.0000007 M -4.330003,67.5 v -45 H -30.31 m 0,-74.999999 L 38.97,-52.5 38.969999,67.499999 -30.31,67.5 Z" />
|
||||
<path id="building1-door-edges" class="door-edges" d="m 12.99,52.5 0,-15 M -4.33,45.000003 v -15 M 12.990002,30 l 0,-15" />
|
||||
<path id="building1-doors" class="doors" d="m 12.99,48.169997 0,-6.34 M -4.33,40.67 v -6.34 m 17.320002,-8.66 0,-6.34" />
|
||||
<path id="building1-exit-edges" class="exits door-edges" d="M 0,-52.5 H 17.32 M -30.31,8.66 V -8.66" />
|
||||
<path id="building1-exits" class="doors exits" d="M 4.3300002,-52.5 H 12.99 m -43.3,56.8300023 v -8.660003" />
|
||||
<path id="building1-windows" class="windows" d="m 32.501739,67.499994 -13.043478,0 m -49.768256,-8.478265 0,-13.043478 m 0,-69.456522 0,-13.043479" />
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<polygon id="desk" points="-1.5,-7 4.5,-7 4.5,7 -1.5,7 -2.5,6 -2.5,3 -4.5,3 -4.5,-3 -2.5,-3 -2.5,-6" />
|
||||
<rect id="couch" x="-4.25" y="-8" width="8.5" height="16" />
|
||||
<rect id="bed" x="-5" y="-9" width="10" height="18" />
|
||||
@ -25,7 +8,7 @@
|
||||
|
||||
<g id="mapsheet" class="mapsheet">
|
||||
<g class="building1" data-q="3" data-r="-5" data-s="2">
|
||||
<use href="#building1"/>
|
||||
<use href="mapsheets.svg#building1"/>
|
||||
<g class="furniture">
|
||||
<use href="#couch" transform="rotate(90,10.34,-27.66)" />
|
||||
<use href="#bed" transform="translate(-17.32,45)" />
|
||||
@ -56,7 +39,7 @@
|
||||
<g class="start-locations" data-attacker-name="liao" data-defender-name="davion">
|
||||
<g data-edge="north" style="--i: -2">
|
||||
<g class="counter" data-allegiance="attacker" data-number="1" data-squad="1" data-armor="4">
|
||||
<use class="primary-weapon" href="counters.svg#blazer"/>
|
||||
<use class="primary-weapon" href="counters.svg#pistol"/>
|
||||
<use class="troop-number" href="counters.svg#number-1"/>
|
||||
<use class="squad-number" href="counters.svg#number-1"/>
|
||||
</g>
|
||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 5.7 KiB |
@ -7,9 +7,9 @@ function dataSelector({ dataset: { allegiance, number, squad }}) {
|
||||
return `[data-number="${number}"][data-allegiance="${allegiance}"][data-squad="${squad}"]`;
|
||||
}
|
||||
|
||||
function traceSelector(counter) {
|
||||
return `polyline.move-trace${dataSelector(counter)}`;
|
||||
}
|
||||
//function traceSelector(counter) {
|
||||
// return `polyline.move-trace${dataSelector(counter)}`;
|
||||
//}
|
||||
|
||||
function getCellPosition(cell) {
|
||||
const [x, y] = cell.getAttributeNS(null, 'transform').match(/-?\d+\.?\d*/g);
|
||||
@ -17,44 +17,44 @@ function getCellPosition(cell) {
|
||||
return { x, y };
|
||||
}
|
||||
|
||||
function getClones(svg, counter) {
|
||||
return svg.querySelectorAll(`.counter.clone${dataSelector(counter)}`);
|
||||
}
|
||||
//function getClones(svg, counter) {
|
||||
// return svg.querySelectorAll(`.counter.clone${dataSelector(counter)}`);
|
||||
//}
|
||||
|
||||
function addMoveToHistory(selected) {
|
||||
const clone = selected.cloneNode(true);
|
||||
clone.classList.remove(selectedClass);
|
||||
clone.classList.add('clone');
|
||||
selected.parentElement.appendChild(clone);
|
||||
//function addMoveToHistory(selected) {
|
||||
// const clone = selected.cloneNode(true);
|
||||
// clone.classList.remove(selectedClass);
|
||||
// clone.classList.add('clone');
|
||||
// selected.parentElement.appendChild(clone);
|
||||
//
|
||||
// return clone;
|
||||
//}
|
||||
|
||||
return clone;
|
||||
}
|
||||
//function updatePlacement(cell, selected, clone) {
|
||||
// const { q, r, s, t } = clone.parentElement.dataset;
|
||||
//
|
||||
// selected.dataset.previous = [q, r, s, t];
|
||||
// placeIn(cell, selected);
|
||||
//
|
||||
// Array.from(selected.children).forEach(n => {
|
||||
// if (n.classList.contains('removed')) {
|
||||
// n.remove();
|
||||
// } else if ('preexisting' in n.dataset) {
|
||||
// delete n.dataset.preexisting;
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
function updatePlacement(cell, selected, clone) {
|
||||
const { q, r, s, t } = clone.parentElement.dataset;
|
||||
|
||||
selected.dataset.previous = [q, r, s, t];
|
||||
placeIn(cell, selected);
|
||||
|
||||
Array.from(selected.children).forEach(n => {
|
||||
if (n.classList.contains('removed')) {
|
||||
n.remove();
|
||||
} else if ('preexisting' in n.dataset) {
|
||||
delete n.dataset.preexisting;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createTrace(previous, current, selected) {
|
||||
const trace = document.createElementNS(svgns, 'polyline');
|
||||
|
||||
trace.dataset.number = selected.dataset.number;
|
||||
trace.dataset.allegiance = selected.dataset.allegiance;
|
||||
trace.classList.add('move-trace');
|
||||
trace.setAttributeNS(null, 'points', `${previous.x},${previous.y} ${current.x},${current.y}`);
|
||||
|
||||
return trace;
|
||||
}
|
||||
//function createTrace(previous, current, selected) {
|
||||
// const trace = document.createElementNS(svgns, 'polyline');
|
||||
//
|
||||
// trace.dataset.number = selected.dataset.number;
|
||||
// trace.dataset.allegiance = selected.dataset.allegiance;
|
||||
// trace.classList.add('move-trace');
|
||||
// trace.setAttributeNS(null, 'points', `${previous.x},${previous.y} ${current.x},${current.y}`);
|
||||
//
|
||||
// return trace;
|
||||
//}
|
||||
|
||||
function placeIn(location, target) {
|
||||
location.querySelector('use[href="#hex"]').after(target);
|
||||
@ -87,29 +87,30 @@ export function createCounter(selected, weapon = 'rifle') {
|
||||
return g;
|
||||
}
|
||||
|
||||
export function handleTrace(svg, selected, clone, current) {
|
||||
let trace = getTrace(svg, selected);
|
||||
|
||||
if (!trace) {
|
||||
trace = createTrace(getCellPosition(clone.parentElement), current, selected);
|
||||
svg.querySelector('.grid').before(trace);
|
||||
} else {
|
||||
const points = `${trace.getAttribute('points')} ${current.x},${current.y}`;
|
||||
trace.setAttributeNS(null, 'points', points);
|
||||
}
|
||||
}
|
||||
//export function handleTrace(svg, selected, clone, current) {
|
||||
// let trace = getTrace(svg, selected);
|
||||
//
|
||||
// if (!trace) {
|
||||
// trace = createTrace(getCellPosition(clone.parentElement), current, selected);
|
||||
// svg.querySelector('.grid').before(trace);
|
||||
// } else {
|
||||
// const points = `${trace.getAttribute('points')} ${current.x},${current.y}`;
|
||||
// trace.setAttributeNS(null, 'points', points);
|
||||
// }
|
||||
//}
|
||||
|
||||
export function getAllCounters(container) {
|
||||
return container.querySelectorAll('g.counter[data-allegiance][data-number]');
|
||||
}
|
||||
|
||||
export function getCounter(svg, selected) {
|
||||
return svg.querySelector(`.counter${dataSelector(selected)}:not(.clone)`);
|
||||
//return svg.querySelector(`.counter${dataSelector(selected)}:not(.clone)`);
|
||||
return svg.querySelector(`.counter${dataSelector(selected)}`);
|
||||
}
|
||||
|
||||
export function getTrace(svg, counter) {
|
||||
return svg.querySelector(traceSelector(counter));
|
||||
}
|
||||
//export function getTrace(svg, counter) {
|
||||
// return svg.querySelector(traceSelector(counter));
|
||||
//}
|
||||
|
||||
export function place(svg, selected, cell) {
|
||||
//console.log(selected.parentElement);
|
||||
@ -134,23 +135,23 @@ export function place(svg, selected, cell) {
|
||||
//}
|
||||
}
|
||||
|
||||
export function removeClones(svg, counter) {
|
||||
getClones(svg, counter).forEach(c => c.remove());
|
||||
}
|
||||
//export function removeClones(svg, counter) {
|
||||
// getClones(svg, counter).forEach(c => c.remove());
|
||||
//}
|
||||
|
||||
export function endMove(svg, counter) {
|
||||
Array.from(counter.children).forEach(n => {
|
||||
if (n.classList.contains('removed')) {
|
||||
n.remove();
|
||||
} else {
|
||||
n.dataset.preexisting = '';
|
||||
}
|
||||
});
|
||||
//export function endMove(svg, counter) {
|
||||
//Array.from(counter.children).forEach(n => {
|
||||
// if (n.classList.contains('removed')) {
|
||||
// n.remove();
|
||||
// } else {
|
||||
// n.dataset.preexisting = '';
|
||||
// }
|
||||
//});
|
||||
|
||||
svg.querySelector(traceSelector(counter))?.remove();
|
||||
delete counter.dataset.previous;
|
||||
removeClones(svg, counter);
|
||||
}
|
||||
//svg.querySelector(traceSelector(counter))?.remove();
|
||||
//delete counter.dataset.previous;
|
||||
//removeClones(svg, counter);
|
||||
//}
|
||||
|
||||
export function getSelectedClass() {
|
||||
return selectedClass;
|
||||
|
@ -46,16 +46,16 @@ function isMechTemplate(el) {
|
||||
return el && el.getAttribute('class') === 'mech-template';
|
||||
}
|
||||
|
||||
function isClone(counter) {
|
||||
const isClone = counter.classList.contains('clone'),
|
||||
{ allegiance: clAl, number: clNum } = counter.dataset;
|
||||
|
||||
return {
|
||||
of: function ({ dataset: { allegiance, number }}) {
|
||||
return isClone && clAl == allegiance && clNum == number;
|
||||
}
|
||||
};
|
||||
}
|
||||
//function isClone(counter) {
|
||||
// const isClone = counter.classList.contains('clone'),
|
||||
// { allegiance: clAl, number: clNum } = counter.dataset;
|
||||
//
|
||||
// return {
|
||||
// of: function ({ dataset: { allegiance, number }}) {
|
||||
// return isClone && clAl == allegiance && clNum == number;
|
||||
// }
|
||||
// };
|
||||
//}
|
||||
|
||||
function getCellPosition(cell) {
|
||||
const [x, y] = cell.getAttributeNS(null, 'transform').match(/-?\d+\.?\d*/g);
|
||||
@ -127,56 +127,56 @@ function drawSightLine(sourceCell, targetCell) {
|
||||
svg.querySelector('.gameboard').appendChild(line);
|
||||
}
|
||||
|
||||
function moveBackOneStepInHistory(counter) {
|
||||
const trace = soldier.getTrace(svg, counter);
|
||||
//function moveBackOneStepInHistory(counter) {
|
||||
// const trace = soldier.getTrace(svg, counter);
|
||||
//
|
||||
// counter.remove();
|
||||
// counter = getCounterAtGridIndex(...counter.dataset.previous.split(','));
|
||||
// counter.classList.remove('clone');
|
||||
// counter.classList.add(soldier.getSelectedClass());
|
||||
//
|
||||
// if (!('previous' in counter.dataset)) {
|
||||
// trace.remove();
|
||||
// } else {
|
||||
// const points = trace.getAttribute('points').split(' ');
|
||||
// points.pop();
|
||||
// trace.setAttributeNS(null, 'points', points.join(' '));
|
||||
// }
|
||||
//
|
||||
// return counter;
|
||||
//}
|
||||
|
||||
counter.remove();
|
||||
counter = getCounterAtGridIndex(...counter.dataset.previous.split(','));
|
||||
counter.classList.remove('clone');
|
||||
counter.classList.add(soldier.getSelectedClass());
|
||||
//function clearMoveHistory(clone, counter) {
|
||||
// clone.classList.remove('clone');
|
||||
// clone.classList.add(soldier.getSelectedClass());
|
||||
// counter.remove();
|
||||
// counter = clone;
|
||||
// soldier.removeClones(svg, counter);
|
||||
// soldier.getTrace(svg, counter).remove();
|
||||
//
|
||||
// return counter;
|
||||
//}
|
||||
|
||||
if (!('previous' in counter.dataset)) {
|
||||
trace.remove();
|
||||
} else {
|
||||
const points = trace.getAttribute('points').split(' ');
|
||||
points.pop();
|
||||
trace.setAttributeNS(null, 'points', points.join(' '));
|
||||
}
|
||||
//function deleteClone(occupant, counter, cell) {
|
||||
// const index = getGridIndex(occupant),
|
||||
// trace = soldier.getTrace(svg, counter),
|
||||
// pos = getCellPosition(cell),
|
||||
// points = trace.getAttribute('points').split(' ').filter(p => p != `${pos.x},${pos.y}`).join(' ');;
|
||||
//
|
||||
// let current = counter;
|
||||
// trace.setAttributeNS(null, 'points', points);
|
||||
//
|
||||
// while (current.dataset.previous != `${index.q},${index.r},${index.s},${index.t}`) {
|
||||
// current = getCounterAtGridIndex(...current.dataset.previous.split(','));
|
||||
// }
|
||||
//
|
||||
// current.dataset.previous = occupant.dataset.previous;
|
||||
// occupant.remove();
|
||||
//}
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
function clearMoveHistory(clone, counter) {
|
||||
clone.classList.remove('clone');
|
||||
clone.classList.add(soldier.getSelectedClass());
|
||||
counter.remove();
|
||||
counter = clone;
|
||||
soldier.removeClones(svg, counter);
|
||||
soldier.getTrace(svg, counter).remove();
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
function deleteClone(occupant, counter, cell) {
|
||||
const index = getGridIndex(occupant),
|
||||
trace = soldier.getTrace(svg, counter),
|
||||
pos = getCellPosition(cell),
|
||||
points = trace.getAttribute('points').split(' ').filter(p => p != `${pos.x},${pos.y}`).join(' ');;
|
||||
|
||||
let current = counter;
|
||||
trace.setAttributeNS(null, 'points', points);
|
||||
|
||||
while (current.dataset.previous != `${index.q},${index.r},${index.s},${index.t}`) {
|
||||
current = getCounterAtGridIndex(...current.dataset.previous.split(','));
|
||||
}
|
||||
|
||||
current.dataset.previous = occupant.dataset.previous;
|
||||
occupant.remove();
|
||||
}
|
||||
|
||||
function hasPreviousMoveInHistory(counter) {
|
||||
return 'previous' in counter.dataset;
|
||||
}
|
||||
//function hasPreviousMoveInHistory(counter) {
|
||||
// return 'previous' in counter.dataset;
|
||||
//}
|
||||
|
||||
function selectOffBoard() {
|
||||
Observable.notify('select', this, { revealRecord: true });
|
||||
@ -229,7 +229,7 @@ function endMove() {
|
||||
const selected = getSelected();
|
||||
|
||||
if (selected) {
|
||||
soldier.endMove(svg, selected);
|
||||
//soldier.endMove(svg, selected);
|
||||
deselect();
|
||||
}
|
||||
}
|
||||
@ -405,9 +405,33 @@ export function start(el) {
|
||||
//cell2.classList.add('hover');
|
||||
//
|
||||
|
||||
//const trooper1 = soldier.createCounter({ dataset: { allegiance: 'attacker', number: 1, squad: 1 }}, 'blazer');
|
||||
['lmg', 'mmg', 'hmg', 'splaser', 'hsplaser', 'mpppc'].forEach((w, i) => {
|
||||
soldier.place(
|
||||
svg,
|
||||
soldier.createCounter({ dataset: { allegiance: 'attacker', number: i + 1, squad: 1 }}, w),
|
||||
getCell(-3 - i, 9, -6 + i, 0)
|
||||
)
|
||||
});
|
||||
|
||||
['srm', 'hsrm', 'law', 'gl', 'autogl', 'lrrifle'].forEach((w, i) => {
|
||||
soldier.place(
|
||||
svg,
|
||||
soldier.createCounter({ dataset: { allegiance: 'attacker', number: i + 1, squad: 2 }}, w),
|
||||
getCell(-2 - i, 8, -6 + i, 0)
|
||||
)
|
||||
});
|
||||
|
||||
['satchelcharge', 'grenade', 'nonlethalhand', 'lethalhand', 'flamer', 'hflamer', 'inferno'].forEach((w, i) => {
|
||||
soldier.place(
|
||||
svg,
|
||||
soldier.createCounter({ dataset: { allegiance: 'attacker', number: i + 1, squad: 3 }}, w),
|
||||
getCell(-2 - i, 7, -5 + i, 0)
|
||||
)
|
||||
});
|
||||
//const weapon = 'mpppc';
|
||||
//const trooper1 = soldier.createCounter({ dataset: { allegiance: 'attacker', number: 1, squad: 1 }}, weapon);
|
||||
//soldier.place(svg, trooper1, getCell(-3, 9, -6, 0));
|
||||
//
|
||||
|
||||
//soldier.place(
|
||||
// svg,
|
||||
// soldier.createCounter({ dataset: { allegiance: 'defender', number: 1, squad: 1 }}, 'blazer'),
|
||||
|
@ -49,7 +49,121 @@ const weapons = {
|
||||
damage: '4/2/1 L',
|
||||
shortRange: '1-10',
|
||||
longRange: '11-24'
|
||||
}
|
||||
},
|
||||
pistol: {
|
||||
name: 'Pistol',
|
||||
damage: '3L',
|
||||
shortRange: '1-7',
|
||||
longRange: '8-20'
|
||||
},
|
||||
laserpistol: {
|
||||
name: 'Laser Pistol',
|
||||
damage: '4L',
|
||||
shortRange: '1-12',
|
||||
longRange: '13-30'
|
||||
},
|
||||
laserrifle: {
|
||||
name: 'Laser Rifle',
|
||||
damage: '5L',
|
||||
shortRange: '1-17',
|
||||
longRange: '18-105'
|
||||
},
|
||||
gyrojetrifle: {
|
||||
name: 'Gyrojet Rifle',
|
||||
damage: '6L',
|
||||
shortRange: '1-57',
|
||||
longRange: '58-180'
|
||||
},
|
||||
autopistol: {
|
||||
name: 'Auto Pistol',
|
||||
damage: '2L',
|
||||
shortRange: '1-7',
|
||||
longRange: '8-20'
|
||||
},
|
||||
law: {
|
||||
name: 'LAW',
|
||||
damage: '7/3/1 L',
|
||||
shortRange: '1-22',
|
||||
longRange: '23-80'
|
||||
},
|
||||
hsrm: {
|
||||
name: 'Heavy SRM',
|
||||
damage: '13/6/3/1 L',
|
||||
shortRange: '1-54',
|
||||
longRange: '55-96'
|
||||
},
|
||||
gl: {
|
||||
name: 'Grenade Launcher',
|
||||
damage: '4/2/1 L',
|
||||
shortRange: '1-10',
|
||||
longRange: '11-24'
|
||||
},
|
||||
autogl: {
|
||||
name: 'Auto Grenade Launcher',
|
||||
damage: '3/2/1 L',
|
||||
shortRange: '1-22',
|
||||
longRange: '23-50'
|
||||
},
|
||||
lrrifle: {
|
||||
name: 'Light Recoilless Rifle',
|
||||
damage: '4/2/1 L',
|
||||
shortRange: '1-36',
|
||||
longRange: '37-70'
|
||||
},
|
||||
satchelcharge: {
|
||||
name: 'Satchel Charge',
|
||||
damage: '10/5/2 L',
|
||||
shortRange: 'NA',
|
||||
longRange: 'NA'
|
||||
},
|
||||
flamer: {
|
||||
name: 'Flamer',
|
||||
damage: '2/1 L',
|
||||
shortRange: '1-6',
|
||||
longRange: '7-12'
|
||||
},
|
||||
hflamer: {
|
||||
name: 'Heavy Flamer',
|
||||
damage: '2/2/1 L',
|
||||
shortRange: '1-6',
|
||||
longRange: '7-12'
|
||||
},
|
||||
inferno: {
|
||||
name: 'Inferno',
|
||||
damage: '4/2/1 L',
|
||||
shortRange: '1-44',
|
||||
longRange: '45-108'
|
||||
},
|
||||
mmg: {
|
||||
name: 'Medium MG',
|
||||
damage: '6L',
|
||||
shortRange: '1-30',
|
||||
longRange: '31-84'
|
||||
},
|
||||
hmg: {
|
||||
name: 'Heavy MG',
|
||||
damage: '7L',
|
||||
shortRange: '1-36',
|
||||
longRange: '37-110'
|
||||
},
|
||||
splaser: {
|
||||
name: 'Semi-Portable Laser',
|
||||
damage: '11L',
|
||||
shortRange: '1-80',
|
||||
longRange: '81-240'
|
||||
},
|
||||
mpppc: {
|
||||
name: 'Man-Pack PPC',
|
||||
damage: '8L',
|
||||
shortRange: '1-50',
|
||||
longRange: '51-110'
|
||||
},
|
||||
grenade: {
|
||||
name: 'Grenade',
|
||||
damage: '6/3/1 L',
|
||||
shortRange: 'Special',
|
||||
longRange: 'Special'
|
||||
},
|
||||
}
|
||||
|
||||
function createIcon(number) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user