Search in sources :

Example 26 with ControllerIdPredicate

use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.

the class MassDiminishEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new ControllerIdPredicate(source.getFirstTarget()));
    game.addEffect(new SetPowerToughnessAllEffect(1, 1, Duration.UntilYourNextTurn, filter, true), source);
    return true;
}
Also used : SetPowerToughnessAllEffect(mage.abilities.effects.common.continuous.SetPowerToughnessAllEffect) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate)

Example 27 with ControllerIdPredicate

use of mage.filter.predicate.permanent.ControllerIdPredicate 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;
}
Also used : Target(mage.target.Target) FilterPermanent(mage.filter.FilterPermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) TargetPermanent(mage.target.TargetPermanent) UUID(java.util.UUID)

Example 28 with ControllerIdPredicate

use of mage.filter.predicate.permanent.ControllerIdPredicate 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;
}
Also used : TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate)

Example 29 with ControllerIdPredicate

use of mage.filter.predicate.permanent.ControllerIdPredicate 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;
}
Also used : TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate)

Example 30 with ControllerIdPredicate

use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.

the class ToothCollectorAbility 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;
}
Also used : TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate)

Aggregations

ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)153 Player (mage.players.Player)105 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)87 Permanent (mage.game.permanent.Permanent)70 UUID (java.util.UUID)53 TargetPermanent (mage.target.TargetPermanent)53 FilterPermanent (mage.filter.FilterPermanent)51 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)41 Target (mage.target.Target)29 FixedTarget (mage.target.targetpointer.FixedTarget)21 TargetPlayer (mage.target.TargetPlayer)16 ContinuousEffect (mage.abilities.effects.ContinuousEffect)15 Effect (mage.abilities.effects.Effect)14 OneShotEffect (mage.abilities.effects.OneShotEffect)13 FilterLandPermanent (mage.filter.common.FilterLandPermanent)13 DamagedPlayerEvent (mage.game.events.DamagedPlayerEvent)11 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)9 FilterNonlandPermanent (mage.filter.common.FilterNonlandPermanent)9 MageObject (mage.MageObject)8 HashSet (java.util.HashSet)7