use of mage.game.permanent.token.Elemental44Token in project mage by magefree.
the class MultipleChoiceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int xValue = source.getManaCostsToPay().getX();
if (xValue == 1 || xValue >= 4) {
controller.scry(1, source, game);
controller.drawCards(1, source, game);
}
if (xValue == 3 || xValue >= 4) {
new Elemental44Token().putOntoBattlefield(1, game, source, source.getControllerId());
}
if (xValue != 2 && xValue < 4) {
return true;
}
TargetPlayer targetPlayer = new TargetPlayer(0, 1, true);
controller.choose(Outcome.Detriment, targetPlayer, source.getSourceId(), game);
Player player = game.getPlayer(targetPlayer.getFirstTarget());
if (player == null || game.getBattlefield().count(StaticFilters.FILTER_CONTROLLED_CREATURE, source.getSourceId(), player.getId(), game) <= 0) {
return true;
}
TargetPermanent targetPermanent = new TargetControlledCreaturePermanent();
targetPermanent.setNotTarget(true);
player.choose(Outcome.ReturnToHand, targetPermanent, source.getSourceId(), game);
Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
return permanent == null || player.moveCards(permanent, Zone.HAND, source, game);
}
use of mage.game.permanent.token.Elemental44Token in project mage by magefree.
the class WillScholarOfFrostEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(targetPointer.getTargets(game, source));
Map<UUID, Integer> playerMap = cards.getCards(game).stream().filter(Objects::nonNull).map(MageItem::getId).map(game::getControllerId).filter(Objects::nonNull).collect(Collectors.toMap(Function.identity(), x -> 1, Integer::sum));
player.moveCards(cards, Zone.EXILED, source, game);
for (Map.Entry<UUID, Integer> entry : playerMap.entrySet()) {
new Elemental44Token().putOntoBattlefield(entry.getValue(), game, source, entry.getKey());
}
return true;
}
use of mage.game.permanent.token.Elemental44Token in project mage by magefree.
the class ZaffaiThunderConductorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.scry(1, source, game);
Spell spell = (Spell) getValue(MagecraftAbility.SPELL_KEY);
if (spell == null || spell.getManaValue() < 5) {
return true;
}
new Elemental44Token().putOntoBattlefield(1, game, source, source.getControllerId());
if (spell.getManaValue() < 10) {
return true;
}
TargetOpponent target = new TargetOpponent(true);
target.setRandom(true);
target.chooseTarget(Outcome.Damage, player.getId(), source, game);
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent != null) {
opponent.damage(10, source.getSourceId(), source, game);
}
return true;
}
use of mage.game.permanent.token.Elemental44Token in project mage by magefree.
the class ResculptEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
player.moveCards(permanent, Zone.EXILED, source, game);
new Elemental44Token().putOntoBattlefield(1, game, source, player.getId());
return true;
}
Aggregations