com.megacrit.cardcrawl.rooms.AbstractRoom Java Examples

The following examples show how to use com.megacrit.cardcrawl.rooms.AbstractRoom. 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: StSLib.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void receiveOnBattleStart(AbstractRoom abstractRoom)
{
    CardGroup[] cardGroups = new CardGroup[] {
            AbstractDungeon.player.drawPile,
            AbstractDungeon.player.hand,
            AbstractDungeon.player.discardPile,
            AbstractDungeon.player.exhaustPile
    };

    for (CardGroup cardGroup : cardGroups) {
        for (AbstractCard c : cardGroup.group) {
            if (c instanceof StartupCard) {
                if (((StartupCard) c).atBattleStartPreDraw()) {
                    AbstractDungeon.effectList.add(0, new ShowCardBrieflyEffect(c.makeStatEquivalentCopy()));
                }
            }
        }
    }
}
 
Example #2
Source File: BottledPlaceholderRelic.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
@Override
public void update() {
    super.update(); //Do all of the original update() method in AbstractRelic

    if (!cardSelected && !AbstractDungeon.gridSelectScreen.selectedCards.isEmpty()) {
        // If the card hasn't been bottled yet and we have cards selected in the gridSelectScreen (from onEquip)
        cardSelected = true; //Set the cardSelected boolean to be true - we're about to bottle the card.
        card = AbstractDungeon.gridSelectScreen.selectedCards.get(0); // The custom Savable "card" is going to equal
        // The card from the selection screen (it's only 1, so it's at index 0)
        BottledPlaceholderField.inBottledPlaceholderField.set(card, true); // Use our custom spire field to set that card to be bottled.
        if (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.INCOMPLETE) {
            AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE;
        }
        AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE; // The room phase can now be set to complete (From INCOMPLETE in onEquip)
        AbstractDungeon.gridSelectScreen.selectedCards.clear(); // Always clear your grid screen after using it.
        setDescriptionAfterLoading(); // Set the description to reflect the bottled card (the method is at the bottom of this file)
    }
}
 
Example #3
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 #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: GhostPoisonPotion.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void use(AbstractCreature target) {
    int liveMonsterCount = 0;

    for (AbstractMonster m : (AbstractDungeon.getCurrRoom()).monsters.monsters) {
        // This makes sure that all Darklings in the fight actually die, regardless of their halfDead state
        if (m instanceof Darkling) {
            if (m.halfDead) {
                m.halfDead = false;
            }
            // This makes combat against Darklings able to end
            AbstractDungeon.getCurrRoom().cannotLose = false;
        }
        if (!m.isDeadOrEscaped()) {
            ++liveMonsterCount;
            addToBot(new VFXAction(new SmokeBombEffect(m.hb.cX, m.hb.cY)));
            m.die();
        }
    }
        addToBot(new IncreaseManifestAction(liveMonsterCount));

    if ((AbstractDungeon.getCurrRoom()).phase == AbstractRoom.RoomPhase.COMBAT) {
        AbstractDungeon.player.hideHealthBar();
        AbstractDungeon.overlayMenu.endTurnButton.disable();
    }
}
 
Example #7
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 #8
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 #9
Source File: SnapCounter.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private boolean isVisible() {
    return isActive
            && (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT || AbstractDungeon.getCurrRoom() instanceof MonsterRoom)
            && !owner.isDead
            && !owner.isEscaping
            && !MemoryManager.forPlayer(owner).isSnapped();
}
 
Example #10
Source File: BurningPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private void performBurningTick() {
    if (AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT &&
            !AbstractDungeon.getMonsters().areMonstersBasicallyDead()) {
        this.flashWithoutSound();
        AbstractDungeon.actionManager.addToTop(
                new BurningLoseHpAction(this.owner, this.source, this.amount, AbstractGameAction.AttackEffect.FIRE));
    }
}
 
Example #11
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 #12
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 #13
Source File: DimensionDoorPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePostfixPatch
public static void patch(AbstractScene __this, AbstractRoom __room) {
    // Only let this ability be used once.
    if (DimensionDoorPotion.isMapTravelActive()) {
        DimensionDoorPotion.deactivateMapTravel();
    }
}
 
Example #14
Source File: DefaultClickableRelic.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void onRightClick() {// On right click
    if (!isObtained || usedThisTurn || !isPlayerTurn) {
        // If it has been used this turn, the player doesn't actually have the relic (i.e. it's on display in the shop room), or it's the enemy's turn
        return; // Don't do anything.
    }
    
    if (AbstractDungeon.getCurrRoom() != null && AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT) { // Only if you're in combat
        usedThisTurn = true; // Set relic as "Used this turn"
        flash(); // Flash
        stopPulse(); // And stop the pulsing animation (which is started in atPreBattle() below)

        AbstractDungeon.actionManager.addToBottom(new TalkAction(true, DESCRIPTIONS[1], 4.0f, 2.0f)); // Player speech bubble saying "YOU ARE MINE!" (See relic strings)
        AbstractDungeon.actionManager.addToBottom(new SFXAction("MONSTER_COLLECTOR_DEBUFF")); // Sound Effect Action of The Collector Nails
        AbstractDungeon.actionManager.addToBottom(new VFXAction( // Visual Effect Action of the nails applies on a random monster's position.
                new CollectorCurseEffect(AbstractDungeon.getRandomMonster().hb.cX, AbstractDungeon.getRandomMonster().hb.cY), 2.0F));

        AbstractDungeon.actionManager.addToBottom(new EvokeOrbAction(1)); // Evoke your rightmost orb
    }
    // See that talk action? It has DESCRIPTIONS[1] instead of just hard-coding "You are mine" inside.
    // DO NOT HARDCODE YOUR STRINGS ANYWHERE, it's really bad practice to have "Strings" in your code:

    /*
     * 1. It's bad for if somebody likes your mod enough (or if you decide) to translate it.
     * Having only the JSON files for translation rather than 15 different instances of "Dexterity" in some random cards is A LOT easier.
     *
     * 2. You don't have a centralised file for all strings for easy proof-reading. If you ever want to change a string
     * you don't have to go through all your files individually/pray that a mass-replace doesn't screw something up.
     *
     * 3. Without hardcoded strings, editing a string doesn't require a compile, saving you time (unless you clean+package).
     *
     */
}
 
Example #15
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 #16
Source File: VigorPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom arg0) {
    BaseMod.unsubscribe(this, PostDrawSubscriber.class);
    BaseMod.unsubscribe(this, PostDungeonInitializeSubscriber.class);
    /*
     *  calling unsubscribeFromPostBattle inside the callback
     *  for receivePostBattle means that when we're calling it
     *  there is currently an iterator going over the list
     *  of subscribers and calling receivePostBattle on each of
     *  them therefore if we immediately try to remove the this
     *  callback from the post battle subscriber list it will
     *  throw a concurrent modification exception in the iterator
     *
     *  for now we just add a delay - yes this is an atrocious solution
     *  PLEASE someone with a better idea replace it
     */
    Thread delayed = new Thread(() -> {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
            System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
            e.printStackTrace();
        }
        BaseMod.unsubscribe(this, PostBattleSubscriber.class);
    });
    delayed.start();
}
 
Example #17
Source File: NexusPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom arg0) {
    BaseMod.unsubscribe(this, PostDrawSubscriber.class);
    BaseMod.unsubscribe(this, PostDungeonInitializeSubscriber.class);
    /*
     *  calling unsubscribeFromPostBattle inside the callback
     *  for receivePostBattle means that when we're calling it
     *  there is currently an iterator going over the list
     *  of subscribers and calling receivePostBattle on each of
     *  them therefore if we immediately try to remove the this
     *  callback from the post battle subscriber list it will
     *  throw a concurrent modification exception in the iterator
     *
     *  for now we just add a delay - yes this is an atrocious solution
     *  PLEASE someone with a better idea replace it
     */
    Thread delayed = new Thread(() -> {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
            System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
            e.printStackTrace();
        }
        BaseMod.unsubscribe(this, PostBattleSubscriber.class);
    });
    delayed.start();
}
 
Example #18
Source File: WormholePower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom arg0) {
    System.out.println("should be removed now!");
    BaseMod.unsubscribe(this, PostDrawSubscriber.class);
    BaseMod.unsubscribe(this, PostDungeonInitializeSubscriber.class);
    /*
     *  calling unsubscribeFromPostBattle inside the callback
     *  for receivePostBattle means that when we're calling it
     *  there is currently an iterator going over the list
     *  of subscribers and calling receivePostBattle on each of
     *  them therefore if we immediately try to remove the this
     *  callback from the post battle subscriber list it will
     *  throw a concurrent modification exception in the iterator
     *
     *  for now we just add a delay - yes this is an atrocious solution
     *  PLEASE someone with a better idea replace it
     */
    Thread delayed = new Thread(() -> {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
            System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
            e.printStackTrace();
        }
        BaseMod.unsubscribe(this, PostBattleSubscriber.class);
    });
    delayed.start();
}
 
Example #19
Source File: CelerityPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom battleRoom) {
    BaseMod.unsubscribe(this, PostExhaustSubscriber.class);
    BaseMod.unsubscribe(this, PostDungeonInitializeSubscriber.class);
    /*
     *  calling unsubscribeFromPostBattle inside the callback
     *  for receivePostBattle means that when we're calling it
     *  there is currently an iterator going over the list
     *  of subscribers and calling receivePostBattle on each of
     *  them therefore if we immediately try to remove the this
     *  callback from the post battle subscriber list it will
     *  throw a concurrent modification exception in the iterator
     *
     *  for now we just add a delay - yes this is an atrocious solution
     *  PLEASE someone with a better idea replace it
     */
    Thread delayed = new Thread(() -> {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
            System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
            e.printStackTrace();
        }
        BaseMod.unsubscribe(this, PostBattleSubscriber.class);
    });
    delayed.start();
}
 
Example #20
Source File: PotencyPower.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom battleRoom) {
    BaseMod.unsubscribe(this, PostExhaustSubscriber.class);
    BaseMod.unsubscribe(this, PostDungeonInitializeSubscriber.class);
    /*
     *  calling unsubscribeFromPostBattle inside the callback
     *  for receivePostBattle means that when we're calling it
     *  there is currently an iterator going over the list
     *  of subscribers and calling receivePostBattle on each of
     *  them therefore if we immediately try to remove the this
     *  callback from the post battle subscriber list it will
     *  throw a concurrent modification exception in the iterator
     *
     *  for now we just add a delay - yes this is an atrocious solution
     *  PLEASE someone with a better idea replace it
     */
    Thread delayed = new Thread(() -> {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
            System.out.println("could not delay unsubscribe to avoid ConcurrentModificationException");
            e.printStackTrace();
        }
        BaseMod.unsubscribe(this, PostBattleSubscriber.class);
    });
    delayed.start();
}
 
Example #21
Source File: PlayerMemoryManagerPatch.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@SpirePostfixPatch
public static void patch(AbstractPlayer __this, SpriteBatch sb) {
    if ((AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT || AbstractDungeon.getCurrRoom() instanceof MonsterRoom) && !__this.isDead) {
        MemoryManagerField.memoryManager.get(__this).render(sb);
    }
}
 
Example #22
Source File: CombatUtils.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
public static boolean isInCombat() {
    return (AbstractDungeon.currMapNode != null &&
            AbstractDungeon.getCurrRoom() != null &&
            AbstractDungeon.getCurrRoom().phase == AbstractRoom.RoomPhase.COMBAT);
}
 
Example #23
Source File: SeekerMod.java    From FruityMod-StS with MIT License 4 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom arg0) {
    resetPaperPengwin();
}
 
Example #24
Source File: FruityMod.java    From FruityMod-StS with MIT License 4 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom arg0) {
    for (PostBattleSubscriber mod : mods) {
        mod.receivePostBattle(arg0);
    }
}
 
Example #25
Source File: BattleEnd.java    From StSLib with MIT License 4 votes vote down vote up
public static void Prefix(AbstractRoom __instance)
{
    TempHPField.tempHp.set(AbstractDungeon.player, 0);
}
 
Example #26
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();
    }
}
 
Example #27
Source File: TranquilMod.java    From FruityMod-StS with MIT License 2 votes vote down vote up
@Override
public void receivePostBattle(AbstractRoom abstractRoom) {

}