draft/mlp/block.go

33 lines
887 B
Go

package mlp
import "git.fromouter.space/mcg/draft"
// BlockPacks returns a pack provider for a block draft
func BlockPacks(block BlockID) (draft.PackProvider, error) {
var setids []SetID
switch block {
case BlockPremiere:
setids = []SetID{SetPremiere, SetCanterlotNights, SetCrystalGames, SetAbsoluteDiscord}
case BlockOdyssey:
setids = []SetID{SetEquestrialOdysseys, SetEquestrialOdysseys, SetHighMagic, SetMarksInTime}
case BlockDefenders:
setids = []SetID{SetFriendsForever, SetDefendersOfEquestria, SetSeaquestriaBeyond, SetFriendsForever}
}
sets := make([]*Set, len(setids))
for i, setid := range setids {
set, err := LoadSetMemory(setid)
if err != nil {
return nil, err
}
sets[i] = set
}
return func() []draft.Pack {
packs := make([]draft.Pack, len(sets))
for i, set := range sets {
packs[i] = draft.MakePack(set)
}
return packs
}, nil
}