use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class EwokAmbushCreateTokenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
CreateTokenEffect effect = new CreateTokenEffect(new EwokToken(), 2);
effect.apply(game, source);
for (UUID tokenId : effect.getLastAddedTokenIds()) {
Permanent token = game.getPermanent(tokenId);
if (token != null) {
ContinuousEffect continuousEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
continuousEffect.setTargetPointer(new FixedTarget(tokenId));
game.addEffect(continuousEffect, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class EtherealAbsolutionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getFirstTarget());
if (player == null || card == null) {
return false;
}
if (card.isCreature(game)) {
new CreateTokenEffect(new WhiteBlackSpiritToken()).apply(game, source);
}
return player.moveCards(card, Zone.EXILED, source, game);
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class FinaleOfGloryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
if (xValue == 0) {
return false;
}
new CreateTokenEffect(new SoldierVigilanceToken(), xValue).apply(game, source);
if (xValue >= 10) {
new CreateTokenEffect(new AngelVigilanceToken(), xValue).apply(game, source);
}
return true;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class OonaQueenOfTheFaeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
ChoiceColor choice = new ChoiceColor();
if (controller == null || opponent == null || !controller.choose(outcome, choice, game)) {
return false;
}
int cardsWithColor = 0;
Cards cardsToExile = new CardsImpl();
cardsToExile.addAll(opponent.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
for (Card card : cardsToExile.getCards(game)) {
if (card != null && card.getColor(game).contains(choice.getColor())) {
cardsWithColor++;
}
}
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
if (cardsWithColor > 0) {
new CreateTokenEffect(new OonaQueenFaerieRogueToken(), cardsWithColor).apply(game, source);
}
game.informPlayers("Oona: " + cardsWithColor + " Token" + (cardsWithColor != 1 ? "s" : "") + " created");
return true;
}
use of mage.abilities.effects.common.CreateTokenEffect in project mage by magefree.
the class RallyTheHordeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int nonLandCardsExiled = 0;
while (controller.getLibrary().hasCards()) {
nonLandCardsExiled += checkIfNextLibCardIsNonLandAndExile(controller, source, game);
if (controller.getLibrary().hasCards()) {
nonLandCardsExiled += checkIfNextLibCardIsNonLandAndExile(controller, source, game);
}
if (controller.getLibrary().hasCards()) {
int nonLands = checkIfNextLibCardIsNonLandAndExile(controller, source, game);
if (nonLands == 0) {
break;
}
nonLandCardsExiled += nonLands;
}
}
return new CreateTokenEffect(new RallyTheHordeWarriorToken(), nonLandCardsExiled).apply(game, source);
}
return false;
}
Aggregations