com.megacrit.cardcrawl.dungeons.AbstractDungeon Java Examples

The following examples show how to use com.megacrit.cardcrawl.dungeons.AbstractDungeon. 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: PlasmaWaveAction.java    From FruityMod-StS with MIT License 6 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 DamageAllEnemiesAction(p, this.multiDamage, this.damageType, AbstractGameAction.AttackEffect.NONE, true));
        }
        if (!this.freeToPlayOnce) {
            this.p.energy.use(EnergyPanel.totalCount);
        }
    }
    this.isDone = true;
}
 
Example #2
Source File: OnLoseBlockPatch.java    From StSLib with MIT License 6 votes vote down vote up
public static SpireReturn<Integer> Prefix(AbstractCreature __instance, DamageInfo info, @ByRef int[] damageAmount)
{
    if (info.type != DamageInfo.DamageType.HP_LOSS && __instance.currentBlock > 0) {
        for (AbstractPower power : __instance.powers) {
            if (power instanceof OnLoseBlockPower) {
                damageAmount[0] = ((OnLoseBlockPower) power).onLoseBlock(info, damageAmount[0]);
            }
        }
        if (__instance.isPlayer) {
            for (AbstractRelic relic : AbstractDungeon.player.relics) {
                if (relic instanceof OnLoseBlockRelic) {
                    damageAmount[0] = ((OnLoseBlockRelic) relic).onLoseBlock(info, damageAmount[0]);
                }
            }
        }
    }

    return SpireReturn.Continue();
}
 
Example #3
Source File: IncreaseManifestAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void update() {
    if (this.duration == this.startDuration) {
        String msg = amount < 0 ?  String.format(TEXT[1], amount) : String.format(TEXT[0], amount);
        Color msgColor = amount < 0 ? Settings.GREEN_TEXT_COLOR : Settings.RED_TEXT_COLOR;
        AbstractDungeon.effectsQueue.add(new TextAboveCreatureEffect(target.hb.cX - target.animX, target.hb.cY, msg, msgColor));
    }

    this.tickDuration();

    if (isDone) {
        int originalManifest = ManifestPatch.PlayerManifestField.manifestField.get(target);
        int newManifest = Math.max(0, originalManifest + amount);
        ManifestPatch.PlayerManifestField.manifestField.set(target, newManifest);
    }
}
 
Example #4
Source File: PrideMemory.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onVictory() {
    if (isPassiveEffectActive()) {
        CardGroup masterDeckCandidates = new CardGroup(CardGroup.CardGroupType.UNSPECIFIED);
        for (AbstractCard c : AbstractDungeon.player.masterDeck.group) {
            if (c.canUpgrade()) {
                masterDeckCandidates.addToBottom(c);
            }
        }

        if (!masterDeckCandidates.isEmpty()) {
            AbstractCard masterDeckCard = masterDeckCandidates.getRandomCard(AbstractDungeon.cardRandomRng);
            masterDeckCard.upgrade();
            masterDeckCard.superFlash();
            EffectUtils.addPermanentCardUpgradeEffect(masterDeckCard);
        }
    }
}
 
Example #5
Source File: PatronAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void update() {
    if (duration == baseDuration && this.target != null) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.target.hb.cX, this.target.hb.cY, AttackEffect.NONE));
        this.target.damage(this.info);
        updateCard.accept(card); // perform downgrade/destroy
        if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
            AbstractDungeon.actionManager.clearPostCombatActions();
        }
    }

    tickDuration();
    if (isDone) {
        AbstractDungeon.actionManager.addToBottom(new ConsumerGameAction<>(showEffect, card));
    }
}
 
Example #6
Source File: UncommonPowerAction.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
@Override
public void update() {
    int effect = EnergyPanel.totalCount;
    if (energyOnUse != -1) {
        effect = energyOnUse;
    }
    if (p.hasRelic(ChemicalX.ID)) {
        effect += 2;
        p.getRelic(ChemicalX.ID).flash();
    }
    if (upgraded) {
        ++effect;
    }
    if (effect > 0) {
        for (int i = 0; i < effect; ++i) {
            
            AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(p, p,
                    new CommonPower(p, p, magicNumber), magicNumber,
                    AttackEffect.BLUNT_LIGHT));
        }
        if (!freeToPlayOnce) {
            p.energy.use(EnergyPanel.totalCount);
        }
    }
    isDone = true;
}
 
Example #7
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 #8
Source File: CardMetaUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static void playCardAdditionalTime(AbstractCard card, AbstractMonster target) {
    AbstractCard tmp = card.makeSameInstanceOf();
    AbstractDungeon.player.limbo.addToBottom(tmp);
    tmp.current_x = card.current_x;
    tmp.current_y = card.current_y;
    tmp.target_x = (float) Settings.WIDTH / 2.0F - 300.0F * Settings.scale;
    tmp.target_y = (float)Settings.HEIGHT / 2.0F;
    if (tmp.cost > 0) {
        tmp.freeToPlayOnce = true;
    }

    if (target != null) {
        tmp.calculateCardDamage(target);
    }

    tmp.purgeOnUse = true;

    AbstractDungeon.actionManager.addCardQueueItem(new CardQueueItem(tmp, target, card.energyOnUse, true, true), true);
}
 
Example #9
Source File: DrainLifeAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public void update() {
    if (this.shouldCancelAction()) {
        this.isDone = true;
    } else {
        this.tickDuration();
        if (this.isDone) {
            AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.target.hb.cX, this.target.hb.cY, AttackEffect.FIRE, false));
            this.target.damage(this.info);
            if (this.target.lastDamageTaken > 0) {
                AbstractDungeon.player.increaseMaxHp(this.target.lastDamageTaken, true);
            }

            if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
                AbstractDungeon.actionManager.clearPostCombatActions();
            } else {
                AbstractDungeon.actionManager.addToTop(new WaitAction(0.1F));
            }
        }

    }
}
 
Example #10
Source File: JorbsMod.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void receivePowersModified() {
    if (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT &&
            !AbstractDungeon.getMonsters().areMonstersBasicallyDead()) {
        for (AbstractPower p : AbstractDungeon.player.powers) {
            if (p instanceof OnPowersModifiedSubscriber) {
                ((OnPowersModifiedSubscriber) p).receivePowersModified();
            }
        }
        MemoryManager mm = MemoryManager.forPlayer();
        if (mm != null) {
            for (AbstractMemory m : mm.allMemoriesIncludingInactive()) {
                if (m instanceof OnPowersModifiedSubscriber) {
                    ((OnPowersModifiedSubscriber) m).receivePowersModified();
                }
            }
        }
    }
}
 
Example #11
Source File: MindGlassRelic.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onGainClarity(String id) {
    ++this.counter;
    this.flash();
    if (this.counter == 10) {
        this.stopPulse();
    } else if (this.counter == 9) {
        AbstractDungeon.actionManager.addToBottom(new RelicAboveCreatureAction(AbstractDungeon.player, this));
        AbstractDungeon.actionManager.addToBottom(
                new ApplyPowerAction(
                        AbstractDungeon.player,
                        AbstractDungeon.player,
                        new MindGlassPower(AbstractDungeon.player, TEN_CLARITY_DAMAGE),
                        1,
                        true));
    }
    AbstractDungeon.actionManager.addToBottom(
            new DamageAllEnemiesAction(
                    null,
                    DamageInfo.createDamageMatrix(ONE_CLARITY_DAMAGE, true),
                    DamageInfo.DamageType.NORMAL,
                    // TODO: More impactful and relevant FX. See FlashAtkImgEffect.loadImage() and
                    //  FlashAtkImgEffect.playSound() for usage of AttackEffect in base game.
                    AbstractGameAction.AttackEffect.BLUNT_LIGHT));
}
 
Example #12
Source File: EffectUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static void addWrathCardUpgradeEffect(AbstractCard cardToShowForVfx) {
    AbstractCard card = cardToShowForVfx.makeStatEquivalentCopy();
    ShowCardBrieflyEffect showCardBrieflyEffect = new ShowCardBrieflyEffect(card);
    float duration = Settings.FAST_MODE ? Settings.ACTION_DUR_XLONG : showCardBrieflyEffect.startingDuration;
    showCardBrieflyEffect.duration = showCardBrieflyEffect.startingDuration = duration;
    AbstractDungeon.topLevelEffects.add(showCardBrieflyEffect);
    AbstractDungeon.topLevelEffects.add(new GradeChangeShineEffect(
            (float) Settings.WIDTH / 2.0F,
            (float) Settings.HEIGHT / 2.0F,
            Settings.ACTION_DUR_MED,
            () -> CardCrawlGame.sound.playAV("CARD_BURN", -0.5F, 2.0F),
            () -> getWrathEffect(card),
            null,
            false));
    AbstractDungeon.actionManager.addToTop(new WaitAction(duration));
}
 
Example #13
Source File: SeekerMod.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePowersModified() {
    AbstractPlayer p = AbstractDungeon.player;

    if (p != null && p.hasRelic("PaperPengwin")) {
        if (moreThanXStacks(p, "Weakened", PaperPengwin.MIN_STACKS) ||
                moreThanXStacks(p, "Vulnerable", PaperPengwin.MIN_STACKS) ||
                moreThanXStacks(p, "Frail", PaperPengwin.MIN_STACKS)) {
            if (!isApplyingPaperPengwin) {
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(p, p, new DexterityPower(p, PaperPengwin.MIN_STACKS), PaperPengwin.MIN_STACKS));
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(p, p, new StrengthPower(p, PaperPengwin.MIN_STACKS), PaperPengwin.MIN_STACKS));
                isApplyingPaperPengwin = true;
                p.getRelic("PaperPengwin").flash();
                ((PaperPengwin) p.getRelic("PaperPengwin")).setPulse(true);
            }
        } else {
            if (isApplyingPaperPengwin) {
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(p, p, new DexterityPower(p, -1 * PaperPengwin.MIN_STACKS), -1 * PaperPengwin.MIN_STACKS));
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(p, p, new StrengthPower(p, -1 * PaperPengwin.MIN_STACKS), -1 * PaperPengwin.MIN_STACKS));
                isApplyingPaperPengwin = false;
                ((PaperPengwin) p.getRelic("PaperPengwin")).setPulse(false);
            }
        }
    }
}
 
Example #14
Source File: Shake.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private boolean isEligibleForExtraEffect() {

        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
            if (!m.isDeadOrEscaped() && m.hasPower(VulnerablePower.POWER_ID)) {
                return true;
            }
        }
        return false;
    }
 
Example #15
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 #16
Source File: Voiceover.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public Voiceover(Sfx sfx, String subtitle, float startingDelay, float dampeningDuration) {
    this.sfx = sfx;
    this.source = AbstractDungeon.player;
    this.subtitle = subtitle;
    this.dampeningDuration = dampeningDuration;

    if (startingDelay > 0.0F) {
        this.duration = startingDelay;
        this.state = State.INITIAL_DELAY;
    } else {
        this.duration = dampeningDuration;
        this.state = State.DAMPENING_MASTER_VOLUME;
    }
}
 
Example #17
Source File: DefaultRareSkill.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    for (int i = 0; i < TIMES; i++) {
        for (final AbstractMonster mo : AbstractDungeon.getCurrRoom().monsters.monsters) {
            AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(mo, p,
                    new VulnerablePower(mo, magicNumber, false), magicNumber));
        }
    }

}
 
Example #18
Source File: StrokeOfGenius.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void optionSelected(AbstractPlayer p, AbstractMonster m, int i) {
    CardType type;
    switch (i) {
        case 0:
            type = CardType.ATTACK;
            break;
        case 1:
            type = CardType.SKILL;
            break;
        case 2:
            type = CardType.POWER;
            break;
        default:
            return;
    }

    AbstractCard c;
    if (type == CardType.ATTACK) {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.ATTACK).makeCopy();
    } else if (type == CardType.SKILL) {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.SKILL).makeCopy();
    } else {
        c = AbstractDungeon.returnTrulyRandomCardInCombat(CardType.POWER).makeCopy();
    }
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInHandAction(c, true));
    c.setCostForTurn(0);
}
 
Example #19
Source File: Genesis.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));
    if (AbstractDungeon.player.drawPile.isEmpty()) {
        AbstractDungeon.actionManager.addToBottom(new EmptyDeckShuffleAction());
    }
    AbstractDungeon.actionManager.addToBottom(new DrawCardAction(p, this.magicNumber));
}
 
Example #20
Source File: RetrogradePower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void atEndOfTurn(boolean isPlayer) {
    if (isPlayer)
        this.flash();
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(new Retrograde(), this.amount, true, true));
    AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(AbstractDungeon.player, AbstractDungeon.player, "RetrogradePower"));
}
 
Example #21
Source File: Retrograde.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void triggerWhenDrawn() {
    updateCost(-1);
    if (this.canUse(AbstractDungeon.player, null)) {
        beginGlowing();
    } else {
        stopGlowing();
    }
}
 
Example #22
Source File: Cull.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void decreaseMaxHealth(int amount) {
    boolean isFatal = amount >= maxHealth;
    super.decreaseMaxHealth(amount);
    if (isFatal) {
        currentHealth = 0;
        maxHealth = 0;
        isDead = true;
        AbstractDungeon.deathScreen = new DeathScreen(AbstractDungeon.getMonsters());
    }
}
 
Example #23
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 #24
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 #25
Source File: SeekerMod.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public static boolean hasRelicCustom(String relicID, AbstractCard card) {
    System.out.println("I was checked!");
    // if it's checking for relicID.equals("Medical Kit") then we know we're in the block where
    // we are saying if we can use a status card so also check if we have enigma and the card is Dazed
    if (relicID.equals("Medical Kit") && AbstractDungeon.player.hasPower("EnigmaPower") && card.cardID.equals("Dazed")) {
        return true;
    } else {
        // otherwise leave normal behavior intact
        return AbstractDungeon.player.hasRelic(relicID);
    }
}
 
Example #26
Source File: MemoryFtueTip.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static boolean shouldFakeBeingRemembered(AbstractMemory m) {
    return
            AbstractDungeon.screen == AbstractDungeon.CurrentScreen.FTUE &&
            AbstractDungeon.ftue != null &&
            AbstractDungeon.ftue instanceof MemoryFtueTip &&
            m.ID.equals(PatienceMemory.STATIC.ID);
}
 
Example #27
Source File: Toll.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
protected int calculateBonusBaseDamage() {
    int bonusDamage = 0;
    for(AbstractRelic relic : AbstractDungeon.player.relics){
        if (relic.counter >= 0) {
            bonusDamage += relic.counter;
        }
    }
    return bonusDamage*magicNumber;
}
 
Example #28
Source File: LegendaryPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static AbstractCard patch(AbstractCard.CardType type, Random rng) {
    ArrayList<AbstractCard> cards =
            CardGroup.getGroupWithoutBottledCards(AbstractDungeon.player.masterDeck).group.stream()
                    .filter(c -> c.type == type && !c.hasTag(LEGENDARY))
                    .collect(Collectors.toCollection(ArrayList::new));
    return cards.remove(rng.random(cards.size() - 1));
}
 
Example #29
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 #30
Source File: DefaultOrb.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void onStartOfTurn() {// 1.At the start of your turn.
    AbstractDungeon.actionManager.addToBottom(// 2.This orb will have a flare effect
            new VFXAction(new OrbFlareEffect(this, OrbFlareEffect.OrbFlareColor.FROST), 0.1f));

    AbstractDungeon.actionManager.addToBottom(// 3. And draw you cards.
            new DrawCardAction(AbstractDungeon.player, passiveAmount));
}