com.megacrit.cardcrawl.cards.DamageInfo Java Examples

The following examples show how to use com.megacrit.cardcrawl.cards.DamageInfo. 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: 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 #2
Source File: OnPlayerDeathPatch.java    From StSLib with MIT License 6 votes vote down vote up
@SpireInsertPatch(
        locator=Locator.class
)
public static SpireReturn Insert(AbstractPlayer __instance, DamageInfo info)
{
    for (AbstractPower power : __instance.powers) {
        if (power instanceof OnPlayerDeathPower) {
            if (!((OnPlayerDeathPower) power).onPlayerDeath(__instance, info)) {
                return SpireReturn.Return(null);
            }
        }
    }

    for (AbstractRelic relic : __instance.relics) {
        if (relic instanceof OnPlayerDeathRelic) {
            if (!((OnPlayerDeathRelic) relic).onPlayerDeath(__instance, info)) {
                return SpireReturn.Return(null);
            }
        }
    }
    return SpireReturn.Continue();
}
 
Example #3
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 #4
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 #5
Source File: FlickerPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public float atDamageReceive(float damage, DamageInfo.DamageType damageType) {
    if (damageType == DamageInfo.DamageType.NORMAL && this.owner.hasPower("Vulnerable")) {
        if (AbstractDungeon.player.hasRelic("Odd Mushroom")) {
            return damage * 0.6f; // -25% (3/4) instead of +25% (5/4) damage 
        }
        return damage * 0.34f; // -50% (1/2) instead of +50% (3/2) damage
    }
    return damage;
}
 
Example #6
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 #7
Source File: PrismaticSphere.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.drawPile.isEmpty()) {
        AbstractDungeon.actionManager.addToBottom(new EmptyDeckShuffleAction());
    }
    AbstractDungeon.actionManager.addToBottom(new DrawCardAction(p, this.magicNumber));
}
 
Example #8
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 #9
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 #10
Source File: Flare.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 com.megacrit.cardcrawl.actions.common.DamageAction(m,
            new DamageInfo(p, this.damage, this.damageTypeForTurn),
            AbstractGameAction.AttackEffect.SLASH_DIAGONAL));
    AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, new VulnerablePower(m, this.magicNumber, false), this.magicNumber, true, AbstractGameAction.AttackEffect.NONE));
}
 
Example #11
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 #12
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 #13
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 #14
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 #15
Source File: Ectoplasm_Cull.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), AbstractGameAction.AttackEffect.POISON));

    for(int i = 0; i < magicNumber; ++i) {
        AbstractDungeon.effectList.add(new GainPennyEffect(p, p.hb.cX, p.hb.cY, p.hb.cX, p.hb.cY, true));
    }
    AbstractDungeon.player.gainGold(magicNumber);
}
 
Example #16
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 #17
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 #18
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 #19
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 #20
Source File: ChatteringStrike.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.BLUNT_LIGHT));

    // Note: this avoids the extra copy generating another extra copy itself, but it also avoids copies from Gather
    // Power or Quicksilver generating additional extra copies (they're intended to only do one copy per stack)
    if (!this.purgeOnUse) {
        for (int i = 0; i < magicNumber; ++i) {
            CardMetaUtils.playCardAdditionalTime(this, m);
        }
    }
}
 
Example #21
Source File: FlickerPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public float atDamageGive(float damage, DamageInfo.DamageType type) {
    if (type == DamageInfo.DamageType.NORMAL && this.owner.hasPower("Weakened")) {
        return damage * 1.67f;
    }
    return damage;
}
 
Example #22
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 #23
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 #24
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 #25
Source File: Patron.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (upgraded) {
        addToBot(new PatronAction(m, new DamageInfo(p, damage), this, CardMetaUtils::downgradeCardPermanently, EffectUtils::showDowngradeEffect));
    } else {
        addToBot(new PatronAction(m, new DamageInfo(p, damage), this, CardMetaUtils::destroyCardPermanently, EffectUtils::showDestroyEffect));
    }
}
 
Example #26
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 #27
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 #28
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 #29
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 #30
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;
}