import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
+import { ToggleModule } from './toggle-module/ToggleModule.js';
export const gameName = 'Castle-Troll';
];
export const modules = [
- GraphicEntityModule
+ GraphicEntityModule
+ , ToggleModule
+];
+
+function trollCase(string) {
+ return string.split('')
+ .map(c => c < 64 ? c : String.fromCharCode(c.charCodeAt(0) ^ (32 * (Math.floor(2*Math.random())))))
+ .join('');
+}
+
+function trollToggle(toggle, title, def) {
+ var obj = {};
+ obj['toggle'] = toggle;
+ obj['title'] = trollCase(title);
+ obj['values'] = {};
+ for (var i = 3; i < arguments.length; i += 2) {
+ obj['values'][trollCase(arguments[i])] = arguments[i+1];
+ }
+ obj['default'] = def;
+ if (def == undefined) {
+ if (values.length > 2) {
+ obj['default'] = values.length * Math.floor(2 * Math.random());
+ }
+ else {
+ obj['default'] = Math.random() < 0.5;
+ }
+ }
+ return ToggleModule.defineToggle(obj);
+}
+
+export const options = [
+ trollToggle('verboseTrolling', 'Verbose Trolling', true,
+ 'on', true, 'off', false),
+ trollToggle('debug', 'Detroll Mode', false,
+ 'on', true, 'off', false)
];