Thyss / pack1pick1

0 stars 2 forks source link

WAR pack has 4 uncommons #7

Open Meerkov opened 4 years ago

Meerkov commented 4 years ago

https://scryfall.com/search?unique=cards&as=grid&order=rarity&q=!Arboreal-Grazer+e%3Awar+or+!Honor-the-God-Pharaoh+e%3Awar+or+!Arlinn%27s-Wolf+e%3Awar+or+!Loxodon-Sergeant+e%3Awar+or+!Martyr-for-the-Cause+e%3Awar+or+!Kiora%27s-Dambreaker+e%3Awar+or+!Chainwhip-Cyclops+e%3Awar+or+!Defiant-Strike+e%3Awar+or+!Lazotep-Reaver+e%3Awar+or+!Cruel-Celebrant+e%3Awar+or+!Price-of-Betrayal+e%3Awar+or+!Lazotep-Plating+e%3Awar+or+!Feather,-the-Redeemed+e%3Awar+or+!Angrath,-Captain-of-Chaos+e%3Awar+or+!Mountain+e%3Awar

WAR pack is generated incorrectly.

This code is wrong:

if (setTag == "war") {
            booster = this.replaceBasicWithCard(set, "Planeswalker", booster);
        }

Instead, it probably should do something like: Generate a booster. If it has 0 planeswalkers, regenerate it. I think that's not perfect either, but it's much closer to correct.

Thyss commented 2 years ago

Seems to be accurate, from my testing about 3/10 packs had 4 uncommons.

var containsCorrectCard = false;
for (card of booster) {
    if (card.type_line.includes("planeswalker") && !containsCorrectCard) {
        containsCorrectCard = true;
        break;
    }
}

I think this should suffice and then check the containsCorrectCard" variable before replacing anything.