com.megacrit.cardcrawl.actions.AbstractGameAction Java Examples

The following examples show how to use com.megacrit.cardcrawl.actions.AbstractGameAction. 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: Vacuum.java    From FruityMod-StS with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(p, p, "Weakened"));
    AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(p, p, "Frail"));
    AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(p, p, "Vulnerable"));

    if (m != null) {
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new VerticalImpactEffect(m.hb.cX + m.hb.width / 4.0f, m.hb.cY - m.hb.height / 4.0f)));
    }

    AbstractDungeon.actionManager.addToBottom(
            new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_HEAVY));

    this.rawDescription = (this.isEthereal ? "Ethereal. NL " : "") + DESCRIPTION;
    initializeDescription();
}
 
Example #2
Source File: ThoughtRaze.java    From FruityMod-StS with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    int count = 0;
    for (AbstractCard c : p.drawPile.group) {
        if (c.isEthereal) {
            AbstractDungeon.actionManager.addToBottom(new ExhaustSpecificCardAction(c, p.drawPile));
            count++;
        }
    }

    for (int i = 0; i < count; i++) {
        AbstractDungeon.actionManager.addToBottom(
                new DamageAction((AbstractCreature) m,
                        new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL), AbstractGameAction.AttackEffect.SLASH_VERTICAL));
    }
}
 
Example #3
Source File: StunMonsterPower.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void onInitialApplication()
{
    // Dumb action to delay grabbing monster's intent until after it's actually set
    AbstractDungeon.actionManager.addToBottom(new AbstractGameAction()
    {
        @Override
        public void update()
        {
            if (owner instanceof AbstractMonster) {
                moveByte = ((AbstractMonster) owner).nextMove;
                moveIntent = ((AbstractMonster) owner).intent;
                try {
                    Field f = AbstractMonster.class.getDeclaredField("move");
                    f.setAccessible(true);
                    move = (EnemyMoveInfo) f.get(owner);
                    move.intent = AbstractMonster.Intent.STUN;
                    ((AbstractMonster) owner).createIntent();
                } catch (IllegalAccessException | NoSuchFieldException e) {
                    e.printStackTrace();
                }
            }
            isDone = true;
        }
    });
}
 
Example #4
Source File: ForceRippleOld.java    From FruityMod-StS with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new com.megacrit.cardcrawl.actions.common.DamageAction(m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn),
            AbstractGameAction.AttackEffect.SLASH_DIAGONAL));

    ArrayList<AbstractCard> nonEtherialCards = new ArrayList<AbstractCard>();

    for (AbstractCard card : p.hand.group) {
        if (card.isEthereal || card == this) continue;
        nonEtherialCards.add(card);
    }

    if (nonEtherialCards.size() > 0) {
        AbstractDungeon.actionManager.addToBottom(new ShuffleCardsToDrawPileAction(p, p, nonEtherialCards, true, true));
    }

}
 
Example #5
Source File: Retrograde.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_LIGHT));
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_HEAVY));
}
 
Example #6
Source File: CatharsisPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@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 #7
Source File: PhantasmPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public boolean onReceivePowerToCancel(AbstractPower power, AbstractCreature source) {
    if (power.ID.equals(IntangiblePlayerPower.POWER_ID) && power.owner == this.owner) {
        this.flash();
        AbstractDungeon.actionManager.addToBottom(new DamageAllEnemiesAction(this.owner, DamageInfo.createDamageMatrix(this.amount, true), DamageInfo.DamageType.THORNS, AbstractGameAction.AttackEffect.POISON, true));
    }
    return false;
}
 
Example #8
Source File: MirrorPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public boolean onDamageToRedirect(AbstractPlayer player, DamageInfo info, AbstractGameAction.AttackEffect attackEffect) {
    if (info.type != DamageInfo.DamageType.THORNS && info.type != DamageInfo.DamageType.HP_LOSS && info.owner != null && info.owner != this.owner) {
        this.flash();
        this.addToTop(new DamageAction(info.owner, new DamageInfo(this.owner, info.output, DamageInfo.DamageType.THORNS), attackEffect, false));
        return true;
    }
    return false;
}
 
Example #9
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 #10
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 #11
Source File: EventHorizonPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurn(boolean isPlayer) {
    if (isPlayer) {
        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
            int stackCount = GetPowerCount(m, "Weakened") + GetPowerCount(m, "Vulnerable");
            if (stackCount > 0) {
                AbstractDungeon.actionManager.addToBottom(
                        new DamageAction(m, new DamageInfo(null, this.amount * stackCount, DamageInfo.DamageType.THORNS), AbstractGameAction.AttackEffect.SLASH_HORIZONTAL, true));
            }
        }
    }
}
 
Example #12
Source File: PlasmaWaveAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public PlasmaWaveAction(AbstractPlayer p, int[] multiDamage, DamageInfo.DamageType damageType, boolean freeToPlayOnce, int energyOnUse) {
    this.multiDamage = multiDamage;
    this.damageType = damageType;
    this.p = p;
    this.freeToPlayOnce = freeToPlayOnce;
    if (freeToPlayOnce) {
        System.out.println("FREE TO PLAY");
    }
    this.duration = Settings.ACTION_DUR_XFAST;
    this.actionType = AbstractGameAction.ActionType.SPECIAL;
    this.energyOnUse = energyOnUse;
}
 
Example #13
Source File: PurgeMind.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    exhaustRememberCardsInGroup(p.hand);
    exhaustRememberCardsInGroup(p.drawPile);
    exhaustRememberCardsInGroup(p.discardPile);

    for (int i = 0; i < magicNumber; i++) {
        AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, damage), AbstractGameAction.AttackEffect.BLUNT_HEAVY, false));
    }

    AbstractDungeon.actionManager.addToBottom(new SnapAction(p));
}
 
Example #14
Source File: Comet.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (m != null) {
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new WeightyImpactEffect(m.hb.cX, m.hb.cY)));
    }
    AbstractDungeon.actionManager.addToBottom(new WaitAction(0.8f));
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m, new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL), AbstractGameAction.AttackEffect.NONE));
}
 
Example #15
Source File: SelectCardsToShuffleToDrawPileAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public SelectCardsToShuffleToDrawPileAction(AbstractCreature target, AbstractCreature source, int amount, boolean isRandom, boolean isOptional) {
    this.target = target;
    this.p = (AbstractPlayer) target;
    this.setValues(target, source, amount);
    this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
    this.isOptional = isOptional;
    this.isRandom = isRandom;
}
 
Example #16
Source File: AstralHazePower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public int onAttacked(DamageInfo info, int damageAmount) {
    if (info.type != DamageInfo.DamageType.THORNS && info.type != DamageInfo.DamageType.HP_LOSS
            && info.owner != null && info.owner != this.owner && !this.attackers.contains(info.owner)) {
        this.flash();
        this.attackers.add(info.owner);
        AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(info.owner, this.owner,
                new WeakPower(info.owner, this.amount, true), this.amount, true, AbstractGameAction.AttackEffect.NONE));
        AbstractDungeon.actionManager.addToTop(
                new ApplyPowerAction(info.owner, this.owner, new VulnerablePower(info.owner, this.amount, true), this.amount,
                        true, AbstractGameAction.AttackEffect.NONE));
    }
    return damageAmount;
}
 
Example #17
Source File: Tragedy.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {

    exhaustCursesInGroup(p.hand);
    exhaustCursesInGroup(p.drawPile);
    exhaustCursesInGroup(p.discardPile);

    for (int i = 0; i < magicNumber; ++i) {
        addToBot(new DamageAction(m, new DamageInfo(p, damage), AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example #18
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 #19
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 #20
Source File: WastingFormPower.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 DamageAllEnemiesAction(this.owner, DamageInfo.createDamageMatrix(this.amount, true), DamageInfo.DamageType.THORNS, AbstractGameAction.AttackEffect.POISON, true));
    }
}
 
Example #21
Source File: SeekerMod.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receiveCardUsed(AbstractCard c) {
    AbstractPlayer p = AbstractDungeon.player;
    if (p.hasPower("EnigmaPower") && c.cardID.equals("Dazed")) {
        AbstractDungeon.actionManager.addToTop(new GainBlockAction(p, p, c.block));
        AbstractDungeon.actionManager.addToTop(new DamageAllEnemiesAction(AbstractDungeon.player,
                c.multiDamage,
                DamageInfo.DamageType.NORMAL, AbstractGameAction.AttackEffect.FIRE, true));
        c.exhaustOnUseOnce = false;
    }
}
 
Example #22
Source File: OverkillPower.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(damageAmount > target.currentHealth){
        int overkillDamage = damageAmount - target.currentHealth;
        addToBot(new DamageAllEnemiesAction(this.owner,
                DamageInfo.createDamageMatrix(overkillDamage + this.amount, true),
                DamageInfo.DamageType.THORNS, AbstractGameAction.AttackEffect.SLASH_HORIZONTAL, true));
    }
}
 
Example #23
Source File: Wanderer.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public AbstractGameAction.AttackEffect[] getSpireHeartSlashEffect() {
    return new AbstractGameAction.AttackEffect[]{
            AbstractGameAction.AttackEffect.FIRE,
            AbstractGameAction.AttackEffect.POISON,
            AbstractGameAction.AttackEffect.FIRE};
}
 
Example #24
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 #25
Source File: KindnessMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onLosePassiveEffect() {
    for (AbstractGameAction restoreAction : this.restoreStrengthActions) {
        AbstractDungeon.actionManager.addToBottom(restoreAction);
    }
    restoreStrengthActions.clear();
}
 
Example #26
Source File: DefaultRareAttack.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (m != null) {
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new WeightyImpactEffect(m.hb.cX, m.hb.cY)));
    }
    AbstractDungeon.actionManager.addToBottom(
            new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                    AbstractGameAction.AttackEffect.NONE));

}
 
Example #27
Source File: NullStorm.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(new SFXAction("THUNDERCLAP", 0.05f));
    for (AbstractMonster mo : AbstractDungeon.getCurrRoom().monsters.monsters) {
        if (mo.isDeadOrEscaped())
            continue;
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new LightningEffect(mo.drawX, mo.drawY), 0.05f));
    }
    AbstractDungeon.actionManager.addToBottom(new DamageAllEnemiesAction(p, this.multiDamage,
            this.damageTypeForTurn, AbstractGameAction.AttackEffect.NONE));
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(new Dazed(), 1, true, true));
}
 
Example #28
Source File: TheTranquil.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public AbstractGameAction.AttackEffect[] getSpireHeartSlashEffect() {
    return new AbstractGameAction.AttackEffect[]{
            AbstractGameAction.AttackEffect.FIRE,
            AbstractGameAction.AttackEffect.BLUNT_HEAVY,
            AbstractGameAction.AttackEffect.FIRE};
}
 
Example #29
Source File: FlurryOfBlows.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public void use(AbstractPlayer player, AbstractMonster monster) {
    for (int i = 0; i < this.magicNumber; i++) {
        AbstractDungeon.actionManager.addToBottom(new DamageAction(monster,
                new DamageInfo(player, this.damage, this.damageTypeForTurn),
                AbstractGameAction.AttackEffect.SLASH_DIAGONAL));
    }
}
 
Example #30
Source File: FlyingKick.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom(
            new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_LIGHT));

    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p, new AttunedAttackPower(p)));
}