com.megacrit.cardcrawl.actions.common.ReducePowerAction Java Examples

The following examples show how to use com.megacrit.cardcrawl.actions.common.ReducePowerAction. 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: MagicMirrorPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static void prefix(EntanglePower __this, @ByRef boolean[] isPlayer) {
    if (!__this.owner.isPlayer && !EntanglePowerJustAppliedField.justApplied.get(__this)) {
        // We intentionally use reduce rather than remove (like the original method) because it's possible for
        // this to end up stacked (if the player had multiple magic mirror stacks)
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(__this.owner, __this.owner, EntanglePower.POWER_ID, 1));
    }
    EntanglePowerJustAppliedField.justApplied.set(__this, false);
}
 
Example #2
Source File: Rebuttal.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private void removeRetainThorns() {
    if (thornsApplied) {
        AbstractPlayer p = AbstractDungeon.player;
        addToBot(new ReducePowerAction(p, p, ThornsPower.POWER_ID, urMagicNumber));
        thornsApplied = false;
    }
}
 
Example #3
Source File: ForcedPresence.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    if (p.hasPower(IntangiblePlayerPower.POWER_ID) && p.getPower(IntangiblePlayerPower.POWER_ID).amount > 0) {
        AbstractPower power = p.getPower(IntangiblePlayerPower.POWER_ID);
        if (power.amount == 1) {
            this.addToBot(new RemoveSpecificPowerAction(p, p, power));
        } else {
            this.addToBot(new ReducePowerAction(p, p, power, magicNumber));
        }

        addToBot(new GainEnergyAction(urMagicNumber));
    }
}
 
Example #4
Source File: SpiritShieldPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atStartOfTurn() {
    if (this.amount == 1) {
        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    } else {
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(this.owner, this.owner, this.ID, 1));
    }
}
 
Example #5
Source File: FlameWardPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onDamagedPreBlock(DamageInfo info) {
    if (info != null && this.owner != info.owner && info.type != DamageInfo.DamageType.THORNS && info.type != DamageInfo.DamageType.HP_LOSS) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.owner.hb.cX, this.owner.hb.cY, AbstractGameAction.AttackEffect.SHIELD));
        AbstractDungeon.effectList.add(new FlameBarrierEffect(this.owner.hb.cX, this.owner.hb.cY));
        this.owner.addBlock(this.amount);
        for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
            AbstractDungeon.actionManager.addToTop(
                    new ApplyPowerAction(m, this.owner, new BurningPower(m, this.owner, this.amount2), this.amount2, AbstractGameAction.AttackEffect.FIRE));
        }
        this.flash();
        AbstractDungeon.actionManager.addToTop(new ReducePowerAction(this.owner, this.owner, this.ID, this.amount));
    }
}
 
Example #6
Source File: BanishedPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurn(boolean isPlayer) {
    this.flash();
    if (this.amount == 0) {
        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    } else {
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(this.owner, this.owner, this.ID, 1));
    }
}
 
Example #7
Source File: PathosPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurn(boolean isPlayer) {
    if (this.amount == 0) {
        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    } else {
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(this.owner, this.owner, this.ID, 1));
    }
}
 
Example #8
Source File: ForbiddenGrimoireDelayedExhumePower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@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 #9
Source File: MirrorPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atStartOfTurn() {
    if (this.amount == 1) {
        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    } else {
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(this.owner, this.owner, this.ID, 1));
    }
}
 
Example #10
Source File: MirrorImageMinion.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void damage(DamageInfo info) {
    int oldHealth = this.currentHealth;
    super.damage(info);
    // We expect to be permanently intangible, so this should always be 1 (normal case) or 0 (dark shackles stuff)
    int decrease = oldHealth - this.currentHealth;
    if (decrease > 0) {
        AbstractDungeon.actionManager.addToTop(new ReducePowerAction(owningPower.owner, this, owningPower, decrease));
    }
}
 
Example #11
Source File: ExhaustiveNegationPower.java    From StSLib with MIT License 5 votes vote down vote up
public void onSpecificTrigger()
{
    flash();
    if (amount <= 0) {
        AbstractDungeon.actionManager.addToTop(new RemoveSpecificPowerAction(owner, owner, ID));
    } else {
        AbstractDungeon.actionManager.addToTop(new ReducePowerAction(owner, owner, ID, 1));
    }
}
 
Example #12
Source File: StunMonsterPower.java    From StSLib with MIT License 5 votes vote down vote up
@Override
public void atEndOfRound()
{
    if (amount <= 0) {
        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(owner, owner, this));
    } else {
        AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(owner, owner, this, 1));
    }
}
 
Example #13
Source File: FlickerPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void atEndOfRound() {
    if (this.justApplied) {
        this.justApplied = false;
        return;
    }
    if (this.amount == 0) {
        AbstractDungeon.actionManager
                .addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, "Flicker"));
    } else {
        AbstractDungeon.actionManager
                .addToBottom(new ReducePowerAction(this.owner, this.owner, "Flicker", 1));
    }
}
 
Example #14
Source File: CommonPower.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurn(final boolean isPlayer) {
    int count = 0;
    for (final AbstractCard c : AbstractDungeon.actionManager.cardsPlayedThisTurn) {
        // This is how you iterate through arrays (like the one above) and card groups like
        // "AbstractDungeon.player.masterDeck.getAttacks().group" - every attack in your actual master deck.
        // Read up on java's enhanced for-each loops if you want to know more on how these work.

        ++count; // At the end of your turn, increase the count by 1 for each card played this turn.
    }

    if (count > 0) {
        flash(); // Makes the power icon flash.
        for (int i = 0; i < count; ++i) {
            AbstractDungeon.actionManager.addToBottom(
                    new ReducePowerAction(owner, owner, DexterityPower.POWER_ID, amount));
            // Reduce the power by 1 for each count - i.e. for each card played this turn.
            // DO NOT HARDCODE YOUR STRINGS ANYWHERE: i.e. don't write any Strings directly i.e. "Dexterity" for the power ID above.
            // Use the power/card/relic etc. and fetch it's ID like shown above. It's really bad practice to have "Strings" in your code:

            /*
             * 1. It's bad for if somebody likes your mod enough (or if you decide) to translate it.
             * Having only the JSON files for translation rather than 15 different instances of "Dexterity" in some random cards is A LOT easier.
             *
             * 2. You don't have a centralised file for all strings for easy proof-reading, and if you ever want to change a string
             * you now have to go through all your files individually.
             *
             * 3. Without hardcoded strings, editing a string doesn't require a compile, saving you time (unless you clean+package).
             *
             */
        }
    }

}
 
Example #15
Source File: HumilityMemory.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void onLosePassiveEffect() {
    AbstractDungeon.actionManager.addToBottom(new ReducePowerAction(owner, owner, ThornsPower.POWER_ID, THORNS_PASSIVE));
}