use of mage.abilities.effects.common.DrawDiscardControllerEffect in project mage by magefree.
the class HordewingSkaabTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerBatchEvent dEvent = (DamagedPlayerBatchEvent) event;
Set<UUID> opponents = new HashSet<>();
for (DamagedEvent damagedEvent : dEvent.getEvents()) {
if (!damagedEvent.isCombatDamage()) {
continue;
}
Permanent permanent = game.getPermanent(damagedEvent.getSourceId());
if (permanent == null || !permanent.isControlledBy(getControllerId()) || !permanent.hasSubtype(SubType.ZOMBIE, game) || !game.getOpponents(getControllerId()).contains(damagedEvent.getTargetId())) {
continue;
}
opponents.add(damagedEvent.getTargetId());
}
if (opponents.size() < 1) {
return false;
}
this.getEffects().clear();
this.addEffect(new DrawDiscardControllerEffect(opponents.size(), opponents.size()));
return true;
}
use of mage.abilities.effects.common.DrawDiscardControllerEffect in project mage by magefree.
the class MirrodinBesiegedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
new DrawDiscardControllerEffect(1, 1).apply(game, source);
Player player = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget());
if (player == null || opponent == null) {
return false;
}
if (player.getGraveyard().getCards(StaticFilters.FILTER_CARD_ARTIFACT, source.getSourceId(), source.getControllerId(), game).size() >= 15) {
opponent.lost(game);
}
return true;
}
Aggregations