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

Commit a4301a3

Browse files
committed
Add SOI, tiny refactoring, increase max cube cards
1 parent 252512f commit a4301a3

File tree

5 files changed

+131
-53
lines changed

5 files changed

+131
-53
lines changed

public/src/data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export default {
22
expansion: {
3+
"Shadows Over Innistrad": "SOI",
34
"Oath of the Gatewatch": "OGW",
45
"Battle for Zendikar": "BFZ",
56
"Dragons of Tarkir": "DTK",

src/_.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
},
1515
at(arr, index) {
1616
var {length} = arr
17-
index = (index % length + length) % length//please kill me it hurts to live
17+
index = (index % length + length) % length
1818
return arr[index]
1919
},
2020
count(arr, attr) {

src/make/cards.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ function before() {
6262
|| /draft/.test(card.text))
6363
card.rarity = 'special'
6464

65+
for (card of raw.SOI.cards) {
66+
if (card.layout === 'double-faced') {
67+
card.rarity = 'special'
68+
}
69+
}
70+
6571
for (card of raw.FRF.cards)
6672
if (card.types[0] === 'Land'
6773
&& (card.name !== 'Crucible of the Spirit Dragon'))
@@ -130,6 +136,50 @@ function after() {
130136
'scorned villager'
131137
]
132138
}
139+
var {SOI} = Sets
140+
SOI.special = {
141+
mythic: [
142+
'archangel avacyn',
143+
'startled awake',
144+
'arlinn kord'
145+
],
146+
rare: [
147+
'hanweir militia captain',
148+
'thing in the ice',
149+
'elusive tormentor',
150+
'geier reach bandit',
151+
'sage of ancient lore'
152+
],
153+
uncommon: [
154+
'avacynian missionaries',
155+
'pious evangel',
156+
'town gossipmonger',
157+
'aberrant researcher',
158+
'daring sleuth',
159+
'uninvited geist',
160+
'accursed witch',
161+
'heir of falkenrath',
162+
'kindly stranger',
163+
'breakneck rider',
164+
'kessig forgemaster',
165+
'skin invasion',
166+
'village messenger',
167+
'autumnal gloom',
168+
'cult of the waxing moon',
169+
'duskwatch recruiter',
170+
'hermit of the natterknolls',
171+
'lambholt pacifist',
172+
'harvest hand',
173+
'neglected heirloom',
174+
'thraben gargoyle'
175+
],
176+
common: [
177+
'convicted killer',
178+
'gatstaf arsonists',
179+
'hinterland logger',
180+
'solitary hunter'
181+
]
182+
}
133183
var {DGM} = Sets
134184
DGM.mythic.splice(DGM.mythic.indexOf("maze's end"), 1)
135185
DGM.special = {

src/pool.js

Lines changed: 77 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,85 @@ function toPack(code) {
3232
_.choose(1, rare)
3333
)
3434

35-
switch (code) {
36-
case 'DGM':
37-
special = _.rand(20)
38-
? special.gate
39-
: special.shock
40-
break
41-
case 'MMA':
42-
special = selectRarity(set)
43-
break
44-
case 'MM2':
45-
special = selectRarity(set)
46-
break
47-
case 'VMA':
48-
//http://www.wizards.com/magic/magazine/article.aspx?x=mtg/daily/arcana/1491
49-
if (_.rand(53))
50-
special = selectRarity(set)
51-
break
52-
case 'FRF':
53-
special = _.rand(20)
54-
? special.common
55-
: special.fetch
56-
break
57-
case 'ISD':
58-
//http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4
59-
//121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common
60-
specialrnd = _.rand(121)
61-
if (specialrnd == 0)
62-
special = special.mythic
63-
else if (specialrnd < 13)
64-
special = special.rare
65-
else if (specialrnd < 55)
66-
special = special.uncommon
67-
else
68-
special = special.common
69-
break
70-
case 'DKA':
71-
//http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4
72-
//80 card sheet, 2 mythic, 6 rare (8), 24 uncommon (32), 48 common
73-
specialrnd = _.rand(80)
74-
if (specialrnd <= 1)
75-
special = special.mythic
76-
else if (specialrnd < 8)
77-
special = special.rare
78-
else if (specialrnd < 32)
79-
special = special.uncommon
80-
else
81-
special = special.common
82-
break
35+
var special1
36+
var specialrnd
37+
switch (code) { // the author of this switch should be whipped with a switch
38+
// I have fixed it after quite some time of debugging while
39+
// adding SOI. MUTABILITY IS YOUR ENEMY.
40+
// ~~ @manpages
41+
42+
case 'DGM':
43+
special1 = _.rand(20)
44+
? special.gate
45+
: special.shock
46+
break
47+
48+
case 'MMA':
49+
special1 = selectRarity(set)
50+
break
51+
52+
case 'MM2':
53+
special1 = selectRarity(set)
54+
break
55+
56+
case 'VMA':
57+
//http://www.wizards.com/magic/magazine/article.aspx?x=mtg/daily/arcana/1491
58+
if (_.rand(53))
59+
special1 = selectRarity(set)
60+
break
61+
62+
case 'FRF':
63+
special1 = _.rand(20)
64+
? special.common
65+
: special.fetch
66+
break
67+
68+
case 'ISD':
69+
//http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4
70+
//121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common
71+
specialrnd = _.rand(121)
72+
if (specialrnd == 0)
73+
special1 = special.mythic
74+
else if (specialrnd < 13)
75+
special1 = special.rare
76+
else if (specialrnd < 55)
77+
special1 = special.uncommon
78+
else
79+
special1 = special.common
80+
break
81+
82+
case 'SOI':
83+
// Copied ISD
84+
//121 card sheet, 1 mythic, 12 rare (13), 42 uncommon (55), 66 common
85+
specialrnd = _.rand(121)
86+
if (specialrnd == 0)
87+
special1 = special.mythic
88+
else if (specialrnd < 13)
89+
special1 = special.rare
90+
else if (specialrnd < 55)
91+
special1 = special.uncommon
92+
else
93+
special1 = special.common
94+
break
95+
96+
case 'DKA':
97+
//http://www.mtgsalvation.com/forums/magic-fundamentals/magic-general/327956-innistrad-block-transforming-card-pack-odds?comment=4
98+
//80 card sheet, 2 mythic, 6 rare (8), 24 uncommon (32), 48 common
99+
specialrnd = _.rand(80)
100+
if (specialrnd <= 1)
101+
special1 = special.mythic
102+
else if (specialrnd < 8)
103+
special1 = special.rare
104+
else if (specialrnd < 32)
105+
special1 = special.uncommon
106+
else
107+
special1 = special.common
108+
break
109+
83110
}
84111

85-
if (special)
86-
pack.push(_.choose(1, special))
112+
if (special1)
113+
pack.push(_.choose(1, special1))
87114

88115
return toCards(pack, code)
89116
}

src/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function transform(cube, seats, type) {
2323
var min = type === 'cube draft'
2424
? seats * cards * packs
2525
: seats * 90
26-
assert(min <= list.length && list.length <= 1e3,
27-
`this cube needs between ${min} and 1000 cards; it has ${list.length}`)
26+
assert(min <= list.length && list.length <= 9e3,
27+
`this cube needs between ${min} and 9000 cards; it has ${list.length}`)
2828

2929
var bad = []
3030
for (var cardName of list)

0 commit comments

Comments
 (0)