@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { if (!game.getBattlefield().getActivePermanents(filter, source.getControllerId(), permanent.getId(), game).isEmpty()) { return false; } return true; } return false; } }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getFirstTarget(), game); for (Permanent creature : creatures) { affectedObjectList.add(new MageObjectReference(creature, game)); } } }
@Override public final boolean apply(Card input, Game game) { if(input.getConvertedManaCost() <= game.getBattlefield().getAllActivePermanents(new FilterControlledLandPermanent(), input.getOwnerId(), game).size()){ return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { int inputValue = game.getBattlefield().countAll(filter, getControllerId(), game); return ComparisonType.compare(inputValue, type, value); }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { if (permanent != null){ permanent.getCounters(game).removeAllCounters(CounterType.GOLD); } } return true; } }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { if (game.getBattlefield().countAll(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, source.getControllerId(), game) > 0) { return false; } return true; } // do not apply to other creatures. return false; } }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (!permanent.getId().equals(source.getSourceId())) { permanent.moveToExile(null, null, source.getSourceId(), game); } } return true; } }
@Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { creature.tap(game); } return true; }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { affectedObjectList.add(new MageObjectReference(perm, game)); } } } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(new FilterControlledArtifactPermanent("artifacts"), targetPointer.getFirst(game, source), game).size(); player.damage(damage, source.getSourceId(), game, false, true); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { int maxPower = 0; for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { maxPower = Math.max(maxPower, creature.getPower().getValue()); } game.addEffect(new BoostSourceEffect(maxPower, 0, Duration.EndOfTurn), source); return true; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getControllerId()); if (targetPlayer != null) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, targetPlayer.getId(), game)) { permanent.untap(game); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.sacrifice(source.getSourceId(), game); } return true; } }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { permanent.removeCounters(CounterType.RUST.createInstance(permanent.getCounters(game).getCount(CounterType.RUST)), game); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int life = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) * 3; player.gainLife(life, game, source); } return true; }
@Override public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game); for (Permanent p : permanents) { if (!p.getColor(game).isColorless()) { p.sacrifice(source.getSourceId(), game); } } return true; }
@Override public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { if (sourceId.equals(source.getSourceId()) && source.isControlledBy(affectedControllerId)) { Card card = game.getCard(source.getSourceId()); if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0) { return true; } } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); if (permanent != null && !permanent.getImprinted().isEmpty()) { FilterPermanent filterPermanent = new FilterPermanent(); filterPermanent.add(new NamePredicate(game.getCard(permanent.getImprinted().get(0)).getName())); value = game.getBattlefield().count(filterPermanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); } return value; }
@Override public boolean apply(Game game, Ability source) { boolean ret = false; for(Permanent enchantment : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_ENCHANTMENT_PERMANENT, source.getControllerId(), source.getControllerId(), game)) { ContinuousEffect gainControl = new GainControlTargetEffect(Duration.EndOfGame); gainControl.setTargetPointer(new FixedTarget(enchantment.getId())); game.addEffect(gainControl, source); ret = true; } return ret; } }
@Override public boolean apply(Game game, Ability source) { FilterArtifactPermanent filter = new FilterArtifactPermanent(); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, source.getManaCostsToPay().getX() + 1)); for(Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.destroy(source.getSourceId(), game, false); } return true; } }