use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class AscendantSpiritAngelEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || !permanent.hasSubtype(SubType.ANGEL, game)) {
return false;
}
permanent.addCounters(CounterType.P1P1.createInstance(2), source.getControllerId(), source, game);
game.addEffect(new GainAbilitySourceEffect(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), false), Duration.Custom), source);
return true;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class KeranosGodOfStormsTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(this.getControllerId())) {
return false;
}
if (!game.isActivePlayer(this.getControllerId())) {
return false;
}
CardsAmountDrawnThisTurnWatcher watcher = game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
return false;
}
Card card = game.getCard(event.getTargetId());
Player controller = game.getPlayer(this.getControllerId());
Permanent sourcePermanent = (Permanent) getSourceObject(game);
if (card == null || controller == null || sourcePermanent == null) {
return false;
}
controller.revealCards(sourcePermanent.getIdName(), new CardsImpl(card), game);
this.getTargets().clear();
this.getEffects().clear();
if (card.isLand(game)) {
this.addEffect(new DrawCardSourceControllerEffect(1));
} else {
this.addEffect(new DamageTargetEffect(3));
this.addTarget(new TargetAnyTarget());
}
return true;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class TheUrDragonTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int attackingDragons = 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.DRAGON, game)) {
attackingDragons++;
}
}
if (attackingDragons > 0) {
this.getEffects().clear();
addEffect(new DrawCardSourceControllerEffect(attackingDragons));
addEffect(new PutCardFromHandOntoBattlefieldEffect());
return true;
}
return false;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class RowenAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
if (game.isActivePlayer(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) {
Card card = game.getCard(event.getTargetId());
Player controller = game.getPlayer(this.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(this.getSourceId());
if (card != null && controller != null && sourcePermanent != null) {
lastTriggeredTurn = game.getTurnNum();
controller.revealCards(sourcePermanent.getName(), new CardsImpl(card), game);
this.getEffects().clear();
if (card.isLand(game) && card.isBasic()) {
this.addEffect(new DrawCardSourceControllerEffect(1));
}
return true;
}
}
}
return false;
}
use of mage.abilities.effects.common.DrawCardSourceControllerEffect in project mage by magefree.
the class SixthSenseTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedEvent) event).isCombatDamage()) {
if (event.getSourceId().equals(getSourceId())) {
this.getEffects().clear();
this.addEffect(new DrawCardSourceControllerEffect(1));
return true;
}
}
return false;
}
Aggregations