use of mage.filter.common.FilterLandPermanent in project mage by magefree.
the class VisionCharmEffect method init.
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice choice = new ChoiceLandType();
if (!controller.choose(outcome, choice, game)) {
discard();
return;
}
targetLandType = choice.getChoice();
choice = new ChoiceBasicLandType();
if (!controller.choose(outcome, choice, game)) {
discard();
return;
}
targetBasicLandType = SubType.byDescription(choice.getChoice());
if (targetLandType == null || targetBasicLandType == null) {
this.discard();
return;
}
} else {
this.discard();
return;
}
FilterPermanent filter = new FilterLandPermanent();
filter.add(SubType.byDescription(targetLandType).getPredicate());
if (this.affectedObjectsSet) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
affectedObjectList.add(new MageObjectReference(permanent, game));
}
}
}
use of mage.filter.common.FilterLandPermanent in project mage by magefree.
the class SimpleGameTest method testSimple.
@Test
public void testSimple() {
addCard(Zone.BATTLEFIELD, playerA, "Forest");
addCard(Zone.BATTLEFIELD, playerB, "Forest");
addCard(Zone.BATTLEFIELD, playerC, "Forest");
addCard(Zone.BATTLEFIELD, playerD, "Forest");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertLife(playerC, 20);
assertLife(playerD, 20);
FilterPermanent filterPermanent = new FilterLandPermanent();
filterPermanent.add(SubType.FOREST.getPredicate());
List<Permanent> forestCards = currentGame.getBattlefield().getAllActivePermanents(filterPermanent, currentGame);
Assert.assertEquals(4, forestCards.size());
}
use of mage.filter.common.FilterLandPermanent in project mage by magefree.
the class DeusOfCalamityTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId()) && event.getAmount() > 5 && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) {
FilterLandPermanent filter = new FilterLandPermanent("land of the damaged player");
filter.add(new ControllerIdPredicate(event.getTargetId()));
Target target = new TargetLandPermanent(filter);
this.getTargets().clear();
this.addTarget(target);
return true;
}
return false;
}
use of mage.filter.common.FilterLandPermanent in project mage by magefree.
the class HokoriDustDrinkerUntapEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
FilterLandPermanent filter = new FilterLandPermanent("land you control");
filter.add(new ControllerIdPredicate(game.getActivePlayerId()));
Target target = new TargetLandPermanent(filter);
if (player != null && player.chooseTarget(Outcome.Untap, target, source, game)) {
for (UUID landId : target.getTargets()) {
Permanent land = game.getPermanent(landId);
if (land != null) {
land.untap(game);
}
}
return true;
}
return false;
}
use of mage.filter.common.FilterLandPermanent in project mage by magefree.
the class ManaSkimmerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent source = game.getPermanent(event.getSourceId());
if (source != null && source.getId().equals(this.getSourceId())) {
FilterLandPermanent filter = new FilterLandPermanent("land that player controls");
filter.add(new ControllerIdPredicate(event.getPlayerId()));
filter.setMessage("land controlled by " + game.getPlayer(event.getTargetId()).getLogName());
this.getTargets().clear();
this.addTarget(new TargetPermanent(filter));
return true;
}
return false;
}
Aggregations