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

The following examples show how to use com.megacrit.cardcrawl.actions.common.DamageAction. 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: Starburst.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 DamageAction((AbstractCreature) m,
            new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL), AbstractGameAction.AttackEffect.BLUNT_HEAVY));

    AbstractRoom room = AbstractDungeon.currMapNode.room;
    int numMonsters = room.monsters.monsters.size();

    this.multiDamage = new int[numMonsters];
    for (int i = 0; i < multiDamage.length; i++) {
        this.multiDamage[i] = this.damage;
    }

    AbstractDungeon.actionManager.addToBottom(new VFXAction(AbstractDungeon.player, new CleaveEffect(), 0.0F));
    AbstractDungeon.actionManager.addToBottom(new DamageAllEnemiesAction(p, this.multiDamage, this.damageTypeForTurn,
            AbstractGameAction.AttackEffect.NONE));
}
 
Example #2
Source File: ChainLightning.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    this.currentChainHopIndex = 0;

    getRandomOrderMonsters(AbstractDungeon.getMonsters().monsters, m)
            .forEach(monster -> {
                this.calculateCardDamage(monster);
                AbstractDungeon.actionManager.addToBottom(new DamageAction(
                        monster,
                        new DamageInfo(p, this.damage, DamageInfo.DamageType.NORMAL),
                        AttackEffect.NONE));
                addLightningEffect(monster, this.currentChainHopIndex);
                this.currentChainHopIndex += 1;
            });

    this.currentChainHopIndex = 0;
}
 
Example #3
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 #4
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 #5
Source File: WormholePower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostDraw(AbstractCard c) {
    AbstractPlayer player = (AbstractPlayer) owner;
    if (c.isEthereal) {
        this.flash();

        AbstractDungeon.actionManager.addToBottom(new DamageAction(
                AbstractDungeon.getMonsters().getRandomMonster(true),
                new DamageInfo(player, this.amount, DamageInfo.DamageType.THORNS), AbstractGameAction.AttackEffect.FIRE));
    }

}
 
Example #6
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 #7
Source File: DefaultAttackWithVariable.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    // Create an int which equals to your current energy.
    int effect = EnergyPanel.totalCount;

    // For each energy, create 1 damage action.
    for (int i = 0; i < effect; i++) {
        AbstractDungeon.actionManager.addToBottom(
                new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                        AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example #8
Source File: DefaultCommonAttack.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom( // The action managed queues all the actions a card should do.
            // addToTop - first
            // addToBottom - last
            // 99.99% of the time you just want to addToBottom all of them.
            // Please do that unless you need to add to top for some specific reason.
            new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                    // a list of existing actions can be found at com.megacrit.cardcrawl.actions but
                    // Chances are you'd instead look at "hey my card is similar to this basegame card"
                    // Let's find out what action *it* uses.
                    // I.e. i want energy gain or card draw, lemme check out Adrenaline
                    // P.s. if you want to damage ALL enemies OUTSIDE of a card, check out the custom orb.
                    AbstractGameAction.AttackEffect.SLASH_HORIZONTAL)); // The animation the damage action uses to hit.
}
 
Example #9
Source File: ReflectionWardPower.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.flash();
        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
            if (!m.isDead && !m.isDying)
                AbstractDungeon.actionManager.addToTop(new DamageAction(m, this.thornsInfo, AbstractGameAction.AttackEffect.SLASH_HORIZONTAL, true));
        }
    }
    return damageAmount;
}
 
Example #10
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 #11
Source File: UnstableOrb.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.SLASH_HEAVY));
    AbstractDungeon.actionManager.addToBottom(
            new ApplyPowerAction(p, p, new WeakPower(p, this.magicNumber, false), this.magicNumber, true));
}
 
Example #12
Source File: Channel.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.SLASH_HEAVY)));
    Channel that = this; // funny little naming convention for providing this to inner class
    ITopCycleCallback cb = new ITopCycleCallback() {
        @Override
        public void processCard(AbstractCard c) {
            if (c.isEthereal) {
                AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m, new DamageInfo(p, that.damage, that.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_HEAVY));
            }
        }
    };
    AbstractDungeon.actionManager.addToBottom(new ChannelAction(p, DISCARD_AMT, cb));
}
 
Example #13
Source File: Surge.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.SLASH_VERTICAL));
    if (AbstractDungeon.player.hasPower("Frail") || AbstractDungeon.player.hasPower("Vulnerable") || AbstractDungeon.player.hasPower("Weakened")) {
        AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_VERTICAL));
    }
}
 
Example #14
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 #15
Source File: EtherBlast.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToTop(new DamageAction(m, new DamageInfo(p, calculateDamage(), this.damageTypeForTurn), true));
    AbstractDungeon.actionManager.addToTop(new VFXAction(new ThrowDaggerEffect(m.hb.cX, m.hb.cY)));

    this.rawDescription = DESCRIPTION;
    initializeDescription();
}
 
Example #16
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 #17
Source File: Umbra.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (p.hasPower(VulnerablePower.POWER_ID) || p.hasPower(FrailPower.POWER_ID)) {
        addToBot(new GainBlockAction(p, block));
    }
    if (p.hasPower(WeakPower.POWER_ID)) {
        addToBot(new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example #18
Source File: Singularity.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 GainBlockAction(p, p, this.block));
    AbstractDungeon.actionManager.addToBottom(new WaitAction(0.1f));
    if (p != null && m != null) {
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new IronWaveEffect(p.hb.cX, p.hb.cY, m.hb.cX), 0.5f));
    }
    AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_VERTICAL));
    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p, new EnergizedPower(p, this.magicNumber), this.magicNumber));
}
 
Example #19
Source File: ForceRippleAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void update() {
    int effect = EnergyPanel.totalCount;
    if (this.energyOnUse != -1) {
        effect = this.energyOnUse;
    }
    if (this.p.hasRelic("Chemical X")) {
        effect += 2;
        this.p.getRelic("Chemical X").flash();
    }
    if (effect > 0) {
        for (int i = 0; i < effect; i++) {
            AbstractDungeon.actionManager.addToBottom(new SFXAction("ATTACK_HEAVY"));
            AbstractDungeon.actionManager.addToBottom(new VFXAction(this.p, new CleaveEffect(), 0.0f));
            AbstractDungeon.actionManager.addToBottom(new DamageAction(this.m,
                    new DamageInfo(p, this.damage, this.damageType),
                    AbstractGameAction.AttackEffect.SLASH_DIAGONAL));
        }
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(p, p, new VulnerablePower(p, this.energyOnUse, false), this.energyOnUse, true, AbstractGameAction.AttackEffect.NONE));
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(p, p, new WeakPower(p, this.energyOnUse, false), this.energyOnUse, true, AbstractGameAction.AttackEffect.NONE));
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(p, p, new FrailPower(p, this.energyOnUse, false), this.energyOnUse, true, AbstractGameAction.AttackEffect.NONE));
        if (!this.freeToPlayOnce) {
            this.p.energy.use(EnergyPanel.totalCount);
        }
    }
    this.isDone = true;
}
 
Example #20
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)));
}
 
Example #21
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 #22
Source File: MirrorImagePower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public boolean onDamageToRedirect(AbstractPlayer player, DamageInfo info, AttackEffect effect) {
    if (info.type == DamageType.NORMAL &&
        info.owner != null &&
        info.owner != player &&
        this.minion != null &&
        !this.minion.isDead)
    {
        AbstractDungeon.actionManager.addToTop(new DamageAction(this.minion, info, effect));
        return true;
    }
    return false;
}
 
Example #23
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 #24
Source File: BlackTentaclesPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public int onAnyMonsterHpLoss(AbstractMonster monster, DamageInfo originalDamageInfo, int originalHpLoss) {
    // We accept null owner primarily for the sake of ExplosivePotion, see #299.
    boolean isDamageFromApplicableSource = originalDamageInfo != null && (originalDamageInfo.owner == null || originalDamageInfo.owner == this.source);

    if (monster != owner && isDamageFromApplicableSource && originalHpLoss > 0 && !owner.isDeadOrEscaped() && !owner.halfDead) {
        this.flash();
        DamageType newDamageType = originalDamageInfo.type == DamageType.HP_LOSS ? DamageType.HP_LOSS : DamageType.THORNS;
        DamageInfo newDamageInfo = new DamageInfo(source, originalHpLoss, newDamageType);
        AbstractDungeon.actionManager.addToTop(new DamageAction(owner, newDamageInfo, AttackEffect.SLASH_DIAGONAL));
        return 0;
    }
    return originalHpLoss;
}
 
Example #25
Source File: Hurt.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.SLASH_HEAVY));

    if (magicNumber > 0) {
        addToBot(new DamageAction(p, new DamageInfo(p, magicNumber, DamageInfo.DamageType.HP_LOSS), AttackEffect.SHIELD));
    }
}
 
Example #26
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 #27
Source File: Mania.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.SLASH_VERTICAL));

    if (isEligibleForExtraEffect()) {
        addToBot(new GainEnergyAction(metaMagicNumber));
        addToBot(new DrawCardAction(p, urMagicNumber));
    }
}
 
Example #28
Source File: FracturedMind.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractMemory currentMemory = MemoryManager.forPlayer(p).currentMemory;
    boolean isSnapped = MemoryManager.forPlayer(p).isSnapped();
    boolean rememberingSin = currentMemory != null && currentMemory.memoryType == MemoryType.SIN;
    boolean rememberingVirtue = currentMemory != null && currentMemory.memoryType == MemoryType.VIRTUE;

    if (rememberingSin || isSnapped) {
        addToBot(new DamageAction(m, new DamageInfo(p, damage), AttackEffect.BLUNT_LIGHT));
    }

    if (rememberingVirtue || isSnapped) {
        addToBot(new GainBlockAction(p, p, block));
    }
}
 
Example #29
Source File: DeathThroes.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 (upgraded) {
        addToBot(new GainSpecificClarityAction(p, WrathMemory.STATIC.ID));
    } else {
        addToBot(new RememberSpecificMemoryAction(p, WrathMemory.STATIC.ID));
    }
}
 
Example #30
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)));
    }
}