com.megacrit.cardcrawl.monsters.AbstractMonster Java Examples

The following examples show how to use com.megacrit.cardcrawl.monsters.AbstractMonster. 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: StunMonsterPower.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void onInitialApplication()
{
    // Dumb action to delay grabbing monster's intent until after it's actually set
    AbstractDungeon.actionManager.addToBottom(new AbstractGameAction()
    {
        @Override
        public void update()
        {
            if (owner instanceof AbstractMonster) {
                moveByte = ((AbstractMonster) owner).nextMove;
                moveIntent = ((AbstractMonster) owner).intent;
                try {
                    Field f = AbstractMonster.class.getDeclaredField("move");
                    f.setAccessible(true);
                    move = (EnemyMoveInfo) f.get(owner);
                    move.intent = AbstractMonster.Intent.STUN;
                    ((AbstractMonster) owner).createIntent();
                } catch (IllegalAccessException | NoSuchFieldException e) {
                    e.printStackTrace();
                }
            }
            isDone = true;
        }
    });
}
 
Example #2
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 #3
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 #4
Source File: CustomJorbsModCard.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void calculateCardDamage(AbstractMonster mo) {
    int realBaseBlock = baseBlock;
    baseBlock += calculateBonusBaseBlock();
    int realBaseDamage = baseDamage;
    baseDamage += calculateBonusBaseDamage(mo);

    magicNumber = baseMagicNumber + calculateBonusMagicNumber();
    isMagicNumberModified = magicNumber != baseMagicNumber;

    super.calculateCardDamage(mo);

    baseDamage = realBaseDamage;
    isDamageModified = damage != baseDamage;
    baseBlock = realBaseBlock;
    isBlockModified = block != baseBlock;

    setRawDynamicDescriptionSuffix(getRawDynamicDescriptionSuffix());
}
 
Example #5
Source File: ShrapnelBloomPower.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void onUseCard(AbstractCard card, UseCardAction action) {
    if (!card.purgeOnUse && this.amount > 0 && !card.hasTag(LEGENDARY)) {
        this.flash();

        action.exhaustCard = true; // this is what corruption does
        SelfExertField.selfExert.set(card, true);

        AbstractMonster m = (AbstractMonster)action.target;

        for (int i = 0; i < amount; ++i) {
            CardMetaUtils.playCardAdditionalTime(card, m);
        }

        addToBot(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    }

}
 
Example #6
Source File: Irradiate.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.POISON));
    for (AbstractMonster mo : AbstractDungeon.getCurrRoom().monsters.monsters) {
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(mo, p, new WeakPower(mo, this.magicNumber, false), this.magicNumber, true, AbstractGameAction.AttackEffect.NONE));
        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(mo, p, new VulnerablePower(mo, this.magicNumber, false), this.magicNumber, true, AbstractGameAction.AttackEffect.NONE));
    }
}
 
Example #7
Source File: DefaultCommonAttack.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractDungeon.actionManager.addToBottom( // The action managed queues all the actions a card should do.
            // addToTop - first
            // addToBottom - last
            // 99.99% of the time you just want to addToBottom all of them.
            // Please do that unless you need to add to top for some specific reason.
            new DamageAction(m, new DamageInfo(p, damage, damageTypeForTurn),
                    // a list of existing actions can be found at com.megacrit.cardcrawl.actions but
                    // Chances are you'd instead look at "hey my card is similar to this basegame card"
                    // Let's find out what action *it* uses.
                    // I.e. i want energy gain or card draw, lemme check out Adrenaline
                    // P.s. if you want to damage ALL enemies OUTSIDE of a card, check out the custom orb.
                    AbstractGameAction.AttackEffect.SLASH_HORIZONTAL)); // The animation the damage action uses to hit.
}
 
Example #8
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 #9
Source File: WastingForm.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    for (int i = 0; i < metaMagicNumber; i++) {
        AbstractCard c = AbstractDungeon.returnRandomCurse();
        AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDiscardAction(c, 1));
    }
    addToBot(new ApplyPowerAction(p, p, new WastingFormPower(p, magicNumber, metaMagicNumber)));
}
 
Example #10
Source File: MagicMirrorPatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public static ExprEditor Instrument() {
    return new ExprEditor() {
        public void edit(MethodCall m) throws CannotCompileException {
            if (m.getClassName().equals(AbstractMonster.class.getName()) && m.getMethodName().equals("takeTurn")) {
                m.replace(String.format("if (!%1$s.entangledAndAttacking($0)) {$_ = $proceed($$);}", MagicMirrorPatch.class.getName()));
            }
        }
    };
}
 
Example #11
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));
}
 
Example #12
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 #13
Source File: Archives.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    int energyGain = AbstractDungeon.player.exhaustPile.group.size() / this.magicNumber;
    if (energyGain > 0) {
        AbstractDungeon.actionManager.addToBottom(new GainEnergyAction(energyGain));
    }
}
 
Example #14
Source File: DefaultUncommonPower.java    From StS-DefaultModBase with MIT License 5 votes vote down vote up
@Override
public void use(final AbstractPlayer p, final AbstractMonster m) {
    if (energyOnUse < EnergyPanel.totalCount) {
        energyOnUse = EnergyPanel.totalCount;
    }
    AbstractDungeon.actionManager.addToBottom(new UncommonPowerAction(p, m, magicNumber,
            upgraded, damageTypeForTurn, freeToPlayOnce, energyOnUse));
}
 
Example #15
Source File: Flow.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public boolean canUse(AbstractPlayer p, AbstractMonster m) {
    boolean hasPlayedEthereal = false;
    for (AbstractCard c : AbstractDungeon.actionManager.cardsPlayedThisTurn) {
        if (c.isEthereal)
        {
            hasPlayedEthereal = true;
            break;
        }
    }
    cantUseMessage = "I haven't played an Ethereal card this turn ... yet.";
    return hasPlayedEthereal && super.canUse(p, m);
}
 
Example #16
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 #17
Source File: RayOfFrost.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new VFXAction(new RayOfFrostEffect(p, m, damage)));
    addToBot(new DamageAction(m, new DamageInfo(p, damage), AbstractGameAction.AttackEffect.NONE));

    for (int i = 0; i < this.metaMagicNumber; ++i) {
        addToBot(new ApplyPowerAction(m, p, new WeakPower(m, this.magicNumber, false), this.magicNumber));
    }
}
 
Example #18
Source File: ArcaneWeaponAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void update() {
    target = CombatUtils.getRandomAliveMonster(AbstractDungeon.getMonsters(), m -> !m.hasPower(BanishedPower.POWER_ID), AbstractDungeon.cardRandomRng);
    if (this.target != null) {
        card.calculateCardDamage((AbstractMonster) target);

        // Add to top in reverse order so VFX starts/waits before the damage effect happens.
        AbstractDungeon.actionManager.addToTop(new DamageAction(target, new DamageInfo(AbstractDungeon.player, card.damage, card.damageTypeForTurn), AttackEffect.SLASH_DIAGONAL));
        AbstractDungeon.actionManager.addToTop(new VFXAction(new ArcaneWeaponEffect(target.hb.x, target.hb.cY + target.hb.height / 12.0F), 0.5F));
    }

    isDone = true;
}
 
Example #19
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 #20
Source File: Chamomile.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void useMaterialComponent(AbstractPlayer p, AbstractMonster m) {
    addToBot(new RemoveSpecificPowerAction(p, p, FrailPower.POWER_ID));
    if (upgraded) {
        addToBot(new RemoveSpecificPowerAction(p, p, VulnerablePower.POWER_ID));
    }
    addToBot(new RemoveSpecificPowerAction(p, p, WeakPower.POWER_ID));
}
 
Example #21
Source File: Aid.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    addToBot(new HealAction(m, p, magicNumber));
    addToBot(new RememberSpecificMemoryAction(p, KindnessMemory.STATIC.ID));
    if (upgraded) {
        addToBot(new GainClarityOfCurrentMemoryAction(p));
    }
}
 
Example #22
Source File: Patron.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    if (upgraded) {
        addToBot(new PatronAction(m, new DamageInfo(p, damage), this, CardMetaUtils::downgradeCardPermanently, EffectUtils::showDowngradeEffect));
    } else {
        addToBot(new PatronAction(m, new DamageInfo(p, damage), this, CardMetaUtils::destroyCardPermanently, EffectUtils::showDestroyEffect));
    }
}
 
Example #23
Source File: PlayNextCardThisTurnAdditionalTimesPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void onUseCard(AbstractCard card, UseCardAction action) {
    if (!card.purgeOnUse && this.amount > 0) {
        this.flash();

        AbstractMonster m = (AbstractMonster)action.target;

        for (int i = 0; i < amount; ++i) {
            CardMetaUtils.playCardAdditionalTime(card, m);
        }

        AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
    }
}
 
Example #24
Source File: BanishedPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void onInitialApplication() {
    if (owner instanceof AbstractMonster) {
        associatedStunPower = new StunMonsterPower((AbstractMonster)this.owner, this.amount);
        AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(this.owner, this.source, associatedStunPower, this.amount));
    }
}
 
Example #25
Source File: OldPocket.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    // Based on HandOfGreed's GreedAction
    for(int i = 0; i < magicNumber; ++i) {
        AbstractDungeon.effectList.add(new GainPennyEffect(p, p.hb.cX, p.hb.cY, p.hb.cX, p.hb.cY, true));
    }
    AbstractDungeon.player.gainGold(magicNumber);

    addToBot(new RememberSpecificMemoryAction(p, CharityMemory.STATIC.ID));
    if (upgraded) {
        addToBot(new GainClarityOfCurrentMemoryAction(p));
    }
}
 
Example #26
Source File: Channel.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 DamageAction((AbstractCreature) m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_HEAVY)));
    Channel that = this; // funny little naming convention for providing this to inner class
    ITopCycleCallback cb = new ITopCycleCallback() {
        @Override
        public void processCard(AbstractCard c) {
            if (c.isEthereal) {
                AbstractDungeon.actionManager.addToBottom(new DamageAction((AbstractCreature) m, new DamageInfo(p, that.damage, that.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_HEAVY));
            }
        }
    };
    AbstractDungeon.actionManager.addToBottom(new ChannelAction(p, DISCARD_AMT, cb));
}
 
Example #27
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 #28
Source File: Brainstorm.java    From FruityMod-StS with MIT License 5 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
    AbstractCard c = AbstractDungeon.returnTrulyRandomCardInCombat();
    if (!c.isEthereal) {
        c.isEthereal = true;
        c.rawDescription = "Ethereal. NL " + c.rawDescription;
        c.initializeDescription();
    }
    c.freeToPlayOnce = true;
    AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(c, 1, false, true));
}
 
Example #29
Source File: StunMonsterAction.java    From StSLib with MIT License 5 votes vote down vote up
public StunMonsterAction(AbstractMonster target, AbstractCreature source, int amount)
{
    this.target = target;
    this.source = source;
    this.amount = amount;
    actionType = AbstractGameAction.ActionType.DEBUFF;
    duration = Settings.ACTION_DUR_FAST;
}
 
Example #30
Source File: Rebuttal.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
    removeRetainThorns();
    addToBot(new ApplyPowerAction(p, p, new ThornsPower(p, magicNumber)));
}