diff options
| -rw-r--r-- | shuffle/main.go | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/shuffle/main.go b/shuffle/main.go index fb178b6..53a9d2c 100644 --- a/shuffle/main.go +++ b/shuffle/main.go @@ -13,11 +13,14 @@ import ( ) func main() { - cards_f := flag.String("c", "../cards.json", "Path to json file with all cards.") - d_sets_f := flag.String("d", "", "Disabled Sets. (comma separated)") - o_sets_f := flag.String("o", "", "Only play with this sets. (comma separated)") + cards_f := flag.String("f", "../cards.json", "Path to json file with all cards.") + count_f := flag.Int("c", 10, "Number of cards.") + d_sets_f := flag.String("d", "", "Do not play with these sets. (comma separated)") + o_sets_f := flag.String("o", "", "Only play with these sets. (comma separated)") list_f := flag.Bool("l", false, "List all available sets.") expired_f := flag.Bool("v1", false, "Play with (officially removed) cards (from the first edition)") + event_f := flag.Bool("e", false, "Pick only events.") + landmark_f := flag.Bool("v", false, "Pick only landmarks.") flag.Parse() @@ -48,15 +51,15 @@ func main() { return } - for i := 0; i < 10; i++ { + for i := 0; i < *count_f; i++ { - v := get_card(cards, picked, sets, d_sets, *expired_f) + v := get_card(cards, picked, sets, d_sets, *expired_f, *event_f, *landmark_f) picked[v.Name] = true if v.Name_de == "Junge Hexe" { bane_card_needed = true for { - bane_card = get_card(cards, picked, sets, d_sets, *expired_f) + bane_card = get_card(cards, picked, sets, d_sets, *expired_f, *event_f, *landmark_f) if bane_card.Cost.Coin == 2 || bane_card.Cost.Coin == 3 { picked[bane_card.Name] = true break @@ -71,13 +74,20 @@ func main() { } } -func get_card(cards []Card, picked map[string]bool, sets []string, d_sets []string, v1 bool) Card { +func get_card(cards []Card, picked map[string]bool, sets []string, d_sets []string, v1 bool, event, landmark bool) Card { for { r := rand.New(rand.NewSource(time.Now().UnixNano())) rndm := r.Int() % len(cards) - if !cards[rndm].IsKingdom { + if event && (cards[rndm].Type != "Event") { + continue + } + if landmark && (cards[rndm].Type != "Landmark") { + continue + } + + if !event && !landmark && !cards[rndm].IsKingdom { continue } if v1 { |
