Package mage.filter.predicate.permanent

Examples of mage.filter.predicate.permanent.ControllerIdPredicate


    @Override
    public boolean apply(Game game, Ability source) {
        if (targetPointer.getFirst(game, source) != null) {
            FilterArtifactPermanent filter = new FilterArtifactPermanent();
            filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source)));
            for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
                permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
            }
            return true;
        }
View Full Code Here


    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            UUID defenderId = game.getCombat().getDefendingPlayerId(sourceId, game);
            filter.add(new ControllerIdPredicate(defenderId));

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

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            UUID defenderId = game.getCombat().getDefenderId(sourceId);
            filter.add(new ControllerIdPredicate(defenderId));

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

    public void adjustTargets(Ability ability, Game game) {
        if (ability.getAbilityType().equals(AbilityType.TRIGGERED)) {
            ability.getTargets().clear();
            FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
            UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
            filter.add(new ControllerIdPredicate(defenderId));
            TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
            ability.addTarget(target);
        }
    }
View Full Code Here

            Permanent equipment = game.getPermanent(getSourceId());
            if (equipment != null && equipment.getAttachedTo() != null) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
                UUID defenderId = game.getCombat().getDefendingPlayerId(equipment.getAttachedTo(), game);
                if (defenderId != null) {
                    filter.add(new ControllerIdPredicate(defenderId));
                    this.getTargets().clear();
                    TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
                    this.addTarget(target);
                    return true;
                }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (targetPlayer != null) {
            FilterCreaturePermanent filter = new FilterCreaturePermanent();
            filter.add(new ControllerIdPredicate(targetPlayer.getId()));
            RestrictionEffect effect = new CantBlockAllEffect(filter, Duration.EndOfTurn);
            game.addEffect(effect, source);
            FilterPermanent filter2 = new FilterPermanent();
            filter2.add(new ControllerIdPredicate(targetPlayer.getId()));
            filter2.add(Predicates.or(new ColorPredicate(ObjectColor.WHITE),
                    new ColorPredicate(ObjectColor.BLUE)));
            filter2.add(new CardTypePredicate(CardType.CREATURE));
            for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter2, targetPlayer.getId(), game)) {
                creature.damage(1, source.getSourceId(), game, false, true);
View Full Code Here

    public boolean checkTrigger(GameEvent event, Game game) {
        if (event instanceof DamagedPlayerEvent) {
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
            if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
                FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact that player controls");
                filter.add(new ControllerIdPredicate(event.getPlayerId()));
                filter.setMessage("artifact controlled by " + game.getPlayer(event.getTargetId()).getName());

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

    @Override
    public void selectAttackers(Game game, UUID attackingPlayerId) {
        updateGameStatePriority("selectAttackers", game);
        FilterCreatureForCombat filter = filterCreatureForCombat.copy();
        filter.add(new ControllerIdPredicate(attackingPlayerId));
        while (!abort) {
            if (passedAllTurns ||
               (!getUserData().getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction() && (passedTurn || passedUntilEndOfTurn || passedUntilNextMain) )) {
                return;
            }
View Full Code Here

    @Override
    public void selectBlockers(Game game, UUID defendingPlayerId) {
        updateGameStatePriority("selectBlockers", game);
        FilterCreatureForCombatBlock filter = filterCreatureForCombatBlock.copy();
        filter.add(new ControllerIdPredicate(defendingPlayerId));
        if (game.getBattlefield().count(filter, null, playerId, game) == 0 && !getUserData().getUserSkipPrioritySteps().isStopOnDeclareBlockerIfNoneAvailable()) {
            return;
        }
        while (!abort) {
            game.fireSelectEvent(playerId, "Select blockers");
View Full Code Here

                sb.append("Do you wish to sacrifice ").append(sourcePermanent.getName());
                sb.append(" to destroy target creature controlled by ");
                sb.append(game.getPlayer(event.getTargetId()).getName()).append("?");
                if (player.chooseUse(Outcome.DestroyPermanent, sb.toString(), game)) {
                    FilterCreaturePermanent filter = new FilterCreaturePermanent();
                    filter.add(new ControllerIdPredicate(event.getTargetId()));
                    filter.setMessage("creature controlled by " + game.getPlayer(event.getTargetId()).getName());

                    this.getTargets().clear();
                    this.addTarget(new TargetCreaturePermanent(filter));
                    return true;
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.