Java Code Examples for com.megacrit.cardcrawl.dungeons.AbstractDungeon#getCurrRoom()

The following examples show how to use com.megacrit.cardcrawl.dungeons.AbstractDungeon#getCurrRoom() . 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: 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 2
Source File: ExposeAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void update() {
    if (duration == baseDuration) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.target.hb.cX, this.target.hb.cY, AttackEffect.BLUNT_HEAVY));
    }
    tickDuration();
    if (isDone) {
        this.target.damage(this.info);

        boolean nonMinionsLeft = false;
        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
            if (!m.isDeadOrEscaped() && !m.hasPower(MinionPower.POWER_ID)) {
                nonMinionsLeft = true;
            }
        }
        if (nonMinionsLeft) {
            AbstractPlayer p = AbstractDungeon.player;
            AbstractDungeon.actionManager.addToBottom(new LoseHPAction(p, p, hpLoss));
        }
        if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
            AbstractDungeon.actionManager.clearPostCombatActions();
        }
    }
}
 
Example 3
Source File: Channeling.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public int calculateBonusMagicNumber() {
    int channelCount = 0;
    for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
        if (!m.isDying && m.currentHealth > 0 && !m.isEscaping) {
            if (IntentUtils.isAttackIntent(m.intent)) {
                if ((boolean)ReflectionHacks.getPrivate(m, AbstractMonster.class, "isMultiDmg")) {
                    channelCount += (int)ReflectionHacks.getPrivate(m, AbstractMonster.class, "intentMultiAmt");
                } else {
                    ++channelCount;
                }
            }
        }
    }
    return channelCount;
}
 
Example 4
Source File: BottledMemoryRelic.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void update() {
    super.update();
    if (!this.cardSelected && !AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) {
        this.cardSelected = true;
        this.card = AbstractDungeon.gridSelectScreen.selectedCards.get(0);
        inBottleMemory.set(card, true);
        AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE;
        AbstractDungeon.gridSelectScreen.selectedCards.clear();
        this.description = this.DESCRIPTIONS[2] + FontHelper.colorString(this.card.name, "y") + this.DESCRIPTIONS[3];
        this.tips.clear();
        this.tips.add(new PowerTip(this.name, this.description));
        this.initializeTips();
    }

}
 
Example 5
Source File: BottledMemoryRelic.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onEquip() {
    // follow same behavior as base game bottle relics. Maybe there's some mod that adds a bottle mechanic changing card using getPurgeableCards
    CardGroup rememberCards = CardUtils.getCardsForBottling(AbstractDungeon.player.masterDeck.getPurgeableCards());
    rememberCards.group.removeIf(c -> !c.hasTag(REMEMBER_MEMORY));
    if (rememberCards.size() > 0) {
        this.cardSelected = false;
        if (AbstractDungeon.isScreenUp) {
            AbstractDungeon.dynamicBanner.hide();
            AbstractDungeon.overlayMenu.cancelButton.hide();
            AbstractDungeon.previousScreen = AbstractDungeon.screen;
        }

        AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.INCOMPLETE;
        AbstractDungeon.gridSelectScreen.open(rememberCards, 1, this.DESCRIPTIONS[1] + this.name + LocalizedStrings.PERIOD, false, false, false, false);
    }
}
 
Example 6
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 7
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 8
Source File: BottledPlaceholderRelic.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void onEquip() { // 1. When we acquire the relic
    cardSelected = false; // 2. Tell the relic that we haven't bottled the card yet
    if (AbstractDungeon.isScreenUp) { // 3. If the map is open - hide it.
        AbstractDungeon.dynamicBanner.hide();
        AbstractDungeon.overlayMenu.cancelButton.hide();
        AbstractDungeon.previousScreen = AbstractDungeon.screen;
    }
    AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.INCOMPLETE;
    // 4. Set the room to INCOMPLETE - don't allow us to use the map, etc.
    CardGroup group = CardGroup.getGroupWithoutBottledCards(AbstractDungeon.player.masterDeck); // 5. Get a card group of all currently unbottled cards
    AbstractDungeon.gridSelectScreen.open(group, 1, DESCRIPTIONS[3] + name + DESCRIPTIONS[2], false, false, false, false);
    // 6. Open the grid selection screen with the cards from the CardGroup we specified above. The description reads "Select a card to bottle for" + (relic name) + "."
}
 
Example 9
Source File: VoiceoverMaster.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private static VoiceoverInfo getSfxByCurrentBattle() {
    if (!CombatUtils.isInCombat() || AbstractDungeon.getCurrRoom().monsters == null) {
        return null;
    }
    String encounterKey = VoiceoverMasterPatch.MonsterGroup_class.encounterKeyField.get(AbstractDungeon.getCurrRoom().monsters);
    if (encounterKey == null) {
        return null;
    }

    if (encounterKey.equals(LAGAVULIN_EVENT_ENC)) {
        encounterKey = LAGAVULIN_ENC;
    }

    return getSfxByKey(encounterKey);
}
 
Example 10
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 11
Source File: CampfireThirstEffect.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (!AbstractDungeon.isScreenUp) {
        this.duration -= Gdx.graphics.getDeltaTime();
        this.updateBlackScreenColor();
    }

    if (!AbstractDungeon.isScreenUp && !AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) {
        for (AbstractCard c : AbstractDungeon.gridSelectScreen.selectedCards) {
            int wrathStacks = WrathField.wrathEffectCount.get(c);
            int healAmount = wrathStacks * this.healPerWrathStack;
            int maxHPIncreaseAmount = wrathStacks * this.maxHPPerWrathStack;

            WrathField.wrathEffectCount.set(c, 0);
            AbstractDungeon.player.heal(healAmount);
            AbstractDungeon.player.increaseMaxHp(maxHPIncreaseAmount, true);
            AbstractDungeon.effectsQueue.add(new ShowCardBrieflyEffect(c.makeStatEquivalentCopy()));
        }

        AbstractDungeon.gridSelectScreen.selectedCards.clear();
        ((RestRoom)AbstractDungeon.getCurrRoom()).fadeIn();
    }

    if (this.duration < 1.0F && !this.openedScreen) {
        this.openedScreen = true;

        // Currently this is piggy backing off of the Toke / purge grid screen as its UX is close enough for a v1
        // could probably stand to patch GridCardSelectScreen to make it a bit friendlier
        AbstractDungeon.gridSelectScreen.open(CampfireThirstPatch.getWrathCards(),1, TEXT[0], false, false, true, true);
    }

    if (this.duration < 0.0F) {
        this.isDone = true;
        if (CampfireUI.hidden) {
            AbstractRoom.waitTimer = 0.0F;
            AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE;
            ((RestRoom)AbstractDungeon.getCurrRoom()).cutFireSound();
        }
    }
}
 
Example 12
Source File: MagicMirrorPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void onPowerReceived(AbstractPower originalPower) {
    if (originalPower.type == PowerType.DEBUFF) {
        for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters) {
            if (!m.isDeadOrEscaped()) {
                for (int i = 0; i < this.amount; ++i) {
                    AbstractPower reflectedPower = tryCreateReflectedPower(m, owner, originalPower);
                    if (reflectedPower != null) {
                        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, owner, reflectedPower));
                    }
                }
            }
        }
    }
}
 
Example 13
Source File: DamageSomeEnemiesAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public static boolean[] CheckTargets(Predicate<AbstractMonster> condition) {
    ArrayList<AbstractMonster> monsters = AbstractDungeon.getCurrRoom().monsters.monsters;
    boolean[] targets = new boolean[monsters.size()];
    for (int i = 0, l = targets.length; i < l; ++i) {
        targets[i] = condition.test(monsters.get(i));
    }
    return targets;

}
 
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: 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 16
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 17
Source File: PlaceholderPotion.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractCreature target) {
    target = AbstractDungeon.player;
    // If you are in combat, gain strength and the "lose strength at the end of your turn" power, equal to the potency of this potion.
    if (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT) {
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, AbstractDungeon.player, new StrengthPower(target, potency), potency));
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, AbstractDungeon.player, new LoseStrengthPower(target, potency), potency));
    }
}
 
Example 18
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 19
Source File: BurningLoseHpAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (AbstractDungeon.getCurrRoom().phase != AbstractRoom.RoomPhase.COMBAT) {
        this.isDone = true;
    } else {
        if (this.duration == DURATION && this.target.currentHealth > 0) {
            AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.target.hb.cX, this.target.hb.cY, this.attackEffect));
        }

        this.tickDuration();
        if (this.isDone) {
            if (this.target.currentHealth > 0) {
                this.target.tint.color = Color.ORANGE.cpy();
                this.target.tint.changeColor(Color.WHITE.cpy());
                this.target.damage(new DamageInfo(this.source, this.amount, DamageInfo.DamageType.THORNS));
            }

            AbstractPower p = this.target.getPower(BurningPower.POWER_ID);
            if (p != null) {
                p.amount = BurningUtils.calculateNextBurningAmount(source, p.amount);

                p.updateDescription();
            }

            if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
                AbstractDungeon.actionManager.clearPostCombatActions();
            }

            AbstractDungeon.actionManager.addToTop(new WaitAction(0.1F));
        }
    }
}
 
Example 20
Source File: CharityMemory.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void onModifyGold(AbstractPlayer player) {
    if (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT) {
        updateAppliedStrength();
    }
}