Event reference.
[heroik.git] / scenarios.js
index dfef81a..25baf66 100644 (file)
@@ -59,7 +59,7 @@ var EVENTS = [
     // Events from Sean Allen's random scenario generator.
     // http://boardgamegeek.com/filepage/57107/random-scenario-generator
     { name: "Fire from above.",
-      effect: "Dragons gains a bonus of +1 Strength.",
+      effect: "Dragons gain a bonus of +1 Strength.",
       requires: ["dragons", "noncanonical"],
       unique: true },
     { name: "Bad dreams.",
@@ -67,14 +67,14 @@ var EVENTS = [
       requires: ["noncanonical"],
       unique: true },
     { name: "Backs against the wall.",
-      effect: "Any monster with a Tenacity token is also Fierce.",
+      effect: "Any monster with a Tenacity token is also <strong>Fierce</strong>.",
       requires: ["noncanonical"],
       unique: true },
     { name: "Dead end.",
       action: "Shuffle the remaining corridors together and redistribute the cards as if you were setting up the game.",
       requires: ["noncanonical"] },
     { name: "Surrounded.",
-      effect: "All monsters have Supremacy.",
+      effect: "All monsters have <strong>Supremacy</strong>.",
       requires: ["noncanonical"],
       unique: true },
 
@@ -115,13 +115,17 @@ var EVENTS = [
       action: "Randomly discard four of your defeated dungeon cards.",
       requires: ["noncanonical"] },
     { name: "Adamantine armor.",
-      effect: "All monsters gain Immunity&nbsp;1.",
+      effect: "All monsters gain <strong>Immunity&nbsp;1</strong>.",
       requires: ["noncanonical"],
       unique: true },
     { name: "Normative assumptions.",
       effect: "Effects concerning ♂ instead concern ♀, and vice versa.",
       requires: ["noncanonical"],
       unique: true },
+    { name: "Infighting.",
+      effect: "Greenskins have <strong>Undead&nbsp;+1</strong>, <strong>Demons&nbsp;-1</strong>. Demons have <strong>Greenskins&nbsp;+1</strong>, <strong>Undead&nbsp;-1</strong>. Undead have <strong>Demons&nbsp;+1</strong>, <strong>Greenskins&nbsp;-1</strong>.",
+      requires: ["noncanonical"],
+      unique: true },
 ];
 
 var NOTHING = { name: "Nothing happens." };
@@ -188,13 +192,39 @@ function randomizeName () {
 
 var events = [];
 var style;
-window.addEventListener('DOMContentLoaded', function () {
+
+function generateScenario () {
     var parts = location.hash.slice(1).split(',');
     events = generate(parts, parts.shift() | 0, parts.shift() | 0);
     style = document.createElement("style");
     document.head.appendChild(style);
     randomizeName();
-});
+}
+
+function getEvents (matcher) {
+    return EVENTS.filter(matcher);
+}
+
+function wrapRow (row) {
+    return "<tr><td>" + row + "</td></tr>";
+}
+
+function iscanonical (event) {
+    return !isnoncanonical(event);
+}
+function isnoncanonical (event) {
+    return ~(event.requires || []).indexOf('noncanonical');
+}
+
+function canonicalToHTML (sender) {
+    sender.innerHTML = EVENTS.filter(iscanonical)
+        .map(toHTML).sort().map(wrapRow).join('');
+}
+
+function noncanonicalToHTML (sender) {
+    sender.innerHTML = EVENTS.filter(isnoncanonical)
+        .map(toHTML).sort().map(wrapRow).join('');
+}
 
 function nextEvent (sender) {
     if (!events.length) {