use of mage.filter.common.FilterArtifactPermanent in project mage by magefree.
the class SeedsOfInnocenceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (Permanent artifact : game.getState().getBattlefield().getActivePermanents(new FilterArtifactPermanent(), controller.getId(), game)) {
Player artifactController = game.getPlayer(artifact.getControllerId());
int cmc = artifact.getManaValue();
if (artifact.destroy(source, game, true)) {
if (artifactController != null) {
artifactController.gainLife(cmc, game, source);
}
}
}
return true;
}
return false;
}
use of mage.filter.common.FilterArtifactPermanent in project mage by magefree.
the class BlinkmothUrnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifacts you control");
filter.add(new ControllerIdPredicate(game.getActivePlayerId()));
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (player != null && sourcePermanent != null && !sourcePermanent.isTapped()) {
player.getManaPool().addMana(Mana.ColorlessMana(game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).size()), game, source, false);
return true;
}
return false;
}
use of mage.filter.common.FilterArtifactPermanent in project mage by magefree.
the class BurdenOfGreedCount method calculate.
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (sourceAbility.getFirstTarget() == null) {
return 0;
}
FilterArtifactPermanent filter = new FilterArtifactPermanent();
filter.add(TappedPredicate.TAPPED);
filter.add(new ControllerIdPredicate(sourceAbility.getFirstTarget()));
return game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
}
Aggregations