Java Code Examples for com.megacrit.cardcrawl.cards.CardGroup#isEmpty()

The following examples show how to use com.megacrit.cardcrawl.cards.CardGroup#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrideMemory.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onVictory() {
    if (isPassiveEffectActive()) {
        CardGroup masterDeckCandidates = new CardGroup(CardGroup.CardGroupType.UNSPECIFIED);
        for (AbstractCard c : AbstractDungeon.player.masterDeck.group) {
            if (c.canUpgrade()) {
                masterDeckCandidates.addToBottom(c);
            }
        }

        if (!masterDeckCandidates.isEmpty()) {
            AbstractCard masterDeckCard = masterDeckCandidates.getRandomCard(AbstractDungeon.cardRandomRng);
            masterDeckCard.upgrade();
            masterDeckCard.superFlash();
            EffectUtils.addPermanentCardUpgradeEffect(masterDeckCard);
        }
    }
}
 
Example 2
Source File: ConsumeRandomCardAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    CardGroup candidateCards = CardGroup.getGroupWithoutBottledCards(pileToConsumeFrom.getPurgeableCards());
    if (!candidateCards.isEmpty()) {
        AbstractCard randomlyChosenCard = candidateCards.getRandomCard(AbstractDungeon.cardRandomRng);
        addToTop(new ConsumeCardAction(randomlyChosenCard));
    }
    isDone = true;
}
 
Example 3
Source File: MaterialComponentsDeck.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private static void drawCardsFromPoolToDeck(int count, CardGroup pool, Runnable poolResetFunction) {
    for (int i = 0; i < count; ++i) {
        if (pool.isEmpty()) {
            poolResetFunction.run();
        }
        deck.addToTop(pool.getTopCard());
        pool.removeTopCard();
    }
}