Search in sources :

Example 1 with CreatureToken

use of mage.game.permanent.token.custom.CreatureToken in project mage by magefree.

the class JolraelEmpressOfBeastsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
    if (targetPlayer != null) {
        FilterPermanent filter = new FilterLandPermanent();
        filter.add(new ControllerIdPredicate(targetPlayer.getId()));
        game.addEffect(new BecomesCreatureAllEffect(new CreatureToken(3, 3), "lands", filter, Duration.EndOfTurn, false), source);
        return true;
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) FilterLandPermanent(mage.filter.common.FilterLandPermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) BecomesCreatureAllEffect(mage.abilities.effects.common.continuous.BecomesCreatureAllEffect) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 2 with CreatureToken

use of mage.game.permanent.token.custom.CreatureToken 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 3 with CreatureToken

use of mage.game.permanent.token.custom.CreatureToken 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 CreatureToken

use of mage.game.permanent.token.custom.CreatureToken in project mage by magefree.

the class DestinySpinnerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int pt = DestinySpinnerCount.instance.calculate(game, source, this);
    game.addEffect(new BecomesCreatureTargetEffect(new CreatureToken(pt, pt, "").withSubType(SubType.ELEMENTAL).withAbility(TrampleAbility.getInstance()).withAbility(HasteAbility.getInstance()), false, true, Duration.EndOfTurn), source);
    return true;
}
Also used : BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ValueHint(mage.abilities.hint.ValueHint) CreatureToken(mage.game.permanent.token.custom.CreatureToken)

Example 5 with CreatureToken

use of mage.game.permanent.token.custom.CreatureToken in project mage by magefree.

the class MomirEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int value = source.getManaCostsToPay().getX();
    if (game.isSimulation()) {
        // Create dummy token to prevent multiple DB find cards what causes H2 java.lang.IllegalStateException if AI cancels calculation because of time out
        Token token = new CreatureToken(value, value + 1);
        token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false);
        return true;
    }
    // should this be random across card names
    CardCriteria criteria = new CardCriteria().types(CardType.CREATURE).manaValue(value);
    List<CardInfo> options = CardRepository.instance.findCards(criteria);
    if (options == null || options.isEmpty()) {
        game.informPlayers("No random creature card with mana value of " + value + " was found.");
        return false;
    }
    // search for a random non custom set creature
    EmptyToken token = null;
    while (!options.isEmpty()) {
        int index = RandomUtil.nextInt(options.size());
        ExpansionSet expansionSet = Sets.findSet(options.get(index).getSetCode());
        if (expansionSet == null || !expansionSet.getSetType().isEternalLegal()) {
            options.remove(index);
        } else {
            Card card = options.get(index).getCard();
            if (card != null) {
                token = new EmptyToken();
                CardUtil.copyTo(token).from(card, game);
                break;
            } else {
                options.remove(index);
            }
        }
    }
    if (token != null) {
        token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false);
        return true;
    }
    return false;
}
Also used : CardCriteria(mage.cards.repository.CardCriteria) CardInfo(mage.cards.repository.CardInfo) EmptyToken(mage.game.permanent.token.EmptyToken) CreatureToken(mage.game.permanent.token.custom.CreatureToken) Token(mage.game.permanent.token.Token) ExpansionSet(mage.cards.ExpansionSet) CreatureToken(mage.game.permanent.token.custom.CreatureToken) EmptyToken(mage.game.permanent.token.EmptyToken) Card(mage.cards.Card)

Aggregations

CreatureToken (mage.game.permanent.token.custom.CreatureToken)8 Player (mage.players.Player)5 BecomesCreatureSourceEffect (mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect)3 BecomesCreatureTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect)3 FilterPermanent (mage.filter.FilterPermanent)2 Token (mage.game.permanent.token.Token)2 BecomesCreatureAllEffect (mage.abilities.effects.common.continuous.BecomesCreatureAllEffect)1 ValueHint (mage.abilities.hint.ValueHint)1 MenaceAbility (mage.abilities.keyword.MenaceAbility)1 Card (mage.cards.Card)1 ExpansionSet (mage.cards.ExpansionSet)1 CardCriteria (mage.cards.repository.CardCriteria)1 CardInfo (mage.cards.repository.CardInfo)1 FilterLandPermanent (mage.filter.common.FilterLandPermanent)1 ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)1 Permanent (mage.game.permanent.Permanent)1 EmptyToken (mage.game.permanent.token.EmptyToken)1 TargetPermanent (mage.target.TargetPermanent)1 TargetPlayer (mage.target.TargetPlayer)1