From 37ebbef9f57e5252d2e8be333809cc2f60bcd95f Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 29 Mar 2021 09:00:50 -0400 Subject: [PATCH] [STX] added Lesson slot to booster generation --- .../mage/sets/StrixhavenSchoolOfMages.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 8e3f5656dd..b900c6fd51 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -2,8 +2,10 @@ package mage.sets; import mage.cards.Card; import mage.cards.ExpansionSet; +import mage.cards.repository.CardInfo; import mage.constants.Rarity; import mage.constants.SetType; +import mage.constants.SubType; import mage.util.RandomUtil; import java.util.List; @@ -24,7 +26,6 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { this.blockName = "Strixhaven: School of Mages"; this.hasBoosters = true; this.hasBasicLands = true; - this.numBoosterLands = 1; this.numBoosterCommon = 9; this.numBoosterUncommon = 3; this.numBoosterRare = 1; @@ -84,8 +85,14 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { @Override public List tryBooster() { - // Boosters have one card from STA, odds are 2/3 for uncommon, 4/15 for rare, 1/15 for mythic List booster = super.tryBooster(); + addArchive(booster); + addLesson(booster); + return booster; + } + + private void addArchive(List booster) { + // Boosters have one card from STA, odds are 2/3 for uncommon, 4/15 for rare, 1/15 for mythic final Rarity rarity; int i = RandomUtil.nextInt(15); if (i == 14) { @@ -96,6 +103,28 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { rarity = Rarity.UNCOMMON; } addToBooster(booster, StrixhavenMysticalArchive.getInstance().getCardsByRarity(rarity)); - return booster; + } + + private void addLesson(List booster) { + // Boosters have one Lesson card + final Rarity rarity; + int i = RandomUtil.nextInt(15); + if (i == 14) { // TODO: change this when correct ratio is known + rarity = Rarity.MYTHIC; + } else if (i >= 10) { + rarity = Rarity.RARE; + } else { + rarity = Rarity.COMMON; + } + List cards = super.getCardsByRarity(rarity); + cards.removeIf(cardInfo -> !cardInfo.getCard().hasSubtype(SubType.LESSON, null)); + addToBooster(booster, cards); + } + + @Override + public List getCardsByRarity(Rarity rarity) { + List cards = super.getCardsByRarity(rarity); + cards.removeIf(cardInfo -> cardInfo.getCard().hasSubtype(SubType.LESSON, null)); + return cards; } }