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;
}
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;
}
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;
}
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;
}
Aggregations