use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class VoiceOfManyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int myCount = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game).size();
int toDraw = game.getOpponents(source.getControllerId()).stream().mapToInt(uuid -> game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, uuid, game).size() < myCount ? 1 : 0).sum();
if (toDraw == 0) {
return true;
}
return new DrawCardSourceControllerEffect(toDraw).apply(game, source);
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class LatNamsLegacyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && !controller.getHand().isEmpty()) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to shuffle into your library"));
controller.choose(Outcome.Detriment, controller.getHand(), target, game);
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
boolean successful = controller.moveCards(card, Zone.LIBRARY, source, game);
controller.shuffleLibrary(source, game);
if (successful) {
new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(2)), false).apply(game, source);
}
}
return true;
}
return true;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class RielleTheEverwiseWatcher method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
RielleTheEverwiseWatcher watcher = game.getState().getWatcher(RielleTheEverwiseWatcher.class);
if (watcher == null || !watcher.checkDiscarded(event.getPlayerId()) || !event.getPlayerId().equals(getControllerId()) || event.getAmount() == 0) {
return false;
}
this.getEffects().clear();
this.addEffect(new DrawCardSourceControllerEffect(event.getAmount()));
return true;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class TheftOfDreamsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(TappedPredicate.TAPPED);
filter.add(new ControllerIdPredicate(opponent.getId()));
return new DrawCardSourceControllerEffect(game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game)).apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class VarinaLichQueenTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int attackingZombies = 0;
for (UUID attacker : game.getCombat().getAttackers()) {
Permanent creature = game.getPermanent(attacker);
if (creature != null && creature.getControllerId() != null && creature.isControlledBy(this.getControllerId()) && creature.hasSubtype(SubType.ZOMBIE, game)) {
attackingZombies++;
}
}
if (attackingZombies > 0) {
this.getEffects().clear();
addEffect(new DrawCardSourceControllerEffect(attackingZombies));
addEffect(new DiscardControllerEffect(attackingZombies, false));
addEffect(new GainLifeEffect(attackingZombies));
return true;
}
return false;
}
Aggregations