diff --git a/script.js b/script.js index 594327b..dfea0ef 100644 --- a/script.js +++ b/script.js @@ -630,6 +630,8 @@ class Board { this.buttons.optFancy = this.addButton(x0, cfgy0, 'Effects:', '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.btnAbout = this.addButton(x0, cfgy0+ysp2*-1.5, 'About', 'config'); } updateSettingsGUI(cfg) { @@ -712,6 +714,7 @@ class SettingsStorage { attemptTemplates: 50, svgEffects: false, dimBlocked: true, + logSolution: false, }; 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'); @@ -1460,6 +1463,7 @@ class Game { this.nextMetal = item.nextMetal; for (let entry of item.orbs) { + this.debug(`Undo orb ${entry.symbol} at ${entry.n}`); this.board.placeOrbByIndex(entry.n, entry.symbol); } @@ -1562,32 +1566,45 @@ class Game { */ installButtonHandlers() { this.board.buttons.restart.addEventListener('click', () => { + this.info("New Game with the same seed"); this.newGame(this.rng.seed); }); this.board.buttons.randomize.addEventListener('click', () => { + this.info("New Game with a random seed"); 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', () => { if (this.undoStack.length) { this.undo(); + } else { + this.warn("Nothing to undo."); } }); this.board.buttons.optFancy.addEventListener('click', () => { + this.info("Toggle effects"); this.setCfg({ svgEffects: !this.cfg.svgEffects, }) }); this.board.buttons.optBlockedEffect.addEventListener('click', () => { + this.info("Toggle blocked dim"); this.setCfg({ dimBlocked: !this.cfg.dimBlocked, }) }); this.board.buttons.optSloppy.addEventListener('click', () => { + this.info("Toggle sloppy placement mode"); this.setCfg({ allowTemplateAugmenting: !this.cfg.allowTemplateAugmenting, }) @@ -1686,19 +1703,21 @@ class Game { `teplate "${board_info.template.name}"` + (this.cfg.allowTemplateAugmenting ? ` with ${board_info.tilesAdded} extra tiles` : '')); - this.info('Reference solution:\n ' + board_info.solution.reduce((s, entry, i) => { - s += `${entry[0]} ${entry[1]}`; + if (this.cfg.logSolution) { + this.info('Reference solution:\n ' + board_info.solution.reduce((s, entry, i) => { + s += `${entry[0]} ${entry[1]}`; - if (i % 2 === 1) { - s += "\n "; - } else { - if (entry[0] !== 'gold') { - s += " + "; + if (i % 2 === 1) { + s += "\n "; + } else { + if (entry[0] !== 'gold') { + s += " + "; + } } - } - return s; - }, '')); + return s; + }, '')); + } } } } diff --git a/style.css b/style.css index 6c72461..a31cd79 100644 --- a/style.css +++ b/style.css @@ -125,6 +125,10 @@ html, body { font-size: 26px; } +.button-text.right { + text-anchor: end; +} + .button-text:hover { fill: #e3c4a2; }