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 trollCase(string) {
17 return string.split('')
18 .map(c => c < 64 ? c : String.fromCharCode(c.charCodeAt(0) ^ (32 * (Math.floor(2*Math.random())))))
22 function trollToggle(toggle, title, def) {
24 obj['toggle'] = toggle;
25 obj['title'] = trollCase(title);
27 for (var i = 3; i < arguments.length; i += 2) {
28 obj['values'][trollCase(arguments[i])] = arguments[i+1];
31 if (def == undefined) {
32 if (obj['values'].length > 2) {
33 obj['default'] = obj['values'].length * Math.floor(2 * Math.random());
36 obj['default'] = Math.random() < 0.5;
39 return ToggleModule.defineToggle(obj);
42 export const options = [
43 // TODO: detroll this a bit
44 trollToggle('konami', 'unused', undefined,
45 '←', 0, '↓', 1, '↑', 2, '→', 3, 'B', 4, 'A', 5),
46 trollToggle('pants', 'pants', 1 + Math.floor(3 * Math.random()),
47 'red', 1, 'green', 2, 'blue', 3, 'you perv', 4),
48 trollToggle('verboseTrolling', 'Verbose Trolling', true,
49 'on', true, 'off', false),
50 trollToggle('debug', 'Detroll Mode', false,
51 'on', true, 'off', false)
54 for (var i = options.length-1; i > 1; i--) {
55 var s = Math.floor((i+1) * Math.random());
56 var selected = options[s];
57 options[s] = options[i];
58 options[i] = selected;