diff --git a/public/src/data.js b/public/src/data.js index 7031dbc..d3afd65 100644 --- a/public/src/data.js +++ b/public/src/data.js @@ -1,5 +1,6 @@ export default { expansion: { + "Shadows Over Innistrad": "SOI", "Oath of the Gatewatch": "OGW", "Battle for Zendikar": "BFZ", "Dragons of Tarkir": "DTK", diff --git a/src/_.js b/src/_.js index ae15ebf..23fb91b 100644 --- a/src/_.js +++ b/src/_.js @@ -14,7 +14,7 @@ module.exports = { }, at(arr, index) { var {length} = arr - index = (index % length + length) % length//please kill me it hurts to live + index = (index % length + length) % length return arr[index] }, count(arr, attr) { diff --git a/src/make/cards.js b/src/make/cards.js index 300b9cd..384cab8 100644 --- a/src/make/cards.js +++ b/src/make/cards.js @@ -62,6 +62,12 @@ function before() { || /draft/.test(card.text)) card.rarity = 'special' + for (card of raw.SOI.cards) { + if (card.layout === 'double-faced') { + card.rarity = 'special' + } + } + for (card of raw.FRF.cards) if (card.types[0] === 'Land' && (card.name !== 'Crucible of the Spirit Dragon')) @@ -130,6 +136,50 @@ function after() { 'scorned villager' ] } + var {SOI} = Sets + SOI.special = { + mythic: [ + 'archangel avacyn', + 'startled awake', + 'arlinn kord' + ], + rare: [ + 'hanweir militia captain', + 'thing in the ice', + 'elusive tormentor', + 'geier reach bandit', + 'sage of ancient lore' + ], + uncommon: [ + 'avacynian missionaries', + 'pious evangel', + 'town gossipmonger', + 'aberrant researcher', + 'daring sleuth', + 'uninvited geist', + 'accursed witch', + 'heir of falkenrath', + 'kindly stranger', + 'breakneck rider', + 'kessig forgemaster', + 'skin invasion', + 'village messenger', + 'autumnal gloom', + 'cult of the waxing moon', + 'duskwatch recruiter', + 'hermit of the natterknolls', + 'lambholt pacifist', + 'harvest hand', + 'neglected heirloom', + 'thraben gargoyle' + ], + common: [ + 'convicted killer', + 'gatstaf arsonists', + 'hinterland logger', + 'solitary hunter' + ] + } var {DGM} = Sets DGM.mythic.splice(DGM.mythic.indexOf("maze's end"), 1) DGM.special = { diff --git a/src/pool.js b/src/pool.js index f5c1834..ac2b675 100644 --- a/src/pool.js +++ b/src/pool.js @@ -32,58 +32,85 @@ function toPack(code) { _.choose(1, rare) ) - switch (code) { - case 'DGM': - special = _.rand(20) - ? special.gate - : special.shock - break - case 'MMA': - special = selectRarity(set) - break - case 'MM2': - special = selectRarity(set) - break - case 'VMA': - //http://www.wizards.com/magic/magazine/article.aspx?x=mtg/daily/arcana/1491 - if (_.rand(53)) - special = selectRarity(set) - break - case 'FRF': - special = _.rand(20) - ? special.common - : special.fetch - break - case 'ISD': - //http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4 - //121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common - specialrnd = _.rand(121) - if (specialrnd == 0) - special = special.mythic - else if (specialrnd < 13) - special = special.rare - else if (specialrnd < 55) - special = special.uncommon - else - special = special.common - break - case 'DKA': - //http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4 - //80 card sheet, 2 mythic, 6 rare (8), 24 uncommon (32), 48 common - specialrnd = _.rand(80) - if (specialrnd <= 1) - special = special.mythic - else if (specialrnd < 8) - special = special.rare - else if (specialrnd < 32) - special = special.uncommon - else - special = special.common - break + var special1 + var specialrnd + switch (code) { // the author of this switch should be whipped with a switch + // I have fixed it after quite some time of debugging while + // adding SOI. MUTABILITY IS YOUR ENEMY. + // ~~ @manpages + + case 'DGM': + special1 = _.rand(20) + ? special.gate + : special.shock + break + + case 'MMA': + special1 = selectRarity(set) + break + + case 'MM2': + special1 = selectRarity(set) + break + + case 'VMA': + //http://www.wizards.com/magic/magazine/article.aspx?x=mtg/daily/arcana/1491 + if (_.rand(53)) + special1 = selectRarity(set) + break + + case 'FRF': + special1 = _.rand(20) + ? special.common + : special.fetch + break + + case 'ISD': + //http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4 + //121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common + specialrnd = _.rand(121) + if (specialrnd == 0) + special1 = special.mythic + else if (specialrnd < 13) + special1 = special.rare + else if (specialrnd < 55) + special1 = special.uncommon + else + special1 = special.common + break + + case 'SOI': + // Copied ISD + //121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common + specialrnd = _.rand(121) + if (specialrnd == 0) + special1 = special.mythic + else if (specialrnd < 13) + special1 = special.rare + else if (specialrnd < 55) + special1 = special.uncommon + else + special1 = special.common + break + + case 'DKA': + //http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4 + //80 card sheet, 2 mythic, 6 rare (8), 24 uncommon (32), 48 common + specialrnd = _.rand(80) + if (specialrnd <= 1) + special1 = special.mythic + else if (specialrnd < 8) + special1 = special.rare + else if (specialrnd < 32) + special1 = special.uncommon + else + special1 = special.common + break + } - if (special) - pack.push(_.choose(1, special)) + if (special1) + pack.push(_.choose(1, special1)) return toCards(pack, code) } diff --git a/src/util.js b/src/util.js index 2cf66bf..f7f8f3b 100644 --- a/src/util.js +++ b/src/util.js @@ -23,8 +23,8 @@ function transform(cube, seats, type) { var min = type === 'cube draft' ? seats * cards * packs : seats * 90 - assert(min <= list.length && list.length <= 1e3, - `this cube needs between ${min} and 1000 cards; it has ${list.length}`) + assert(min <= list.length && list.length <= 9e3, + `this cube needs between ${min} and 9000 cards; it has ${list.length}`) var bad = [] for (var cardName of list)