use of mage.abilities.effects.common.discard.DiscardHandControllerEffect in project mage by magefree.
the class MalfegorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int sacrificeNumber = controller.getHand().size();
if (sacrificeNumber == 0) {
return true;
}
new DiscardHandControllerEffect().apply(game, source);
return new SacrificeOpponentsEffect(sacrificeNumber, StaticFilters.FILTER_CONTROLLED_CREATURE).apply(game, source);
}
use of mage.abilities.effects.common.discard.DiscardHandControllerEffect in project mage by magefree.
the class KnollspineDragonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
if (controller != null) {
new DiscardHandControllerEffect().apply(game, source);
if (targetOpponent != null) {
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
if (watcher != null) {
int drawAmount = watcher.getAmountOfDamageReceivedThisTurn(targetOpponent.getId());
controller.drawCards(drawAmount, source, game);
return true;
}
}
game.informPlayers(controller.getLogName() + " drew no cards");
return true;
}
return false;
}
use of mage.abilities.effects.common.discard.DiscardHandControllerEffect in project mage by magefree.
the class KnowledgeVaultReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (sourcePermanent != null && controller != null) {
if (sourcePermanent.sacrifice(source, game)) {
new DiscardHandControllerEffect().apply(game, source);
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
if (exileZone != null) {
controller.moveCards(exileZone, Zone.HAND, source, game);
}
}
return true;
}
return false;
}
Aggregations