use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class AberrantResearcherEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || controller.millCards(1, source, game).getCards(game).stream().noneMatch(card -> card.isInstantOrSorcery(game))) {
return false;
}
new TransformSourceEffect().apply(game, source);
return true;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class HeirloomMirrorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (player == null || permanent == null) {
return false;
}
player.drawCards(1, source, game);
player.millCards(1, source, game);
permanent.addCounters(CounterType.RITUAL.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.RITUAL);
if (counters < 3) {
return true;
}
permanent.removeCounters(CounterType.RITUAL.createInstance(counters), source, game);
new TransformSourceEffect().apply(game, source);
return true;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class LudevicsTestSubjectEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
if (p.getCounters(game).getCount(CounterType.HATCHLING) >= 5) {
p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), source, game);
TransformSourceEffect effect = new TransformSourceEffect();
return effect.apply(game, source);
}
}
return false;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class PrimalAmuletEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && player != null) {
permanent.addCounters(CounterType.CHARGE.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.CHARGE);
if (counters > 3 && player.chooseUse(Outcome.Benefit, "Transform this?", source, game)) {
permanent.removeCounters("charge", counters, source, game);
new TransformSourceEffect().apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class TreasureMapEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.scry(1, source, game);
if (permanent != null) {
permanent.addCounters(CounterType.LANDMARK.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK);
if (counters > 2) {
permanent.removeCounters("landmark", counters, source, game);
new TransformSourceEffect().apply(game, source);
new CreateTokenEffect(new TreasureToken(), 3).apply(game, source);
}
return true;
}
}
return false;
}
Aggregations