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

The following examples show how to use com.megacrit.cardcrawl.monsters.AbstractMonster#hasPower() . 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: MagicMirrorPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static boolean entangledAndAttacking(AbstractMonster m) {
    boolean retval = m.hasPower(EntanglePower.POWER_ID) && IntentUtils.isAttackIntent(m.intent);
    if (retval) {
        AbstractDungeon.effectList.add(new TextAboveCreatureEffect(m.hb.cX - m.animX, m.hb.cY + m.hb.height / 2.0F, TEXT[0], Color.WHITE.cpy()));
    }
    return retval;
}
 
Example 3
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 4
Source File: Shake.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    if (abstractMonster.hasPower(VulnerablePower.POWER_ID)) {
        addToBot(new DrawCardAction(p, magicNumber));
    }
    addToBot(new ApplyPowerAction(abstractMonster, p, new VulnerablePower(abstractMonster, urMagicNumber, false)));
}
 
Example 5
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 6
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 7
Source File: GreedMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onMonsterKilled(AbstractMonster m) {
    if (isPassiveEffectActive() && !m.hasPower(MinionPower.POWER_ID)) {
        JorbsMod.logger.info("Greed: gaining gold");
        AbstractDungeon.player.gainGold(GOLD_PER_KILL);

        // Based on HandOfGreed's GreedAction
        for(int i = 0; i < GOLD_PER_KILL; ++i) {
            AbstractDungeon.effectList.add(new GainPennyEffect(owner, m.hb.cX, m.hb.cY, owner.hb.cX, owner.hb.cY, true));
        }
    }
}
 
Example 8
Source File: GluttonyMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onMonsterKilled(AbstractMonster m) {
    if (isPassiveEffectActive() && !m.hasPower(MinionPower.POWER_ID)) {
        JorbsMod.logger.info("Gluttony: gaining max hp");
        AbstractDungeon.player.increaseMaxHp(MAX_HP_PER_KILL, true);
    }
}
 
Example 9
Source File: WrathMemory.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onMonsterKilled(AbstractMonster m) {
    if (isPassiveEffectActive() && !m.hasPower(MinionPower.POWER_ID) && upgradeTarget != null) {
        this.flash();
        permanentlyIncreaseCardDamage(upgradeTarget);
        if (upgradeTarget instanceof OnWrathStackReceivedSubscriber) {
            ((OnWrathStackReceivedSubscriber) upgradeTarget).onWrathStackReceived();
        }
    }
}
 
Example 10
Source File: StunMonsterPatch.java    From StSLib with MIT License 5 votes vote down vote up
public static SpireReturn<Void> Prefix(AbstractMonster __instance) {
    if (__instance.hasPower(StunMonsterPower.POWER_ID)) {
        return SpireReturn.Return(null);
    } else {
        return SpireReturn.Continue();
    }
}
 
Example 11
Source File: PlasmaWave.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public float calculateModifiedCardDamage(AbstractPlayer player, AbstractMonster monster, float tmp) {
    if (monster != null) {
        if (monster.hasPower("Vulnerable")) {
            return tmp * 2;
        }
    }
    return tmp;
}
 
Example 12
Source File: Vortex.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public boolean canUse(AbstractPlayer p, AbstractMonster m) {
    if (!super.canUse(p, m)) {
        return false;
    }
    if (m != null && (m.hasPower("Weakened") || m.hasPower("Vulnerable"))) {
        return true;
    }
    this.cantUseMessage = cardStrings.EXTENDED_DESCRIPTION[0];
    return false;
}
 
Example 13
Source File: Entropy.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 ApplyPowerAction(m, p,
            new com.megacrit.cardcrawl.powers.StrengthPower(m, -1 * this.magicNumber), -1 * this.magicNumber));
    if (!m.hasPower("Artifact")) {
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p,
                new com.megacrit.cardcrawl.powers.LoseStrengthPower(m, -1 * this.magicNumber), -1 * this.magicNumber));
    }
}