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

The following examples show how to use com.megacrit.cardcrawl.actions.common.ApplyPowerAction. 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: TemperanceMemory.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
private void updateAppliedStrength() {
    int newStrength = calculateBonusDamage();

    // We intentionally set this to the calculated value even if we aren't applying the passive effect
    setDescriptionPlaceholder("!S!", newStrength);

    if (!isPassiveEffectActive()) {
        newStrength = 0;
    }

    int strengthDelta = newStrength - strengthAlreadyApplied;
    if (strengthDelta != 0) {
        // It is by design that strength decreases can be blocked by artifact.
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner, new StrengthPower(owner, strengthDelta), strengthDelta));
        flashWithoutSound();
        strengthAlreadyApplied = newStrength;
    }
}
 
Example #2
Source File: ForbiddenGrimoire.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new DiscoveryAtCostAction(MaterialComponentsDeck.drawUniqueRandomCards(3), true));
    if (!purgeOnUse) {
        addToBot(new ApplyPowerAction(p, p, new ForbiddenGrimoireDelayedExhumePower(p, this, magicNumber)));
    }
}
 
Example #3
Source File: Stone.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void useMaterialComponent(AbstractPlayer p, AbstractMonster m) {
    AbstractPower possibleExistingSlowPower = m.getPower(SlowPower.POWER_ID);
    if (possibleExistingSlowPower == null) {
        addToBot(new ApplyPowerAction(m, p, new SlowPower(m, 0), 0));
    } else {
        int stacksToAdd = possibleExistingSlowPower.amount * (magicNumber - 1);
        addToBot(new ApplyPowerAction(m, p, new SlowPower(m, stacksToAdd), stacksToAdd));
    }
}
 
Example #4
Source File: RayOfFrost.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new VFXAction(new RayOfFrostEffect(p, m, damage)));
    addToBot(new DamageAction(m, new DamageInfo(p, damage), AbstractGameAction.AttackEffect.NONE));

    for (int i = 0; i < this.metaMagicNumber; ++i) {
        addToBot(new ApplyPowerAction(m, p, new WeakPower(m, this.magicNumber, false), this.magicNumber));
    }
}
 
Example #5
Source File: Rebuttal.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onRetained() {
    if (!thornsApplied) {
        AbstractPlayer p = AbstractDungeon.player;
        addToBot(new ApplyPowerAction(p, p, new ThornsPower(p, urMagicNumber)));
        thornsApplied = true;
    }
}
 
Example #6
Source File: GatheringEvil.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (magicNumber > 0) {
        addToBot(new ApplyPowerAction(p, p, new StrengthPower(p, magicNumber * metaMagicNumber)));
        addToBot(new ApplyPowerAction(p, p, new VulnerablePower(p, magicNumber * urMagicNumber, false)));
    }
}
 
Example #7
Source File: LustMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onAttack(DamageInfo info, int damageAmount, AbstractCreature target) {
    if (isPassiveEffectActive()) {
        // Similar to EnvenomPower
        if (target != this.owner && info.type == DamageInfo.DamageType.NORMAL) {
            this.flash();
            AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(target, this.owner, new BurningPower(target, this.owner, PASSIVE_BURNING_ON_ATTACK), PASSIVE_BURNING_ON_ATTACK, true));
        }
    }
}
 
Example #8
Source File: ScorchingRayAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void update() {
    AbstractDungeon.actionManager.addToBottom(new SFXAction("ATTACK_MAGIC_BEAM_SHORT", 0.5F));
    AbstractDungeon.actionManager.addToBottom(new VFXAction(new BorderFlashEffect(Color.GOLDENROD.cpy())));
    AbstractDungeon.actionManager.addToBottom(new VFXAction(
            new ScalingLaserEffect(source.hb.cX, source.hb.cY, target.hb.cX, target.hb.cY, Color.ORANGE.cpy(), Color.RED.cpy(), amount), 0.1F));

    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, source, new BurningPower(target, source, amount)));

    isDone = true;
}
 
Example #9
Source File: Fear.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (m.type == EnemyType.BOSS) {
        AbstractDungeon.effectList.add(new ThoughtBubble(AbstractDungeon.player.dialogX, AbstractDungeon.player.dialogY, 3.0F, EXTENDED_DESCRIPTION[0], true));
    } else {
        addToBot(new ApplyPowerAction(m, p, new FearPower(m, magicNumber), magicNumber));
    }
}
 
Example #10
Source File: CounterspellAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (this.monster != null && IntentUtils.isDebuffIntent(this.monster.intent)) {
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(this.owner, this.owner, new ArtifactPower(this.owner, this.amount), this.amount));
    } else {
        AbstractDungeon.effectList.add(new ThoughtBubble(AbstractDungeon.player.dialogX, AbstractDungeon.player.dialogY, 3.0F, TEXT[0], true));
    }

    this.isDone = true;
}
 
Example #11
Source File: MultiplyBurningAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void update() {
    AbstractPower possibleExistingBurningPower = target.getPower(BurningPower.POWER_ID);
    if (possibleExistingBurningPower != null) {
        int stacksToAdd = possibleExistingBurningPower.amount * (multiplier - 1);
        AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(target, source, new BurningPower(target, source, stacksToAdd), stacksToAdd));
    }
    isDone = true;
}
 
Example #12
Source File: BanishedPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onInitialApplication() {
    if (owner instanceof AbstractMonster) {
        associatedStunPower = new StunMonsterPower((AbstractMonster)this.owner, this.amount);
        AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(this.owner, this.source, associatedStunPower, this.amount));
    }
}
 
Example #13
Source File: CullDexPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static void Prefix(ApplyPowerAction __this) {
    float duration = ReflectionUtils.getPrivateField(__this, AbstractGameAction.class, "duration");
    float startingDuration = ReflectionUtils.getPrivateField(__this, ApplyPowerAction.class, "startingDuration");
    if (duration == startingDuration) {
        AbstractPower originalPower = ReflectionUtils.getPrivateField(__this, ApplyPowerAction.class, "powerToApply");
        AbstractPower updatedPower = updateDexPower(originalPower);
        if (originalPower != updatedPower) {
            ReflectionUtils.setPrivateField(__this, ApplyPowerAction.class, "powerToApply", updatedPower);
        }
    }
}
 
Example #14
Source File: ColorSpray.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster monster) {
    addToBot(new DamageAllEnemiesAction(p, multiDamage, damageTypeForTurn, AttackEffect.FIRE));

    for(AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
        final AbstractPower randomDebuff = generateRandomDebuff(p, m);
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, randomDebuff, randomDebuff.amount, true, AttackEffect.NONE));
    }

    addToBot(new RememberSpecificMemoryAction(p, EnvyMemory.STATIC.ID));
}
 
Example #15
Source File: ChastityMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurnPreEndTurnCards() {
    if (isPassiveEffectActive()) {
        AbstractDungeon.actionManager.addToBottom(
                // It's important to apply a negative dex power rather than reducing an existing dex power
                //   1. reducing the existing power doesn't work if the player currently has no dex
                //   2. we want it to be blockable by Artifact, which ApplyPowerAction is and ReducePowerAction isn't
                new ApplyPowerAction(owner, owner, new DexterityPower(this.owner, -DEXTERITY_LOSS_PER_TURN)));
        AbstractDungeon.actionManager.addToBottom(
                new GainBlockAction(owner, owner, BLOCK_PER_TURN));
    }
}
 
Example #16
Source File: KindnessMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onGainPassiveEffect() {
    this.restoreStrengthActions = new ArrayList<>();

    for (AbstractMonster mo : AbstractDungeon.getCurrRoom().monsters.monsters) {
        ApplyPowerAction applyStrengthDownAction = new ApplyPowerAction(mo, owner, new StrengthPower(mo, -ENEMY_STRENGTH_REDUCTION), -ENEMY_STRENGTH_REDUCTION, true, AbstractGameAction.AttackEffect.NONE);
        Runnable setupStrengthToBeRestoredOnForget = () -> this.restoreStrengthActions.add(
                new ApplyPowerAction(mo, owner, new StrengthPower(mo, +ENEMY_STRENGTH_REDUCTION), +ENEMY_STRENGTH_REDUCTION, true, AbstractGameAction.AttackEffect.NONE));

        // addToTop is required for correct ordering with Hold Monster against enemies with 1 Artifact
        AbstractDungeon.actionManager.addToTop(new ApplyTemporaryDebuffAction(applyStrengthDownAction, setupStrengthToBeRestoredOnForget));
    }
}
 
Example #17
Source File: PatienceMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onPlayCard(AbstractCard card, AbstractMonster target) {
    if (isPassiveEffectActive()) {
        this.flash();
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(owner, owner, new CoilPower(owner, COIL_PER_CARD)));
    }
}
 
Example #18
Source File: Entangle.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster mo) {
    for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
        if (!m.hasPower(SlowPower.POWER_ID)) {
            addToBot(new ApplyPowerAction(m, p, new SlowPower(m, 0)));
        }
    }

    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInHandAction(new Web(), this.magicNumber));
}
 
Example #19
Source File: ChastityMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onRemember() {
    AbstractDungeon.actionManager.addToBottom(
            new ApplyPowerAction(owner, owner, new DexterityPower(owner, DEXTERITY_ON_REMEMBER), DEXTERITY_ON_REMEMBER));

    if (!AbstractDungeon.getMonsters().areMonstersBasicallyDead()) {
        for (AbstractMonster monster : AbstractDungeon.getMonsters().monsters) {
            if (!monster.halfDead && !monster.isDead && !monster.isDying) {
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(monster, owner, new WeakPower(monster, WEAK_ON_REMEMBER, false), WEAK_ON_REMEMBER));
            }
        }
    }
}
 
Example #20
Source File: MagicMirrorOnPowerReceivedPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static void patch(ApplyPowerAction __this) {
    if (__this.target != null && !__this.target.isDeadOrEscaped()) {
        float duration = ReflectionUtils.getPrivateField(__this, AbstractGameAction.class, "duration");
        float startingDuration = ReflectionUtils.getPrivateField(__this, ApplyPowerAction.class, "startingDuration");
        if (duration == startingDuration) {
            AbstractPower powerToApply = ReflectionUtils.getPrivateField(__this, ApplyPowerAction.class, "powerToApply");
            if (__this.target.hasPower(MagicMirrorPower.POWER_ID) && powerToApply.type == AbstractPower.PowerType.DEBUFF && __this.target != __this.source) {
                logger.info("Magic Mirror triggering to reflect a power");
                ((MagicMirrorPower)__this.target.getPower(MagicMirrorPower.POWER_ID)).onPowerReceived(powerToApply);
            }
        }
    }
}
 
Example #21
Source File: MirrorImagePower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private MirrorImageMinion initializeMinion() {
    MirrorImageMinion minion = new MirrorImageMinion(this, this.amount);
    // -1 turns prevents it from displaying a turn duration. We don't worry about it expiring because we
    // intentionally don't set the minion up to receive onEndRound events.
    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(minion, minion, new IntangiblePlayerPower(minion, -1)));
    minion.init();
    minion.showHealthBar();
    return minion;
}
 
Example #22
Source File: PyromancyPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onApplyPower(AbstractPower power, AbstractCreature target, AbstractCreature source) {
    if (source == owner && power.ID.equals(BurningPower.POWER_ID) && !((BurningPower)power).generatedByPyromancy) {
        for (int i = 0; i < amount; ++i) {
            AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(target, source, new BurningPower(target, source, power.amount, true)));
        }
    }
}
 
Example #23
Source File: Apparate.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    addToBot(new ApplyPowerAction(p, p, new VulnerablePower(p, urMagicNumber, false)));
    addToBot(new VFXAction(new CleaveEffect()));
    this.addToBot(new DamageAllEnemiesAction(p, this.multiDamage, this.damageTypeForTurn, AbstractGameAction.AttackEffect.NONE));
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        addToBot(new ApplyPowerAction(m, p, new VulnerablePower(m, magicNumber, false)));
    }
}
 
Example #24
Source File: Melt.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    int burning = m.currentBlock;
    if(burning > 0) {
        addToBot(new ApplyPowerAction(m, p, new BurningPower(m, p, burning)));
    }
    addToBot(new DamageAction(m, new DamageInfo(p, damage)));
}
 
Example #25
Source File: Firebolt.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new DamageAction(m, new DamageInfo(p, damage), AttackEffect.FIRE));
    if (magicNumber > 0) {
        addToBot(new ApplyPowerAction(m, p, new BurningPower(m, p, magicNumber)));
    }
}
 
Example #26
Source File: DoubleCheck.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new GainBlockAction(p, p, block));
    addToBot(new RememberSpecificMemoryAction(p, DiligenceMemory.STATIC.ID));
    if (upgraded) {
        addToBot(new ApplyPowerAction(p, p, new DoubleCheckPower(p)));
    }
}
 
Example #27
Source File: FaerieFire.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster mo) {
    AbstractMemory currentMemory = MemoryManager.forPlayer(p).currentMemory;
    if (currentMemory == null) { return; }

    for(AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
        AbstractPower debuff = currentMemory.memoryType == MemoryType.SIN ?
                new VulnerablePower(m, magicNumber, false) :
                new WeakPower(m, magicNumber, false);

        addToBot(new ApplyPowerAction(m, p, debuff));
    }
}
 
Example #28
Source File: Channel.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new GainBlockAction(p, p, block));
    addToBot(new ApplyPowerAction(p, p, new EnergizedCustomPower(p, magicNumber)));
    if (metaMagicNumber > 0) {
        addToBot(new CardsToTopOfDeckAction(p, p.discardPile, this.metaMagicNumber, false));
    }
}
 
Example #29
Source File: HoldMonster.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new RememberSpecificMemoryAction(p, KindnessMemory.STATIC.ID));

    ApplyPowerAction applyStrengthDownAction = new ApplyPowerAction(m, p, new StrengthPower(m, -this.magicNumber), -this.magicNumber);
    Runnable setupStrengthToBeRestoredAtEndOfTurn = () -> addToBot(new ApplyPowerAction(m, p, new GainStrengthPower(m, this.magicNumber), this.magicNumber));
    addToBot(new ApplyTemporaryDebuffAction(applyStrengthDownAction, setupStrengthToBeRestoredAtEndOfTurn));
}
 
Example #30
Source File: Shake.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    if (abstractMonster.hasPower(VulnerablePower.POWER_ID)) {
        addToBot(new DrawCardAction(p, magicNumber));
    }
    addToBot(new ApplyPowerAction(abstractMonster, p, new VulnerablePower(abstractMonster, urMagicNumber, false)));
}