1 import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
2 import { ToggleModule } from './toggle-module/ToggleModule.js';
4 export const gameName = 'Castle-Troll';
6 export const playerColors = [
8 '#22a1e4' // curious blue
11 export const modules = [
16 function ip_shuffle(array) {
17 for (var i = array.length-1; i > 0; i--) {
18 var s = Math.floor((i+1) * Math.random());
19 var selected = array[s];
26 function trollCase(string) {
27 return string.split('')
28 .map(c => Math.random() < 0.5 ? c.toUpperCase() : c.toLowerCase())
32 function trollToggle(toggle, title, def) {
34 obj['toggle'] = toggle;
35 obj['title'] = trollCase(title);
38 for (var i = 3; i < arguments.length; i += 2) indices.push(i);
39 ip_shuffle(indices).forEach(i => obj['values'][trollCase(arguments[i])] = arguments[i+1]);
41 if (def == undefined) {
42 if (obj['values'].length > 2) {
43 obj['default'] = obj['values'].length * Math.floor(2 * Math.random());
46 obj['default'] = Math.random() < 0.5;
49 return ToggleModule.defineToggle(obj);
52 function konamiToggle() {
53 var t = trollToggle.apply(this, arguments);
54 var sequence = [2, 2, 1, 1, 0, 3, 0, 3, 4, 5];
57 if (value === sequence[idx]) {
58 if (++idx >= sequence.length) {
59 ToggleModule.toggles['troll'] = true;
60 ToggleModule.refreshContent();
68 export const options = ip_shuffle ([
69 konamiToggle('troll', "Do not touch this", false,
70 '←', 0, '↓', 1, '↑', 2, '→', 3, 'B', 4, 'A', 5),
71 trollToggle('pants', 'pants', 1 + Math.floor(3 * Math.random()),
72 'red', 1, 'green', 2, 'blue', 3, 'you perv', 4),
73 trollToggle('verboseTrolling', 'Verbose Trolling', true,
74 'on', true, 'off', false),
75 trollToggle('debug', 'Detroll Mode', false,
76 'on', true, 'off', false)