diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2021-12-12 15:40:01 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2021-12-12 15:40:01 +0100 |
| commit | f978ec238401d4682e55ec99ef17fd5408aaf32e (patch) | |
| tree | 0015e83de44a47bfcf9790c784b279a8bb7a295f /html | |
| parent | 8b56d52a5604d5429cc14208394402cc2335c52f (diff) | |
| download | muhqs-game-f978ec238401d4682e55ec99ef17fd5408aaf32e.tar.gz muhqs-game-f978ec238401d4682e55ec99ef17fd5408aaf32e.zip | |
html/tools: add tyrant random house tool
Diffstat (limited to 'html')
| -rw-r--r-- | html/tools.html | 32 |
1 files changed, 31 insertions, 1 deletions
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 { </head> <body> +<h2>General tools</h2> <div> <form id="random_number_form"> Random number @@ -210,6 +231,15 @@ Random tile within Range </form> </div> +<h2>The tyrant tools</h2> + +<div> +<form id="random_house_tyrant_form"> +Random house tile + <input id="random_house_tyrant_button" value="generate" type="submit"> +</form> +</div> + <div id="result"> </div> |
