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

The following examples show how to use com.megacrit.cardcrawl.dungeons.AbstractDungeon#getRandomMonster() . 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: ReplayThisAction.java    From FruityMod-StS with MIT License 6 votes vote down vote up
public void update() {
    if (this.duration == Settings.ACTION_DUR_FAST) {// 26
        AbstractMonster m = AbstractDungeon.getRandomMonster();

        AbstractCard tmp = funCard.makeSameInstanceOf();// 56
        AbstractDungeon.player.limbo.addToBottom(tmp);// 57
        tmp.current_x = funCard.current_x;// 58
        tmp.current_y = funCard.current_y;// 59
        tmp.target_x = (float) Settings.WIDTH / 2.0F - 300.0F * Settings.scale;// 60
        tmp.target_y = (float) Settings.HEIGHT / 2.0F;// 61
        tmp.applyPowers();// 68
        if (tmp.cost > 0) {// 63
            tmp.freeToPlayOnce = true;// 64
        }

        if (m != null) {// 67
            tmp.calculateCardDamage(m);// 68
        }

        tmp.purgeOnUse = true;// 71
        AbstractDungeon.actionManager.cardQueue.add(new CardQueueItem(tmp, m, funCard.energyOnUse, true));
    }

    this.isDone = true;// 79
}
 
Example 2
Source File: RarePower.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
@Override
public void atStartOfTurn() { // At the start of your turn
    AbstractCard playCard = new DefaultRareAttack(); // Declare Card - the DefaultRareAttack card. We will name it 'playCard'.
    AbstractMonster targetMonster = AbstractDungeon.getRandomMonster(); // Declare Target - Random Monster. We will name the monster 'targetMonster'.

    playCard.freeToPlayOnce = true; //Self Explanatory

    if (playCard.type != AbstractCard.CardType.POWER) {
        playCard.purgeOnUse = true;
    }

    // Remove completely on use (Not Exhaust). A note - you don't need the '{}' in this if statement,
    // as it's just 1 line directly under. You can remove them, if you want. In fact, you can even put it all on 1 line:
    //  if (playCard.type != AbstractCard.CardType.POWER) playCard.purgeOnUse = true; - works identically

    AbstractDungeon.actionManager.addToBottom(new NewQueueCardAction(playCard, targetMonster)); // Play the card on the target.
}
 
Example 3
Source File: PrestidigitationPower.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@Override
public void atStartOfTurn() {
    AbstractCreature target = AbstractDungeon.getRandomMonster();
    if (target != null) {
        this.flash();
        AbstractPower effect = AbstractDungeon.cardRandomRng.randomBoolean() ?
                new WeakPower(target, amount, !owner.isPlayer) :
                new VulnerablePower(target, amount, !owner.isPlayer);

        AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, owner, effect, amount));
    }
}