Java Code Examples for com.megacrit.cardcrawl.monsters.AbstractMonster#isDeadOrEscaped()

The following examples show how to use com.megacrit.cardcrawl.monsters.AbstractMonster#isDeadOrEscaped() . 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: 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 2
Source File: MirroredTechniquePower.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static int getIncomingAttackCount() {
    int totalCount = 0;

    if(AbstractDungeon.getMonsters() != null) {
        for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
            if (!m.isDeadOrEscaped() && IntentUtils.isAttackIntent(m.intent)) {

                int multiAmt = 0;
                if (ReflectionUtils.getPrivateField(m, AbstractMonster.class, "isMultiDmg")) {
                    multiAmt = ReflectionUtils.getPrivateField(m, AbstractMonster.class, "intentMultiAmt");
                }
                else {
                    multiAmt = 1;
                }
                totalCount += multiAmt;
            }
        }
    }

    return totalCount;
}
 
Example 3
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 4
Source File: TimeEddyAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
private static void forEachApplicableMonsterPower(Consumer<AbstractPower> callback) {
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        if (!m.isDeadOrEscaped()) {
            for (AbstractPower power : m.powers) {
                if (shouldAffectPower(power)) {
                    callback.accept(power);
                }
            }
        }
    }
}
 
Example 5
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 6
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 7
Source File: NullStorm.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 SFXAction("THUNDERCLAP", 0.05f));
    for (AbstractMonster mo : AbstractDungeon.getCurrRoom().monsters.monsters) {
        if (mo.isDeadOrEscaped())
            continue;
        AbstractDungeon.actionManager.addToBottom(new VFXAction(new LightningEffect(mo.drawX, mo.drawY), 0.05f));
    }
    AbstractDungeon.actionManager.addToBottom(new DamageAllEnemiesAction(p, this.multiDamage,
            this.damageTypeForTurn, AbstractGameAction.AttackEffect.NONE));
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(new Dazed(), 1, true, true));
}