Package mage.filter.predicate.permanent

Examples of mage.filter.predicate.permanent.ControllerIdPredicate


            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
                Player opponent = game.getPlayer(event.getPlayerId());
                if (opponent != null) {
                    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getName() + " controls");
                    filter.add(new ControllerIdPredicate(opponent.getId()));

                    this.getTargets().clear();
                    this.addTarget(new TargetCreaturePermanent(filter));
                    return true;
                }
View Full Code Here


            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())){
                Player opponent = game.getPlayer(event.getPlayerId());
                if (opponent != null) {
                    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getName() + " controls");
                    filter.add(new ControllerIdPredicate(opponent.getId()));
                    this.getTargets().clear();
                    this.getTargets().add(new TargetCreaturePermanent(filter));
                    return true;
                }
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
        if (defenderId != null) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            filter.add(new ControllerIdPredicate(defenderId));
            TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
            Player player = game.getPlayer(source.getControllerId());
            if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
                    Permanent permanent = game.getPermanent(target.getFirstTarget());
View Full Code Here

            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
                Player opponent = game.getPlayer(event.getPlayerId());
                if (opponent != null) {
                    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getName() + " controls");
                    filter.add(new ControllerIdPredicate(opponent.getId()));

                    this.getTargets().clear();
                    this.addTarget(new TargetCreaturePermanent(filter));
                    return true;
                }
View Full Code Here

            return 0;
        }

        FilterLandPermanent filter = new FilterLandPermanent();
        filter.add(Predicates.not(new SupertypePredicate("Basic")));
        filter.add(new ControllerIdPredicate(sourceAbility.getFirstTarget()));

        return game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(getTargetPointer().getFirst(game, source));

        FilterControlledPermanent filter = new FilterControlledPermanent("creature");
        filter.add(new CardTypePredicate(CardType.CREATURE));
        filter.add(new ControllerIdPredicate(player.getId()));
        TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);

        //A spell or ability could have removed the only legal target this player
        //had, if thats the case this ability should fizzle.
        if (target.canChoose(player.getId(), game)) {
View Full Code Here

TOP

Related Classes of mage.filter.predicate.permanent.ControllerIdPredicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.