use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class QuickSilverElementalBlueManaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent creature = game.getPermanent(source.getTargets().getFirstTarget());
if (permanent != null && creature != null) {
for (ActivatedAbility ability : creature.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
Ability newAbility = ability.copy();
newAbility.newOriginalId();
game.addEffect(new GainAbilitySourceEffect(newAbility, Duration.EndOfTurn), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class TwoHeadedGiantEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
boolean head1 = player.flipCoin(source, game, false);
boolean head2 = player.flipCoin(source, game, false);
if (head1 == head2) {
if (head1) {
game.addEffect(new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn), source);
} else {
game.addEffect(new GainAbilitySourceEffect(new MenaceAbility(), Duration.EndOfTurn), source);
}
}
return true;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect 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.continuous.GainAbilitySourceEffect in project mage by magefree.
the class CallousDeceiverEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
cards.add(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand(game)) {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class FeralDeceiverEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand(game)) {
game.addEffect(new BoostSourceEffect(2, 2, Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), source);
}
}
return true;
}
return false;
}
Aggregations