use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class NecriteTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game);
FilterPermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(defendingPlayerId));
Target target = new TargetPermanent(filter);
this.getTargets().clear();
this.addTarget(target);
return true;
}
return false;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class SeverTheBloodlineEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
if (controller != null && targetPermanent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
if (CardUtil.haveEmptyName(targetPermanent)) {
// if no name (face down creature) only the creature itself is selected
filter.add(new PermanentIdPredicate(targetPermanent.getId()));
} else {
filter.add(new NamePredicate(targetPermanent.getName()));
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
controller.moveCardToExileWithInfo(permanent, null, "", source, game, Zone.BATTLEFIELD, true);
}
return true;
}
return false;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class ShamanOfForgottenWaysEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
FilterPermanent filter = new FilterCreaturePermanent();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
int numberCreatures = game.getBattlefield().getAllActivePermanents(filter, playerId, game).size();
player.setLife(numberCreatures, game, source);
}
}
return true;
}
return false;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class SkirkCommandoTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
getTargets().clear();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player " + player.getName() + " controls");
filter.add(new ControllerIdPredicate(event.getPlayerId()));
addTarget(new TargetCreaturePermanent(filter));
return true;
}
}
return false;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class TopplegeistAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent FILTER = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
FILTER.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(FILTER));
return true;
}
}
return false;
}
Aggregations