Skip to content
This repository has been archived by the owner on Aug 4, 2018. It is now read-only.

Commit

Permalink
Add SOI, tiny refactoring, increase max cube cards
Browse files Browse the repository at this point in the history
  • Loading branch information
manpages committed Apr 29, 2016
1 parent 252512f commit a4301a3
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 53 deletions.
1 change: 1 addition & 0 deletions public/src/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
expansion: {
"Shadows Over Innistrad": "SOI",
"Oath of the Gatewatch": "OGW",
"Battle for Zendikar": "BFZ",
"Dragons of Tarkir": "DTK",
Expand Down
2 changes: 1 addition & 1 deletion src/_.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
50 changes: 50 additions & 0 deletions src/make/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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 = {
Expand Down
127 changes: 77 additions & 50 deletions src/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4301a3

Please sign in to comment.