|
|
@ -630,6 +630,8 @@ class Board { |
|
|
|
this.buttons.optFancy = this.addButton(x0, cfgy0, 'Effects:', 'config'); |
|
|
|
this.buttons.optFancy = this.addButton(x0, cfgy0, 'Effects:', 'config'); |
|
|
|
this.buttons.optBlockedEffect = this.addButton(x0, cfgy0+ysp2, 'Dim Blocked:', 'config'); |
|
|
|
this.buttons.optBlockedEffect = this.addButton(x0, cfgy0+ysp2, 'Dim Blocked:', 'config'); |
|
|
|
this.buttons.optSloppy = this.addButton(x0, cfgy0+ysp2*2, 'Sloppy Mode:', 'config'); |
|
|
|
this.buttons.optSloppy = this.addButton(x0, cfgy0+ysp2*2, 'Sloppy Mode:', 'config'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.buttons.btnAbout = this.addButton(x0, cfgy0+ysp2*-1.5, 'About', 'config'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateSettingsGUI(cfg) { |
|
|
|
updateSettingsGUI(cfg) { |
|
|
@ -712,6 +714,7 @@ class SettingsStorage { |
|
|
|
attemptTemplates: 50, |
|
|
|
attemptTemplates: 50, |
|
|
|
svgEffects: false, |
|
|
|
svgEffects: false, |
|
|
|
dimBlocked: true, |
|
|
|
dimBlocked: true, |
|
|
|
|
|
|
|
logSolution: false, |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.settings = Object.assign({}, this.defaults); |
|
|
|
this.settings = Object.assign({}, this.defaults); |
|
|
|
} |
|
|
|
} |
|
|
@ -1193,7 +1196,7 @@ class Game { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
throw Error("Failed to find available tile"); |
|
|
|
throw Error("Failed to find available board tile."); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
place(60, 'gold'); |
|
|
|
place(60, 'gold'); |
|
|
@ -1460,6 +1463,7 @@ class Game { |
|
|
|
|
|
|
|
|
|
|
|
this.nextMetal = item.nextMetal; |
|
|
|
this.nextMetal = item.nextMetal; |
|
|
|
for (let entry of item.orbs) { |
|
|
|
for (let entry of item.orbs) { |
|
|
|
|
|
|
|
this.debug(`Undo orb ${entry.symbol} at ${entry.n}`); |
|
|
|
this.board.placeOrbByIndex(entry.n, entry.symbol); |
|
|
|
this.board.placeOrbByIndex(entry.n, entry.symbol); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1562,32 +1566,45 @@ class Game { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
installButtonHandlers() { |
|
|
|
installButtonHandlers() { |
|
|
|
this.board.buttons.restart.addEventListener('click', () => { |
|
|
|
this.board.buttons.restart.addEventListener('click', () => { |
|
|
|
|
|
|
|
this.info("New Game with the same seed"); |
|
|
|
this.newGame(this.rng.seed); |
|
|
|
this.newGame(this.rng.seed); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.randomize.addEventListener('click', () => { |
|
|
|
this.board.buttons.randomize.addEventListener('click', () => { |
|
|
|
|
|
|
|
this.info("New Game with a random seed"); |
|
|
|
this.newGame(+new Date); |
|
|
|
this.newGame(+new Date); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.btnAbout.addEventListener('click', () => { |
|
|
|
|
|
|
|
let url = 'https://git.ondrovo.com/MightyPork/sigmar'; |
|
|
|
|
|
|
|
this.info(`Opening docs page in new tab: ${url}`); |
|
|
|
|
|
|
|
window.open(url); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.undo.addEventListener('click', () => { |
|
|
|
this.board.buttons.undo.addEventListener('click', () => { |
|
|
|
if (this.undoStack.length) { |
|
|
|
if (this.undoStack.length) { |
|
|
|
this.undo(); |
|
|
|
this.undo(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.warn("Nothing to undo."); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.optFancy.addEventListener('click', () => { |
|
|
|
this.board.buttons.optFancy.addEventListener('click', () => { |
|
|
|
|
|
|
|
this.info("Toggle effects"); |
|
|
|
this.setCfg({ |
|
|
|
this.setCfg({ |
|
|
|
svgEffects: !this.cfg.svgEffects, |
|
|
|
svgEffects: !this.cfg.svgEffects, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.optBlockedEffect.addEventListener('click', () => { |
|
|
|
this.board.buttons.optBlockedEffect.addEventListener('click', () => { |
|
|
|
|
|
|
|
this.info("Toggle blocked dim"); |
|
|
|
this.setCfg({ |
|
|
|
this.setCfg({ |
|
|
|
dimBlocked: !this.cfg.dimBlocked, |
|
|
|
dimBlocked: !this.cfg.dimBlocked, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.board.buttons.optSloppy.addEventListener('click', () => { |
|
|
|
this.board.buttons.optSloppy.addEventListener('click', () => { |
|
|
|
|
|
|
|
this.info("Toggle sloppy placement mode"); |
|
|
|
this.setCfg({ |
|
|
|
this.setCfg({ |
|
|
|
allowTemplateAugmenting: !this.cfg.allowTemplateAugmenting, |
|
|
|
allowTemplateAugmenting: !this.cfg.allowTemplateAugmenting, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -1686,19 +1703,21 @@ class Game { |
|
|
|
`teplate "${board_info.template.name}"` + |
|
|
|
`teplate "${board_info.template.name}"` + |
|
|
|
(this.cfg.allowTemplateAugmenting ? ` with ${board_info.tilesAdded} extra tiles` : '')); |
|
|
|
(this.cfg.allowTemplateAugmenting ? ` with ${board_info.tilesAdded} extra tiles` : '')); |
|
|
|
|
|
|
|
|
|
|
|
this.info('Reference solution:\n ' + board_info.solution.reduce((s, entry, i) => { |
|
|
|
if (this.cfg.logSolution) { |
|
|
|
s += `${entry[0]} ${entry[1]}`; |
|
|
|
this.info('Reference solution:\n ' + board_info.solution.reduce((s, entry, i) => { |
|
|
|
|
|
|
|
s += `${entry[0]} ${entry[1]}`; |
|
|
|
|
|
|
|
|
|
|
|
if (i % 2 === 1) { |
|
|
|
if (i % 2 === 1) { |
|
|
|
s += "\n "; |
|
|
|
s += "\n "; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (entry[0] !== 'gold') { |
|
|
|
if (entry[0] !== 'gold') { |
|
|
|
s += " + "; |
|
|
|
s += " + "; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s; |
|
|
|
return s; |
|
|
|
}, '')); |
|
|
|
}, '')); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|