From f978ec238401d4682e55ec99ef17fd5408aaf32e Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 12 Dec 2021 15:40:01 +0100 Subject: html/tools: add tyrant random house tool --- html/tools.html | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'html') diff --git a/html/tools.html b/html/tools.html index 5137e6ad..2b47f21c 100644 --- a/html/tools.html +++ b/html/tools.html @@ -77,6 +77,19 @@ body { for the JavaScript code in this page. */ + // List of houses on the tyrant map + let tyrantHouses = Array( + {x:1, y:1}, {x:4, y:1}, {x:5, y:1}, {x:8, y:1}, {x:15, y:1}, + {x:3, y:2}, {x:6, y:2}, {x:12, y:2}, {x:13, y:2}, {x:14, y:2}, + {x:2, y:3}, {x:14, y:3}, + {x:2, y:4}, {x:5, y:4}, {x:10, y:4}, + {x:3, y:5}, {x:6, y:4}, {x:9, y:4}, + {x:7, y:6}, {x:10, y:6}, + {x:13, y:10}, + {x:4, y:11}, + {x:3, y:15}, {x:9, y:15}, {x:14, y:15}, + ); + // return a random number between 1 and max function randomInt(max) { return Math.floor(Math.random() * Number(max)) + 1; @@ -168,7 +181,14 @@ body { result.innerHTML = ""; result.appendChild(range_div); - // TODO select random tile + return false; + } + + document.getElementById("random_house_tyrant_form").onsubmit = function() { + let idx = Math.floor(Math.random() * tyrantHouses.length); + let house = tyrantHouses[idx]; + result.innerHTML = "Random house: " + (idx + 1) + " at (x:" + house.x + ", y:" + + house.y + ")"; return false; } }); @@ -177,6 +197,7 @@ body { +

General tools

Random number @@ -210,6 +231,15 @@ Random tile within Range
+

The tyrant tools

+ +
+
+Random house tile + +
+
+
-- cgit v1.2.3