com.megacrit.cardcrawl.actions.utility.UseCardAction Java Examples
The following examples show how to use
com.megacrit.cardcrawl.actions.utility.UseCardAction.
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: ShrapnelBloomPower.java From jorbs-spire-mod with MIT License | 6 votes |
@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 #2
Source File: FlowPower.java From FruityMod-StS with MIT License | 6 votes |
@Override public void onAfterUseCard(AbstractCard card, UseCardAction action) { super.onAfterUseCard(card, action); if ( (owner.hasPower("Tranquil_AttunedAttackPower") && card.type == AbstractCard.CardType.ATTACK) //|| (owner.hasPower("Tranquil_AttunedSkillPower") && card.type == AbstractCard.CardType.SKILL) ) { this.amount++; AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new StrengthPower(owner, 1), 1)); AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new DexterityPower(owner, 1), 1)); } else { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new StrengthPower(owner, -1 * amount), -1 * amount)); AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new DexterityPower(owner, -1 * amount), -1 * amount)); AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(owner, owner, this)); } }
Example #3
Source File: CatharsisPower.java From jorbs-spire-mod with MIT License | 5 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (card.type == AbstractCard.CardType.CURSE) { this.flash(); // this ensures you don't lose 1 HP twice when you have both CatharsisPower and Blue Candle if (!AbstractDungeon.player.hasRelic(BlueCandle.ID)) { this.addToBot(new LoseHPAction(AbstractDungeon.player, AbstractDungeon.player, HP_LOSS, AbstractGameAction.AttackEffect.FIRE)); } ++amount2; for (int i = 0; i < amount2; ++i) { this.addToBot(new DamageRandomEnemyAction(new DamageInfo(this.owner, this.amount, DamageInfo.DamageType.THORNS), AbstractGameAction.AttackEffect.FIRE)); } } }
Example #4
Source File: BottledPlaceholderRelic.java From StS-DefaultModBase with MIT License | 5 votes |
public void onUseCard(AbstractCard targetCard, UseCardAction useCardAction) { // Whenever we use any card boolean fullHandDialog = false; // Create a boolean (to prevent multiple "My hand is full!" dialogues if we have multiple cards bottled) for (Iterator<AbstractCard> it = AbstractDungeon.player.drawPile.group.iterator(); it.hasNext(); ) { // Create a new Iterator called "it" that checks for all AbstractCards in our draw pile. For each card: AbstractCard card = it.next(); // create a new AbstractCard named "card" which is equal to the current card in the for each loop if (BottledPlaceholderField.inBottledPlaceholderField.get(card)) { // Check if our SpireField matches said card // Essentially, we end up with: Check if the draw pile has a card that is bottled with this bottle // So, once we find a card that is bottled: this.flash(); // The relic flashes it.remove(); // Remove that card from the iterator (to prevent infinite loops) if (AbstractDungeon.player.hand.size() < BaseMod.MAX_HAND_SIZE) { // If your hand isn't full if (AutoplayField.autoplay.get(card)) { // If the card auto-plays - auto play it AbstractDungeon.actionManager.addToBottom(new AutoplayCardAction(card, AbstractDungeon.player.hand)); } card.triggerWhenDrawn(); // If the card triggers an effect on being drawn - trigger it AbstractDungeon.player.drawPile.moveToHand(card, AbstractDungeon.player.drawPile); // Move the card to your hand from your draw pile for (AbstractRelic r : AbstractDungeon.player.relics) { // And if you have any relics that trigger on card draw - trigger them r.onCardDraw(card); } } else { // If your hand IS full - create a single "My hand is full!" dialogue and move the card to the discard pile instead if (!fullHandDialog) { AbstractDungeon.player.createHandIsFullDialog(); fullHandDialog = true; } AbstractDungeon.player.drawPile.moveToDiscardPile(card); } } } }
Example #5
Source File: AttunedAttackPower.java From FruityMod-StS with MIT License | 5 votes |
@Override public void onAfterUseCard(AbstractCard card, UseCardAction action) { super.onAfterUseCard(card, action); if (card.type != AbstractCard.CardType.ATTACK) { // remove all FlowPower and this power AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this)); } }
Example #6
Source File: OnAfterUseCardPatch.java From StSLib with MIT License | 5 votes |
@SpireInsertPatch( locator=Locator.class, localvars={"targetCard"} ) public static void Insert(UseCardAction __instance, AbstractCard targetCard) { for (AbstractRelic relic : AbstractDungeon.player.relics) { if (relic instanceof OnAfterUseCardRelic) { ((OnAfterUseCardRelic) relic).onAfterUseCard(targetCard, __instance); } } }
Example #7
Source File: FleetingPatch.java From StSLib with MIT License | 5 votes |
public static void Prefix(UseCardAction __instance, @ByRef AbstractCard[] card, AbstractCreature target) { if (FleetingField.fleeting.get(card[0])) { card[0].purgeOnUse = true; AbstractCard c = StSLib.getMasterDeckEquivalent(card[0]); if (c != null) { AbstractDungeon.player.masterDeck.removeCard(c); } } }
Example #8
Source File: DamnationPower.java From jorbs-spire-mod with MIT License | 5 votes |
@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 #9
Source File: CardReboundPatch.java From jorbs-spire-mod with MIT License | 5 votes |
@SpirePrefixPatch public static void patch(UseCardAction __this) { AbstractCard targetCard = ReflectionUtils.getPrivateField(__this, UseCardAction.class, "targetCard"); if (CardReboundField.reboundOnce.get(targetCard)) { CardReboundField.reboundOnce.set(targetCard, false); __this.reboundCard = true; } }
Example #10
Source File: PlayNextCardThisTurnAdditionalTimesPower.java From jorbs-spire-mod with MIT License | 5 votes |
public void onUseCard(AbstractCard card, UseCardAction action) { if (!card.purgeOnUse && this.amount > 0) { this.flash(); AbstractMonster m = (AbstractMonster)action.target; for (int i = 0; i < amount; ++i) { CardMetaUtils.playCardAdditionalTime(card, m); } AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID)); } }
Example #11
Source File: ForbiddenGrimoireDelayedExhumePower.java From jorbs-spire-mod with MIT License | 5 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (amount <= 1) { this.flash(); AbstractDungeon.actionManager.addToBottom(new ExhumeCardsAction(cardToExhume)); AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(owner, owner, this)); } else { AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(owner, owner, this, 1)); } }
Example #12
Source File: MirroredTechniquePower.java From jorbs-spire-mod with MIT License | 5 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { int multiUse = getIncomingAttackCount(); if (card.type == AbstractCard.CardType.ATTACK && multiUse > 0 && card.purgeOnUse == false) { this.flash(); AbstractMonster m = (AbstractMonster)action.target; for (int i = 0; i < multiUse + extraPlays; ++i) { CardMetaUtils.playCardAdditionalTime(card, m); } } }
Example #13
Source File: DoubleExhaustPower.java From jorbs-spire-mod with MIT License | 5 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (!card.purgeOnUse && card.exhaust == true && this.amount > 0) { this.flash(); CardMetaUtils.playCardAdditionalTime(card, (AbstractMonster) action.target); --this.amount; if (this.amount == 0) { AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID)); } else { updateDescription(); } } }
Example #14
Source File: PlayNextAttackThisTurnAdditionalTimesPower.java From jorbs-spire-mod with MIT License | 5 votes |
public void onUseCard(AbstractCard card, UseCardAction action) { if (!card.purgeOnUse && card.type == AbstractCard.CardType.ATTACK && this.amount > 0) { this.flash(); AbstractMonster m = (AbstractMonster)action.target; for (int i = 0; i < amount; ++i) { CardMetaUtils.playCardAdditionalTime(card, m); } AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID)); } }
Example #15
Source File: FindWeaknessPower.java From jorbs-spire-mod with MIT License | 5 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (card.type == AbstractCard.CardType.ATTACK && !this.attackPlayedThisTurn) { attackPlayedThisTurn = true; this.flash(); this.updateDescription(); addToBot(new ScryAction(this.amount)); } }
Example #16
Source File: SelfExertPatch.java From jorbs-spire-mod with MIT License | 5 votes |
@SpirePrefixPatch public static void patch(UseCardAction __this) { AbstractCard targetCard = ReflectionUtils.getPrivateField(__this, UseCardAction.class, "targetCard"); if (SelfExertField.selfExert.get(targetCard)) { AbstractCard masterCard = StSLib.getMasterDeckEquivalent(targetCard); // I'm setting both masterdeck and combatdeck instances of the card to exerted, // in case we want to show text on exerted cards, or want to prevent exerted cards from being returned from Exhaust. if (masterCard != null) { ExertedField.exerted.set(masterCard, true); } ExertedField.exerted.set(targetCard, true); } }
Example #17
Source File: PathosPower.java From jorbs-spire-mod with MIT License | 4 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { this.flash(); AbstractCard c = AbstractDungeon.returnRandomCurse(); AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDiscardAction(c, 1)); }
Example #18
Source File: PowerOverwhelmingPower.java From FruityMod-StS with MIT License | 4 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (card.type == AbstractCard.CardType.SKILL) { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new FrailPower(owner, amount, false), amount)); } }
Example #19
Source File: PremonitionsPower.java From FruityMod-StS with MIT License | 4 votes |
@Override public void onUseCard(AbstractCard card, UseCardAction action) { if (card.type == AbstractCard.CardType.ATTACK) { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new WeakPower(owner, amount, false), amount)); } }
Example #20
Source File: CommonPower.java From StS-DefaultModBase with MIT License | 4 votes |
@Override public void onUseCard(final AbstractCard card, final UseCardAction action) { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new DexterityPower(owner, amount), amount)); }
Example #21
Source File: OnAfterUseCardRelic.java From StSLib with MIT License | votes |
void onAfterUseCard(AbstractCard card, UseCardAction action);