Search in sources :

Example 1 with BecomesCreatureSourceEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.

the class LairOfTheHydraEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = source.getManaCostsToPay().getX();
    game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(xValue, xValue, "X/X green Hydra creature").withColor("G").withSubType(SubType.HYDRA), "land", Duration.EndOfTurn), source);
    return true;
}
Also used : BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 2 with BecomesCreatureSourceEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.

the class AnsweredPrayersToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    new GainLifeEffect(1).apply(game, source);
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent == null) {
        return false;
    }
    if (permanent.isCreature(game)) {
        return true;
    }
    game.addEffect(new BecomesCreatureSourceEffect(new AnsweredPrayersToken(), "enchantment", Duration.EndOfTurn), source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Example 3 with BecomesCreatureSourceEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.

the class EbonyFlyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    int result = player.rollDice(outcome, source, game, 6);
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent == null || !player.chooseUse(outcome, "Have " + permanent.getName() + " become a " + result + '/' + result + " creature until end of turn?", source, game)) {
        return true;
    }
    game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(result, result).withType(CardType.ARTIFACT).withAbility(FlyingAbility.getInstance()), "", Duration.EndOfTurn, false, false), source);
    return true;
}
Also used : Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 4 with BecomesCreatureSourceEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.

the class ComputerPlayer method priorityPlay.

private boolean priorityPlay(Game game) {
    UUID opponentId = game.getOpponents(playerId).iterator().next();
    if (game.isActivePlayer(playerId)) {
        if (game.isMainPhase() && game.getStack().isEmpty()) {
            playLand(game);
        }
        switch(game.getTurn().getStepType()) {
            case UPKEEP:
                findPlayables(game);
                break;
            case DRAW:
                logState(game);
                break;
            case PRECOMBAT_MAIN:
                findPlayables(game);
                if (!playableAbilities.isEmpty()) {
                    for (ActivatedAbility ability : playableAbilities) {
                        if (ability.canActivate(playerId, game).canActivate()) {
                            if (ability.getEffects().hasOutcome(ability, Outcome.PutLandInPlay)) {
                                if (this.activateAbility(ability, game)) {
                                    return true;
                                }
                            }
                            if (ability.getEffects().hasOutcome(ability, Outcome.PutCreatureInPlay)) {
                                if (getOpponentBlockers(opponentId, game).size() <= 1) {
                                    if (this.activateAbility(ability, game)) {
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case DECLARE_BLOCKERS:
                findPlayables(game);
                playRemoval(game.getCombat().getBlockers(), game);
                playDamage(game.getCombat().getBlockers(), game);
                break;
            case END_COMBAT:
                findPlayables(game);
                playDamage(game.getCombat().getBlockers(), game);
                break;
            case POSTCOMBAT_MAIN:
                findPlayables(game);
                if (game.getStack().isEmpty()) {
                    if (!playableNonInstant.isEmpty()) {
                        for (Card card : playableNonInstant) {
                            if (card.getSpellAbility().canActivate(playerId, game).canActivate()) {
                                if (this.activateAbility(card.getSpellAbility(), game)) {
                                    return true;
                                }
                            }
                        }
                    }
                    if (!playableAbilities.isEmpty()) {
                        for (ActivatedAbility ability : playableAbilities) {
                            if (ability.canActivate(playerId, game).canActivate()) {
                                if (!(ability.getEffects().get(0) instanceof BecomesCreatureSourceEffect)) {
                                    if (this.activateAbility(ability, game)) {
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
        }
    } else {
        // respond to opponent events
        switch(game.getTurn().getStepType()) {
            case UPKEEP:
                findPlayables(game);
                break;
            case DECLARE_ATTACKERS:
                findPlayables(game);
                playRemoval(game.getCombat().getAttackers(), game);
                playDamage(game.getCombat().getAttackers(), game);
                break;
            case END_COMBAT:
                findPlayables(game);
                playDamage(game.getCombat().getAttackers(), game);
                break;
        }
    }
    pass(game);
    return true;
}
Also used : BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) RateCard(mage.game.draft.RateCard) Card(mage.cards.Card) FilterCard(mage.filter.FilterCard)

Example 5 with BecomesCreatureSourceEffect

use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.

the class CrawlingBarrensEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null || !player.chooseUse(outcome, "Have this land become a 0/0 creature until end of turn?", source, game)) {
        return false;
    }
    game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(0, 0, "0/0 Elemental creature").withSubType(SubType.ELEMENTAL), "land", Duration.EndOfTurn), source);
    return true;
}
Also used : Player(mage.players.Player) BecomesCreatureSourceEffect(mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Aggregations

BecomesCreatureSourceEffect (mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect)5 CreatureToken (mage.game.permanent.token.custom.CreatureToken)3 Permanent (mage.game.permanent.Permanent)2 Player (mage.players.Player)2 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 Card (mage.cards.Card)1 FilterCard (mage.filter.FilterCard)1 FilterPermanent (mage.filter.FilterPermanent)1 RateCard (mage.game.draft.RateCard)1 TargetPermanent (mage.target.TargetPermanent)1