Package mage.filter.predicate.mageobject

Examples of mage.filter.predicate.mageobject.PowerPredicate


        if (ability instanceof SimpleActivatedAbility) {
            Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
            if (sourcePermanent != null) {
                int numbCounters = sourcePermanent.getCounters().getCount("treasure");
                FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on Legacy's Allure");
                filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, numbCounters + 1));
                ability.getTargets().clear();
                ability.getTargets().add(new TargetCreaturePermanent(filter));
            }
        }
    }
View Full Code Here


            for (Effect effect :ability.getEffects()) {
                if (effect instanceof UnblockableTargetEffect) {
                    int manaX = ability.getManaCostsToPay().getX();
                    ability.getTargets().clear();
                    FilterCreaturePermanent newFilter = new FilterCreaturePermanent(new StringBuilder("creature with power ").append(manaX).append(" or less").toString());
                    filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, manaX +1));
                    Target target = new TargetCreaturePermanent(newFilter);
                    ability.addTarget(target);
                    break;
                }
            }
View Full Code Here

                            if (permanentToSacrifice != null) {
                                toSacrifice.add(permanentToSacrifice);
                            }
                        } else if (greatestPower != Integer.MIN_VALUE) {
                            FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature to sacrifice with power equal to " + greatestPower);
                            filter.add(new PowerPredicate(Filter.ComparisonType.Equal, greatestPower));
                            Target target = new TargetControlledCreaturePermanent(filter);
                            if (opponent.choose(outcome, target, playerId, game)) {
                                Permanent permanent = game.getPermanent(target.getFirstTarget());
                                if (permanent != null) {
                                    toSacrifice.add(permanent);
View Full Code Here

                    }
                }
            }
            if (multipleExist) {
                FilterCreaturePermanent filter = new FilterCreaturePermanent("one of the creatures with the least power");
                filter.add(new PowerPredicate(Filter.ComparisonType.Equal, leastPower));
                Target target = new TargetPermanent(filter);
                target.setNotTarget(true);
                if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
                    if (controller.choose(outcome, target, source.getSourceId(), game)) {
                        permanentToDestroy = game.getPermanent(target.getFirstTarget());
View Full Code Here

    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SpellAbility) {
            int xValue = ability.getManaCostsToPay().getX();
            ability.getTargets().clear();
            FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature with power ").append(xValue).append(" or less").toString());
            filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, xValue + 1));
            ability.addTarget(new TargetCreaturePermanent(filter));
        }
    }
View Full Code Here

TOP

Related Classes of mage.filter.predicate.mageobject.PowerPredicate

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.