Add ability to deactivate/reactivate soldier records; make hex clearing work with right-click and add a confirmation modal dialog
This commit is contained in:
@@ -145,7 +145,7 @@ async function load() {
|
||||
document.querySelectorAll('.end-turn').forEach(el =>
|
||||
el.addEventListener('click', ({ target: { dataset: { allegiance: opponent }}}) => {
|
||||
const dataSelector = `[data-allegiance="${opponent}"]`,
|
||||
opponentRecords = Array.from(document.querySelectorAll(`.soldier-record${dataSelector}`)),
|
||||
opponentRecords = Array.from(document.querySelectorAll(`.soldier-record${dataSelector}:not(.inactive)`)),
|
||||
firstOpponentRecord = opponentRecords.sort((el1, el2) => el1.dataset.number > el2.dataset.number).at(0);
|
||||
|
||||
el.setAttribute('disabled', '');
|
||||
@@ -154,7 +154,11 @@ document.querySelectorAll('.end-turn').forEach(el =>
|
||||
clearMoveEndedIndicators(opponentRecords);
|
||||
|
||||
gameboard.clearFiringArcs(opponent);
|
||||
Observable.notify('select', firstOpponentRecord);
|
||||
|
||||
if (firstOpponentRecord) {
|
||||
Observable.notify('select', firstOpponentRecord);
|
||||
firstOpponentRecord.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user