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

The following examples show how to use com.megacrit.cardcrawl.dungeons.AbstractDungeon#getMonsters() . 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: 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 2
Source File: AtStartOfTurnPreLoseBlockPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static void applyStartOfTurnPreLoseBlockPowers() {
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        for (AbstractPower p : m.powers) {
            if (p instanceof CustomJorbsModPower) {
                ((CustomJorbsModPower) p).atStartOfTurnPreLoseBlock();
            }
        }
    }
}
 
Example 3
Source File: BlackTentaclesPowerPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpireInsertPatch(
        locator = Locator.class,
        localvars = { "damageAmount" }
)
public static void patch(AbstractMonster __this, DamageInfo info, @ByRef int[] damageAmount)
{
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        for (AbstractPower power : m.powers) {
            if (power instanceof BlackTentaclesPower) {
                damageAmount[0] = ((BlackTentaclesPower) power).onAnyMonsterHpLoss(__this, info, damageAmount[0]);
            }
        }
    }
}
 
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: 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 6
Source File: Taunt.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 IntangiblePlayerPower(p, urMagicNumber)));
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        addToBot(new ApplyPowerAction(m, p, new VulnerablePower(m, magicNumber, false)));
    }
}
 
Example 7
Source File: BlackTentaclesPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onInitialApplication() {
    // only 1 target can have this power at a time; subsequent uses of the card will overwrite the old effect
    for(AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        for (AbstractPower p : m.powers) {
            if (p.ID.equals(this.ID) && p != this) {
                AbstractDungeon.actionManager.addToTop(new RemoveSpecificPowerAction(m, source, p));
            }
        }
    }
}
 
Example 8
Source File: FlameWardPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onDamagedPreBlock(DamageInfo info) {
    if (info != null && this.owner != info.owner && info.type != DamageInfo.DamageType.THORNS && info.type != DamageInfo.DamageType.HP_LOSS) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.owner.hb.cX, this.owner.hb.cY, AbstractGameAction.AttackEffect.SHIELD));
        AbstractDungeon.effectList.add(new FlameBarrierEffect(this.owner.hb.cX, this.owner.hb.cY));
        this.owner.addBlock(this.amount);
        for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
            AbstractDungeon.actionManager.addToTop(
                    new ApplyPowerAction(m, this.owner, new BurningPower(m, this.owner, this.amount2), this.amount2, AbstractGameAction.AttackEffect.FIRE));
        }
        this.flash();
        AbstractDungeon.actionManager.addToTop(new ReducePowerAction(this.owner, this.owner, this.ID, this.amount));
    }
}
 
Example 9
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 10
Source File: CombatUtils.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
/**
 * If there are any non-minion monsters still alive, then this returns false.
 * @return returns true if there are no non-minion monsters left alive. Otherwise, returns false.
 */
public static boolean isCombatBasicallyVictory() {
    for (AbstractMonster m : AbstractDungeon.getMonsters().monsters) {
        if (!m.hasPower(MinionPower.POWER_ID) && !(m.isDying || m.isDead)) {
            return false;
        }
    }
    return true;
}
 
Example 11
Source File: ChastityMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onRemember() {
    AbstractDungeon.actionManager.addToBottom(
            new ApplyPowerAction(owner, owner, new DexterityPower(owner, DEXTERITY_ON_REMEMBER), DEXTERITY_ON_REMEMBER));

    if (!AbstractDungeon.getMonsters().areMonstersBasicallyDead()) {
        for (AbstractMonster monster : AbstractDungeon.getMonsters().monsters) {
            if (!monster.halfDead && !monster.isDead && !monster.isDying) {
                AbstractDungeon.actionManager.addToTop(
                        new ApplyPowerAction(monster, owner, new WeakPower(monster, WEAK_ON_REMEMBER, false), WEAK_ON_REMEMBER));
            }
        }
    }
}