Java Code Examples for com.megacrit.cardcrawl.cards.AbstractCard#hasTag()

The following examples show how to use com.megacrit.cardcrawl.cards.AbstractCard#hasTag() . 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: CardLegendaryFramePatch.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@SpirePrefixPatch
public static SpireReturn Prefix(AbstractCard __this, SpriteBatch sb, float x, float y) {
    if (__this.hasTag(LEGENDARY)) {
        RenderUtils.renderAtlasRegionCenteredAt(
                sb,
                legendaryFrameImg512,
                x,
                y,
                __this.drawScale * Settings.scale,
                ReflectionUtils.getPrivateField(__this, AbstractCard.class, "renderColor"),
                __this.angle);

        return SpireReturn.Return(null);
    }
    return SpireReturn.Continue();
}
 
Example 2
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static RewardItem rerollRewardsIfDupeLegendary(RewardItem item, ArrayList<RewardItem> existingRewardItems) {
    HashSet<String> existingCardRewardIds = new HashSet<>();
    for (RewardItem existingRewardItem : existingRewardItems) {
        if (existingRewardItem.type == RewardItem.RewardType.CARD) {
            existingRewardItem.cards.forEach(c -> existingCardRewardIds.add(c.cardID));
        }
    }
    if (existingCardRewardIds.size() > 0) {
        boolean hasLegendaryDupe;
        do {
            hasLegendaryDupe = false;
            for (AbstractCard card : item.cards) {
                if (card.hasTag(LEGENDARY) && existingCardRewardIds.contains(card.cardID)) {
                    // reroll and check the new reward items
                    hasLegendaryDupe = true;
                    item = new RewardItem();
                    break;
                }
            }
        } while(hasLegendaryDupe);
    }
    return item;
}
 
Example 3
Source File: ShrapnelBloomPower.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onUseCard(AbstractCard card, UseCardAction action) {
    if (!card.purgeOnUse && this.amount > 0 && !card.hasTag(LEGENDARY)) {
        this.flash();

        action.exhaustCard = true; // this is what corruption does
        SelfExertField.selfExert.set(card, true);

        AbstractMonster m = (AbstractMonster)action.target;

        for (int i = 0; i < amount; ++i) {
            CardMetaUtils.playCardAdditionalTime(card, m);
        }

        addToBot(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    }

}
 
Example 4
Source File: CardMetaUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static void destroyCardPermanently(AbstractCard card) {
    card.purgeOnUse = true; // handles destroying the copy that's in the middle of being played
    AbstractDungeon.player.discardPile.group.removeIf(abstractCard -> abstractCard.uuid.equals(card.uuid));
    AbstractDungeon.player.drawPile.group.removeIf(abstractCard -> abstractCard.uuid.equals(card.uuid));
    AbstractDungeon.player.exhaustPile.group.removeIf(abstractCard -> abstractCard.uuid.equals(card.uuid));
    AbstractDungeon.player.hand.group.removeIf(abstractCard -> abstractCard.uuid.equals(card.uuid));

    AbstractCard masterCard = StSLib.getMasterDeckEquivalent(card);
    if (masterCard != null) {
        JorbsMod.logger.info("Removing " + masterCard.toString());
        AbstractDungeon.player.masterDeck.removeCard(masterCard);

        if (masterCard.hasTag(LEGENDARY)) {
            JorbsMod.logger.info(String.format("destroyCardPermanently: re-adding legendary card %1$s to pools", masterCard.toString()));
            LegendaryPatch.addCardToPools(masterCard.makeCopy());
        }
    } else {
        JorbsMod.logger.info("Failed to purge a card we didn't have. Perhaps Duplication Potion or Attack Potion or similar effect occurred. " + card.cardID);
    }
}
 
Example 5
Source File: CardLegendaryFramePatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static SpireReturn Prefix(SingleCardViewPopup __this, SpriteBatch sb) {
    AbstractCard card = ReflectionUtils.getPrivateField(__this, SingleCardViewPopup.class, "card");
    if (card.hasTag(LEGENDARY)) {
        RenderUtils.renderAtlasRegionCenteredAt(
                sb,
                legendaryFrameImg1024,
                (float)Settings.WIDTH / 2.0F,
                (float)Settings.HEIGHT / 2.0F);

        return SpireReturn.Return(null);
    }
    return SpireReturn.Continue();
}
 
Example 6
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static void removeObtainedLegendaryCardsFromPools() {
    for (AbstractCard c : AbstractDungeon.player.masterDeck.group) {
        if (c.hasTag(LEGENDARY)) {
            removeCardFromPools(c);
        }
    }
}
 
Example 7
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static void patch(AbstractCard c, boolean autoUpgrade, Random rng) {
    // Because the transformed card is replaced, this can incorrectly mark cards as seen in the UnlockTracker.
    if (c.hasTag(LEGENDARY)) {
        logger.error(
                "AbstractDungeon.transformCard invoked on Legendary card. "
                        + "Setting original card as the transform.");
        AbstractDungeon.transformedCard = c;
    }
}
 
Example 8
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static void patch(AbstractCard c) {
    if (c.hasTag(LEGENDARY)) {
        logger.error(
                "AbstractDungeon.srcTransformCard invoked on Legendary card. "
                        + "Setting original card as the transform.");
        AbstractDungeon.transformedCard = c;
    }
}
 
Example 9
Source File: PurgeMind.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private void exhaustRememberCardsInGroup(CardGroup group) {
    for (AbstractCard card : group.group) {
        if (card.hasTag(REMEMBER_MEMORY)) {
            AbstractDungeon.actionManager.addToBottom(new ExhaustSpecificCardAction(card, group));
        }
    }
}
 
Example 10
Source File: BottledMemoryRelic.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public boolean canSpawn() {
    for (AbstractCard c : AbstractDungeon.player.masterDeck.group) {
        if (c.hasTag(REMEMBER_MEMORY)) {
            return true;
        }
    }
    return false;
}
 
Example 11
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@SpirePostfixPatch
public static void patch(Soul __this, AbstractCard card) {
    if (card.hasTag(LEGENDARY)) {
        removeCardFromPools(card);
    }
}
 
Example 12
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@SpirePrefixPatch
public static void patch(CardGroup instance, AbstractCard c) {
    if (instance.type == CardGroup.CardGroupType.MASTER_DECK && c.hasTag(LEGENDARY)) {
        logger.error("Legendary card removed from Master Deck.");
    }
}
 
Example 13
Source File: WeightOfMemory.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
private static boolean isRememberMemoryCard(AbstractCard c) {
    return c.hasTag(REMEMBER_MEMORY);
}