X-Git-Url: https://git.yukkurigames.com/?p=heroik.git;a=blobdiff_plain;f=scenarios.js;h=ce36acc94525936a0557ccbdd07f368e585ed94c;hp=6b05d7c47eb01ed8c174422f7f50936b815310c3;hb=80a48586311bba6aaa1dc6d133f7c5769b17567d;hpb=f0ceb77ec0706a7efac4bee757be88899d0e925f diff --git a/scenarios.js b/scenarios.js index 6b05d7c..ce36acc 100644 --- a/scenarios.js +++ b/scenarios.js @@ -55,11 +55,13 @@ var EVENTS = [ { name: "Epic combat.", effect: "The Final Monster gains a bonus of +3 Strength.", unique: true }, - + { name: "Red herring.", + action: "Shuffle the remaining corridors together and redistribute the cards as if you were setting up the game." }, + // 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,28 +69,24 @@ 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 Fierce.", 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 Supremacy.", requires: ["noncanonical"], unique: true }, + { name: "The torch has gone out.", + action: "The next dungeon card is placed face-down.", }, // Events from Stephane Renard's scenario. // http://docfox.free.fr/spip.php?article129 - { name: "What was that?", - action: "The next dungeon card is placed face-down.", - requires: ["noncanonical"] }, { name: "Malediction.", action: "Discard all quests.", requires: ["noncanonical"], unique: true }, { name: "Reanimation.", - action: "Return a random defeated card to the smallest corridor and shuffle it.", + action: "Return a random spent dungeon card to the smallest corridor and shuffle it. (If you haven't spent any cards, nothing happens.)", requires: ["noncanonical"] }, { name: "Zone of silence.", effect: "Temporary and Ultimate Powers cannot be used until you reveal a new card.", @@ -96,14 +94,14 @@ var EVENTS = [ // Events of my own devising. { name: "Unwanted attention.", - effect: "Unique monsters gain a bonus of +2 Strength.", + effect: "Unique monsters gain a bonus of +1 Strength.", requires: ["noncanonical"], unique: true }, { name: "Spiked the punch.", effect: "Greenskins have 1d8 Strength.", requires: ["noncanonical"], unique: true }, - { name: "Dropped the torch.", + { name: "Lost in the fog.", effect: "After defeating a card, roll a die. On an odd number its replacement is placed face-down.", requires: ["noncanonical"], unique: true }, @@ -115,13 +113,38 @@ var EVENTS = [ action: "Randomly discard four of your defeated dungeon cards.", requires: ["noncanonical"] }, { name: "Adamantine armor.", - effect: "All monsters gain Immunity 1.", + effect: "All monsters gain Immunity 1.", requires: ["noncanonical"], unique: true }, { name: "Normative assumptions.", effect: "Effects concerning ♂ instead concern ♀, and vice versa.", requires: ["noncanonical"], unique: true }, + { name: "Infighting.", + effect: "Greenskins have Undead +1, Demons -1. Demons have Greenskins +1, Undead -1. Undead have Demons +1, Greenskins -1.", + requires: ["noncanonical"], + unique: true }, + { name: "New moon.", + effect: "Demons have Veil of Shadow.", + requires: ["noncanonical", "demons"], + unique: true }, + { name: "Camouflage.", + effect: "Greenskins have Veil of Shadow.", + requires: ["noncanonical"], + unique: true }, + { name: "Cryptic shades.", + effect: "Undead have Veil of Shadow.", + requires: ["noncanonical", "undead"], + unique: true }, + { name: "Lingering smoke.", + effect: "Dragons have Veil of Shadow.", + requires: ["noncanonical", "dragons"], + unique: true }, + { name: "Hypnotizing gaze.", + effect: "Bubbleyes have Veil of Shadow.", + requires: ["noncanonical", "bubbleyes"], + unique: true }, + ]; var NOTHING = { name: "Nothing happens." }; @@ -188,13 +211,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 "" + row + ""; +} + +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) {