Search in sources :

Example 1 with DiscardHandControllerEffect

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);
}
Also used : SacrificeOpponentsEffect(mage.abilities.effects.common.SacrificeOpponentsEffect) Player(mage.players.Player) DiscardHandControllerEffect(mage.abilities.effects.common.discard.DiscardHandControllerEffect)

Example 2 with DiscardHandControllerEffect

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;
}
Also used : Player(mage.players.Player) AmountOfDamageAPlayerReceivedThisTurnWatcher(mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher) DiscardHandControllerEffect(mage.abilities.effects.common.discard.DiscardHandControllerEffect)

Example 3 with DiscardHandControllerEffect

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;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) ExileZone(mage.game.ExileZone) DiscardHandControllerEffect(mage.abilities.effects.common.discard.DiscardHandControllerEffect)

Aggregations

DiscardHandControllerEffect (mage.abilities.effects.common.discard.DiscardHandControllerEffect)3 Player (mage.players.Player)3 SacrificeOpponentsEffect (mage.abilities.effects.common.SacrificeOpponentsEffect)1 ExileZone (mage.game.ExileZone)1 Permanent (mage.game.permanent.Permanent)1 AmountOfDamageAPlayerReceivedThisTurnWatcher (mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher)1