Search in sources :

Example 1 with DiscardControllerEffect

use of mage.abilities.effects.common.discard.DiscardControllerEffect 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;
}
Also used : Permanent(mage.game.permanent.Permanent) DrawCardSourceControllerEffect(mage.abilities.effects.common.DrawCardSourceControllerEffect) UUID(java.util.UUID) DiscardControllerEffect(mage.abilities.effects.common.discard.DiscardControllerEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect)

Aggregations

UUID (java.util.UUID)1 DrawCardSourceControllerEffect (mage.abilities.effects.common.DrawCardSourceControllerEffect)1 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)1 DiscardControllerEffect (mage.abilities.effects.common.discard.DiscardControllerEffect)1 Permanent (mage.game.permanent.Permanent)1