@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controllerId, game)) { return permanent != null; } return false; }
@Override public boolean apply(Game game, Ability source) { FilterLandPermanent filterLand = new FilterLandPermanent(); filterLand.add(new SubtypePredicate(subtype)); int landCount = game.getBattlefield().getAllActivePermanents(CardType.LAND).size(); return game.getBattlefield().getAllActivePermanents(filterLand, game).size() == landCount; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { HashSet<String> landNames = new HashSet<>(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { if (permanent.isLand()) { landNames.add(permanent.getName()); } } return landNames.size(); }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { permanent.sacrifice(source.getSourceId(), game); } return true; } }
@Override public void init(Ability source, Game game) { super.init(source, game); for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { affectedObjectList.add(new MageObjectReference(perm, game)); } }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { affectedObjectList.add(new MageObjectReference(permanent, game)); } } }
@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 void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { affectedObjectList.add(new MageObjectReference(perm, game)); } } } }
@Override public boolean apply(Game game, Ability source) { int totalPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { totalPower += permanent.getPower().getValue(); if (totalPower >= 10) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { int sumPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { sumPower += permanent.getPower().getValue(); } return sumPower >= 8; }
@Override public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { if (permanent != null) { permanent.getColor(game).setColor(ObjectColor.BLACK); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int damage = game.getBattlefield().getAllActivePermanents(filter, 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 count = countEquipment(game, source); List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game); for (Permanent perm : permanents) { if (!perm.getId().equals(source.getSourceId())) { perm.addPower(2 * count); perm.addToughness(2 * count); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { for (Permanent nonland : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_NON_LAND, player.getId(), game)) { nonland.untap(game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { for (Permanent land: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) { land.untap(game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId()); effect.setTargetPointer(new FixedTarget(permanent, game)); effect.apply(game, source); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, targetPlayer.getId(), game)) { creature.addCounters(CounterType.M1M1.createInstance(), source, game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterAttackingOrBlockingCreature(), targetPlayer.getId(), game)) { creature.damage(2, source.getSourceId(), game, false, true); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { for (Permanent permanent: game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { for (BoostCounter counter: permanent.getCounters(game).getBoostCounters()) { permanent.addPower(counter.getPower() * counter.getCount()); permanent.addToughness(counter.getToughness() * counter.getCount()); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId()); effect.setTargetPointer(new FixedTargets(game.getBattlefield().getAllActivePermanents(new FilterAttackingCreature(), controller.getId(), game), game)); game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source); return true; } return false; }