Search in sources :

Example 6 with DrawCardTargetEffect

use of mage.abilities.effects.common.DrawCardTargetEffect in project mage by magefree.

the class IndenturedDjinnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        for (UUID playerId : game.getOpponents(source.getControllerId())) {
            Player player = game.getPlayer(playerId);
            if (player != null) {
                Effect effect = new DrawCardTargetEffect(StaticValue.get(3), false, true);
                effect.setTargetPointer(new FixedTarget(playerId));
                effect.setText(player.getLogName() + " may draw up to three cards");
                effect.apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) UUID(java.util.UUID)

Example 7 with DrawCardTargetEffect

use of mage.abilities.effects.common.DrawCardTargetEffect in project mage by magefree.

the class KravTheUnredeemedEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = GetXValue.instance.calculate(game, source, this);
    new DrawCardTargetEffect(xValue).apply(game, source);
    new GainLifeTargetEffect(xValue).apply(game, source);
    new AddCountersSourceEffect(CounterType.P1P1.createInstance(xValue)).apply(game, source);
    return true;
}
Also used : AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) GainLifeTargetEffect(mage.abilities.effects.common.GainLifeTargetEffect)

Example 8 with DrawCardTargetEffect

use of mage.abilities.effects.common.DrawCardTargetEffect in project mage by magefree.

the class UndercityReachesTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Plane cPlane = game.getState().getCurrentPlane();
    if (cPlane == null) {
        return false;
    }
    if (!cPlane.getPlaneType().equals(Planes.PLANE_UNDERCITY_REACHES)) {
        return false;
    }
    if (((DamagedPlayerEvent) event).isCombatDamage()) {
        Permanent creature = game.getPermanent(event.getSourceId());
        if (creature != null) {
            Effect effect = new DrawCardTargetEffect(StaticValue.get(1), true, false);
            effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
            effect.apply(game, this);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) Plane(mage.game.command.Plane) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) RollPlanarDieEffect(mage.abilities.effects.common.RollPlanarDieEffect) MaximumHandSizeControllerEffect(mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) PlanarDieRollCostIncreasingEffect(mage.abilities.effects.common.cost.PlanarDieRollCostIncreasingEffect) Effect(mage.abilities.effects.Effect) DamagedPlayerEvent(mage.game.events.DamagedPlayerEvent)

Example 9 with DrawCardTargetEffect

use of mage.abilities.effects.common.DrawCardTargetEffect in project mage by magefree.

the class TradeSecretsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    String message = "Do you want to draw two cards and allow the spellcaster to draw up to four cards again?";
    String message2 = "How many cards do you want to draw?";
    Player controller = game.getPlayer(source.getControllerId());
    Player targetOpponent = game.getPlayer(source.getFirstTarget());
    if (controller != null && targetOpponent != null) {
        // The drawcard method would not work immediately
        new DrawCardTargetEffect(2).apply(game, source);
        int amountOfCardsToDraw = controller.getAmount(0, 4, message2, game);
        new DrawCardSourceControllerEffect(amountOfCardsToDraw).apply(game, source);
        while (targetOpponent.chooseUse(Outcome.AIDontUseIt, message, source, game)) {
            new DrawCardTargetEffect(2).apply(game, source);
            amountOfCardsToDraw = controller.getAmount(0, 4, message2, game);
            new DrawCardSourceControllerEffect(amountOfCardsToDraw).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) DrawCardTargetEffect(mage.abilities.effects.common.DrawCardTargetEffect) DrawCardSourceControllerEffect(mage.abilities.effects.common.DrawCardSourceControllerEffect)

Aggregations

DrawCardTargetEffect (mage.abilities.effects.common.DrawCardTargetEffect)9 Player (mage.players.Player)7 FixedTarget (mage.target.targetpointer.FixedTarget)7 Effect (mage.abilities.effects.Effect)6 UUID (java.util.UUID)5 OneShotEffect (mage.abilities.effects.OneShotEffect)5 Permanent (mage.game.permanent.Permanent)3 DrawCardSourceControllerEffect (mage.abilities.effects.common.DrawCardSourceControllerEffect)2 HashSet (java.util.HashSet)1 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 AtTheBeginOfNextUpkeepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility)1 Cost (mage.abilities.costs.Cost)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)1 DestroyTargetEffect (mage.abilities.effects.common.DestroyTargetEffect)1 GainLifeTargetEffect (mage.abilities.effects.common.GainLifeTargetEffect)1 RollPlanarDieEffect (mage.abilities.effects.common.RollPlanarDieEffect)1 MaximumHandSizeControllerEffect (mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect)1