com.megacrit.cardcrawl.cards.AbstractCard Java Examples

The following examples show how to use com.megacrit.cardcrawl.cards.AbstractCard. 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: ForbiddenGrimoireDelayedExhumePower.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public ForbiddenGrimoireDelayedExhumePower(final AbstractCreature owner, final AbstractCard cardToExhume, final int cardPlaysUntilExhume) {
    super(STATIC);

    // This prevents the power from stacking with other instances of itself for different card instances.
    // This is the same strategy used by TheBombPower.
    //
    // StSLib provides a NonStackablePower interface with similar functionality, but we're intentionally not using
    // it because it is hackier than the ID thing.
    ID = POWER_ID + "__" + (++instanceCounter);

    this.owner = owner;
    this.amount = cardPlaysUntilExhume;
    this.source = owner;

    this.cardToExhume = cardToExhume;

    type = PowerType.BUFF;
    isTurnBased = false;

    updateDescription();
}
 
Example #2
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 #3
Source File: SummoningPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public SummoningPower(AbstractCreature owner, AbstractCard c) {
    super(STATIC);

    ID = POWER_ID + "__" + (++instanceCounter);
    this.card = c;
    this.owner = owner;
    updateDescription();
}
 
Example #4
Source File: BookOfTrialsRelic.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atStartOfAct() {
    AbstractDungeon.player.getRelic(BookOfTrialsRelic.ID).flash();
    ArrayList<AbstractCard> cards = DeckOfTrials.drawCards(2);
    for (AbstractCard card : cards) {
        AbstractDungeon.effectList.add(new ShowCardAndObtainEffect(card, (float) Settings.WIDTH / 2.0F, (float) Settings.HEIGHT / 2.0F));
    }
}
 
Example #5
Source File: OnRemoveCardFromMasterDeckPatch.java    From StSLib with MIT License 5 votes vote down vote up
public static void Postfix(CardGroup __instance, AbstractCard c)
{
    if (__instance.type == CardGroup.CardGroupType.MASTER_DECK) {
        for (AbstractRelic r : AbstractDungeon.player.relics) {
            if (r instanceof OnRemoveCardFromMasterDeckRelic) {
                ((OnRemoveCardFromMasterDeckRelic) r).onRemoveCardFromMasterDeck(c);
            }
        }
    }
}
 
Example #6
Source File: MeteorShower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public MeteorShower() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION, AbstractCard.CardType.ATTACK,
            AbstractCardEnum.SEEKER_PURPLE, AbstractCard.CardRarity.RARE, AbstractCard.CardTarget.ALL_ENEMY);
    this.baseDamage = 2;
    this.exhaust = true;
    isEthereal = true;
}
 
Example #7
Source File: TroublePower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onCardDraw(AbstractCard card) {
    if (card.type == AbstractCard.CardType.CURSE) {
        this.flash();
        AbstractDungeon.actionManager.addToBottom(new DrawCardAction(owner, amount));
    }
}
 
Example #8
Source File: EphemeralField.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void set(Object __instance, Boolean value) {
    super.set(__instance, value);
    if (value && __instance instanceof AbstractCard) {
        ((AbstractCard)__instance).exhaust = true;
        ((AbstractCard)__instance).isEthereal = true;
    }
}
 
Example #9
Source File: DarkMatter.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public DarkMatter() {
    super(ID, NAME, COST, DESCRIPTION,
            AbstractCard.CardType.ATTACK,
            AbstractCard.CardRarity.UNCOMMON,
            AbstractCard.CardTarget.ENEMY);
    this.magicNumber = this.baseMagicNumber = DAMAGE_AMT;
}
 
Example #10
Source File: SneckoField.java    From StSLib with MIT License 5 votes vote down vote up
@Override
public void set(Object __intance, Boolean value)
{
    super.set(__intance, value);
    if (value && __intance instanceof AbstractCard) {
        ((AbstractCard)__intance).cost = -1;
    }
}
 
Example #11
Source File: FilterRandomCardGenerationPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        locator = ArrayList_get_Locator.class,
        localvars = "list"
)
public static void patch(ArrayList<AbstractCard> list) {
    RemovePersistentPositiveEffects(list);
}
 
Example #12
Source File: DeckOfManyThingsEvent.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() { // We need the update() when we use grid screens (such as, in this case, the screen for selecting a card to remove)
    super.update(); // Do everything the original update()
    if (!AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) { // Once the grid screen isn't empty (we selected a card for removal)
        AbstractCard c = AbstractDungeon.gridSelectScreen.selectedCards.get(0); // Get the card
        AbstractDungeon.topLevelEffects.add(new PurgeCardEffect(c, (float)(Settings.WIDTH / 2), (float)(Settings.HEIGHT / 2))); // Create the card removal effect
        AbstractDungeon.player.masterDeck.removeCard(c); // Remove it from the deck
        AbstractDungeon.gridSelectScreen.selectedCards.clear(); // Or you can .remove(c) instead of clear,
        // if you want to continue using the other selected cards for something
    }

}
 
Example #13
Source File: Convergence.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public Convergence() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.SKILL, AbstractCardEnum.SEEKER_PURPLE,
            AbstractCard.CardRarity.UNCOMMON, AbstractCard.CardTarget.ALL_ENEMY);
    this.isInnate = true;
    this.exhaust = true;
}
 
Example #14
Source File: Genesis.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public Genesis() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.SKILL, AbstractCardEnum.SEEKER_PURPLE,
            AbstractCard.CardRarity.COMMON, AbstractCard.CardTarget.SELF);
    this.baseBlock = BLOCK_AMT;
    this.baseMagicNumber = DRAW;
    this.magicNumber = DRAW;
    this.isEthereal = true;
}
 
Example #15
Source File: Disperse.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public Disperse() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION, AbstractCard.CardType.SKILL,
            AbstractCardEnum.SEEKER_PURPLE, AbstractCard.CardRarity.UNCOMMON, AbstractCard.CardTarget.SELF);

    this.baseBlock = BLOCK_AMT;
    this.magicNumber = this.baseMagicNumber = ARTIFACT;
}
 
Example #16
Source File: IdentityCrisisEvent.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
public void update() { // We need the update() when we use grid screens (such as, in this case, the screen for selecting a card to remove)
    super.update(); // Do everything the original update()
    if (!AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) { // Once the grid screen isn't empty (we selected a card for removal)
        AbstractCard c = (AbstractCard)AbstractDungeon.gridSelectScreen.selectedCards.get(0); // Get the card
        AbstractDungeon.topLevelEffects.add(new PurgeCardEffect(c, (float)(Settings.WIDTH / 2), (float)(Settings.HEIGHT / 2))); // Create the card removal effect
        AbstractDungeon.player.masterDeck.removeCard(c); // Remove it from the deck
        AbstractDungeon.gridSelectScreen.selectedCards.clear(); // Or you can .remove(c) instead of clear,
        // if you want to continue using the other selected cards for something
    }

}
 
Example #17
Source File: WrathMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static void reapplyToLoadedCard(AbstractCard card, int effectCount) {
    if (!isUpgradeCandidate(card) && (effectCount > 0)) {
        JorbsMod.logger.error("Wrath effect count modified for an ineligible card");
        return;
    }

    WrathField.wrathEffectCount.set(card, effectCount);

    if (!usesMiscToTrackPermanentBaseDamage(card)) {
        card.baseDamage += DAMAGE_INCREASE_PER_KILL * effectCount;
    }
}
 
Example #18
Source File: EtherBlast.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public EtherBlast() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION, AbstractCard.CardType.ATTACK,
            AbstractCardEnum.SEEKER_PURPLE, AbstractCard.CardRarity.UNCOMMON, AbstractCard.CardTarget.ENEMY);
    this.isEthereal = true;
    this.damage = this.baseDamage = BASE_ATTACK_DMG;
    this.magicNumber = this.baseMagicNumber = PER_ETHEREAL_DMG;
}
 
Example #19
Source File: Dazed_P.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public Dazed_P() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.ATTACK, AbstractCardEnum.SEEKER_PURPLE,
            CardRarity.SPECIAL, AbstractCard.CardTarget.ALL_ENEMY);

    this.setBackgroundTexture("img/seeker/512/DazedP_BG_small.png", "img/seeker/1024/DazedP_BG_large.png");
    this.baseDamage = 0;
    this.baseBlock = 0;
    this.isMultiDamage = true;
    this.isEthereal = true;
}
 
Example #20
Source File: AbstractSeekerCard.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public static int countEtherealInExhaustPile() {
    int exhaustedEtherealCount = 0;
    for (AbstractCard c : AbstractDungeon.player.exhaustPile.group) {
        if (!c.isEthereal)
            continue;
        exhaustedEtherealCount++;
    }
    return exhaustedEtherealCount;
}
 
Example #21
Source File: MaterialComponentsDeck.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static ArrayList<AbstractCard> drawUniqueRandomCards(int numCards) {
    ArrayList<AbstractCard> retVal = new ArrayList<>();
    while (retVal.size() < numCards) {
        AbstractCard candidate = drawRandomCard();
        boolean candidateHasAlreadyBeenDrawn = retVal.stream().anyMatch(c -> c.cardID.equals(candidate.cardID));
        if (!candidateHasAlreadyBeenDrawn) {
            retVal.add(candidate);
        }
    }
    return retVal;
}
 
Example #22
Source File: NullStorm.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public NullStorm() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.ATTACK, AbstractCardEnum.SEEKER_PURPLE,
            AbstractCard.CardRarity.COMMON, AbstractCard.CardTarget.ALL_ENEMY);
    this.isMultiDamage = true;
    this.baseDamage = ATTACK_DMG;
}
 
Example #23
Source File: AutoplayPatch.java    From StSLib with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        locator=Locator.class,
        localvars={"c"}
)
public static void Insert(AbstractPlayer __instance, int numCards, AbstractCard c)
{
    if (c != null && AutoplayField.autoplay.get(c)) {
        AbstractDungeon.actionManager.addToBottom(new AutoplayCardAction(c, AbstractDungeon.player.hand));
    }
}
 
Example #24
Source File: CommonKeywordIconsPatches.java    From StSLib with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static void patch(SpriteBatch sb, String word, float x, float y, AbstractCard ___card) {
    if (___card == null || !CommonKeywordIconsField.useIcons.get(___card)) {
        return;
    }

    Texture badge = null;
    if (word.equals(GameDictionary.INNATE.NAMES[0]))
    {
        badge = StSLib.BADGE_INNATE;
    }
    else if (word.equals(GameDictionary.ETHEREAL.NAMES[0]))
    {
        badge = StSLib.BADGE_ETHEREAL;
    }
    else if (word.equals(GameDictionary.RETAIN.NAMES[0]))
    {
        badge = StSLib.BADGE_RETAIN;
    }
    else if (word.equals(purgeName))
    {
        badge = StSLib.BADGE_PURGE;
    }
    else if (word.equals(GameDictionary.EXHAUST.NAMES[0]))
    {
        badge = StSLib.BADGE_EXHAUST;
    }

    if(badge != null) {
        float badge_w = badge.getWidth();
        float badge_h = badge.getHeight();
        sb.draw(badge, x + ((320.0F - badge_w/2 - 8f) * Settings.scale), y + (-16.0F * Settings.scale), 0, 0, badge_w, badge_h,
                0.5f * Settings.scale, 0.5f * Settings.scale, 0, 0, 0, (int)badge_w, (int)badge_h, false, false);
    }
}
 
Example #25
Source File: Pollute.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    for (AbstractCard c : p.hand.group) {
        if (c != this) {
            c.type = CardType.CURSE;
        }
    }
}
 
Example #26
Source File: Transference.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public Transference() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.SKILL, AbstractCardEnum.SEEKER_PURPLE,
            AbstractCard.CardRarity.UNCOMMON, AbstractCard.CardTarget.ENEMY);
    this.baseMagicNumber = DRAW;
    this.magicNumber = DRAW;
}
 
Example #27
Source File: DamnationPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onUseCard(AbstractCard card, UseCardAction action) {
    if (!card.purgeOnUse && StSLib.getMasterDeckEquivalent(card) != null) {
        CardMetaUtils.destroyCardPermanently(card);
        AbstractDungeon.transformCard(card, isAutoUpgrade, AbstractDungeon.miscRng);
        AbstractDungeon.topLevelEffectsQueue.add(new ShowCardAndObtainEffect(AbstractDungeon.getTransformedCard(), Settings.WIDTH / 2.0F, Settings.HEIGHT / 2.0F, false));
    }
    addToTop(new RemoveSpecificPowerAction(owner, owner, this.ID));
}
 
Example #28
Source File: ReflectionWard.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public ReflectionWard() {
    super(ID, NAME, SeekerMod.makeCardImagePath(ID), COST, DESCRIPTION,
            AbstractCard.CardType.SKILL, AbstractCardEnum.SEEKER_PURPLE,
            AbstractCard.CardRarity.RARE, AbstractCard.CardTarget.SELF);
    this.baseBlock = 13;
    baseMagicNumber = magicNumber  = 5;
    isEthereal = true;
}
 
Example #29
Source File: HypothesisAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostDraw(AbstractCard c) {
    if (listening) {
        this.listening = false;
        if (c.isEthereal) {
            //AbstractDungeon.actionManager.addToTop(new MakeTempCardInHandAction(new Dazed(), 1, true));
            AbstractDungeon.actionManager.addToTop(new DrawCardAction(AbstractDungeon.player, this.amount));
        }
        /*
         *  calling unsubscribeFromPostBattle inside the callback
         *  for receivePostBattle means that when we're calling it
         *  there is currently an iterator going over the list
         *  of subscribers and calling receivePostBattle on each of
         *  them therefore if we immediately try to remove the this
         *  callback from the post battle subscriber list it will
         *  throw a concurrent modification exception in the iterator
         *
         *  for now we just add a delay - yes this is an atrocious solution
         *  PLEASE someone with a better idea replace it
         */
        Thread delayed = new Thread(() -> {
            try {
                Thread.sleep(200);
            } catch (Exception e) {
                System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
                e.printStackTrace();
            }
            BaseMod.unsubscribe(this);
        });
        delayed.start();
    }
}
 
Example #30
Source File: BranchingUpgradesPatch.java    From StSLib with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        rloc = 9,
        localvars = {"retVal"}
)
public static void Insert(String key, @ByRef int[] upgradeTime, int misc, AbstractCard retVal) {
    if (retVal instanceof BranchingUpgradesCard) {
        if (upgradeTime[0] < 0) {
            upgradeTime[0] *= -1;
            ((BranchingUpgradesCard) retVal).setUpgradeType(BranchingUpgradesCard.UpgradeType.BRANCH_UPGRADE);
        } else if (upgradeTime[0] > 0) {
            ((BranchingUpgradesCard) retVal).setUpgradeType(BranchingUpgradesCard.UpgradeType.NORMAL_UPGRADE);
        }
    }
}