Package mage.abilities.effects

Examples of mage.abilities.effects.RestrictionEffect


            return false;
        }

        //20101001 - 509.1b
        for (Map.Entry entry: game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
            RestrictionEffect effect = (RestrictionEffect)entry.getKey();
            for (Ability ability : (HashSet<Ability>) entry.getValue()) {
                if (!effect.canBlock(null, this, ability, game)) {
                    return false;
                }
            }
        }
View Full Code Here


     * @return true - permanent can use activated abilities
     */
    @Override
    public boolean canUseActivatedAbilities(Game game) {
        for (Map.Entry entry: game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
            RestrictionEffect effect = (RestrictionEffect)entry.getKey();
            for (Ability ability : (HashSet<Ability>) entry.getValue()) {
                if (!effect.canUseActivatedAbilities(this, ability, game)) {
                    return false;
                }
            }
        }

View Full Code Here

    public boolean checkBlockRestrictionsAfter(Player player, Player controller, Game game) {
        for (UUID attackingCreatureId : this.getAttackers()) {
            Permanent attackingCreature = game.getPermanent(attackingCreatureId);
            if (attackingCreature != null) {
                for (Map.Entry<RestrictionEffect, HashSet<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(attackingCreature, game).entrySet()) {
                    RestrictionEffect effect = entry.getKey();
                    for (Ability ability : entry.getValue()) {
                        if (!effect.canBeBlockedCheckAfter(attackingCreature, ability, game)) {
                            if (controller.isHuman()) {
                                game.informPlayer(controller, new StringBuilder(attackingCreature.getLogName()).append(" can't be blocked this way.").toString());
                                return false;
                            } else {
                                // remove blocking creatures for AI
View Full Code Here

    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)));
View Full Code Here

TOP

Related Classes of mage.abilities.effects.RestrictionEffect

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.