Package mage.abilities.effects

Examples of mage.abilities.effects.ContinuousEffect


    state.applyEffects(this);
  }

  @Override
  public void addEffect(ContinuousEffect continuousEffect, Ability source) {
    ContinuousEffect newEffect = (ContinuousEffect)continuousEffect.copy();
    Ability newAbility = source.copy();
    newEffect.newId();
    newEffect.setTimestamp();
    newEffect.init(newAbility, this);
    state.addEffect(newEffect, newAbility);
  }
View Full Code Here


        this.toughness = new MageInt(1);

        // Bloodghast can't block.
        this.addAbility(new CantBlockAbility());
        // Bloodghast has haste as long as an opponent has 10 or less life.
        ContinuousEffect effect = new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield);
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect,
                new TenOrLessLifeCondition(TenOrLessLifeCondition.CheckType.AN_OPPONENT),
                "Bloodghast has haste as long as an opponent has 10 or less life")));
        // Landfall — Whenever a land enters the battlefield under your control, you may return Bloodghast from your graveyard to the battlefield.
        this.addAbility(new LandfallAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), true));
View Full Code Here

            }
        }
        this.attachedTo = permanentId;
        for (Ability ability : this.getAbilities()) {
            for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext();) {
                ContinuousEffect effect = (ContinuousEffect) ite.next();
                game.getContinuousEffects().setUniqueTimesstamp(effect);
                // It's important is to update timestamp of the copied effect in ContinuousEffects because it does the action
                for (ContinuousEffect conEffect: game.getContinuousEffects().getLayeredEffects(game)) {
                    if (conEffect.getId().equals(effect.getId())) {
                        game.getContinuousEffects().setUniqueTimesstamp(conEffect);
                    }
                }
            }
        }
View Full Code Here

                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
                    for (UUID target : this.targetPointer.getTargets(game, source)) {
                        Permanent permanent = game.getPermanent(target);
                        if (permanent != null) {
                            permanent.tap(game);
                            ContinuousEffect effect = new SkipNextUntapTargetEffect();
                            effect.setTargetPointer(new FixedTarget(permanent.getId()));
                            game.addEffect(effect, source);
                        }
                    }
                    return false;
                }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanent(source.getSourceId());
        Player controller = game.getPlayer(source.getControllerId());
        if (permanent != null && controller != null) {
            if (permanent.flip(game)) {
                ContinuousEffect effect = new ConditionalContinousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), "");
                game.addEffect(effect, source);
                game.informPlayers(new StringBuilder(controller.getName()).append(" flips ").append(permanent.getName()).toString());
                return true;
            }
        }
View Full Code Here

                Card sourceCard = game.getCard(source.getSourceId());
                Permanent targetCreature = game.getPermanent(target.getFirstTarget());
                if (targetCreature != null && sourceCard != null) {
                    String ruleText = new StringBuilder("you may cast a copy of ").append(sourceCard.getLogName()).append(" without paying its mana cost").toString();
                    Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new CipherStoreEffect(source.getSourceId(), ruleText), true);
                    ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
                    effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
                    game.addEffect(effect, source);
                    game.informPlayers(new StringBuilder(sourceCard.getLogName()).append(": Spell ciphered to ").append(targetCreature.getLogName()).toString());
                    return sourceCard.moveToExile(null, "", source.getSourceId(), game);
                } else {
                    return false;
View Full Code Here

        return new AddContinuousEffectToGame(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        ContinuousEffect effectToAdd = (ContinuousEffect) effect.copy();
        game.addEffect(effectToAdd, source);
        return true;
    }
View Full Code Here

    public List<Ability> build() {
        List<Ability> constructed = new ArrayList<>();

        Condition condition = new SourceHasCounterCondition(CounterType.LEVEL, level1, level2);
        for (Ability ability : abilities) {
            ContinuousEffect effect = new GainAbilitySourceEffect(ability);
            ConditionalContinousEffect abEffect = new ConditionalContinousEffect(effect, condition, "");
            Ability staticAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, abEffect);
            staticAbility.setRuleVisible(false);
            constructed.add(staticAbility);
        }

        ContinuousEffect effect = new SetPowerToughnessSourceEffect(power, toughness, Duration.WhileOnBattlefield);
        ConditionalContinousEffect ptEffect = new ConditionalContinousEffect(effect, condition, rule);
        constructed.add(new SimpleStaticAbility(Zone.BATTLEFIELD, ptEffect));

        return constructed;
    }
View Full Code Here

    @Override
    public void addEffect(ContinuousEffect continuousEffect, Ability source) {
        Ability newAbility = source.copy();

        ContinuousEffect newEffect = continuousEffect.copy();
        newEffect.newId();
        newEffect.setTimestamp();
        newEffect.init(newAbility, this);

        state.addEffect(newEffect, newAbility);
    }
View Full Code Here

        this.addAbility(new KickerAbility("{2}{B}"));

        // Target creature gets +3/+0 until end of turn. If Vampire's Bite was kicked, that creature gains lifelink until end of turn.
        this.getSpellAbility().addTarget(new TargetCreaturePermanent());
        this.getSpellAbility().addEffect(new BoostTargetEffect(3, 0, Duration.EndOfTurn));
        ContinuousEffect effect = new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn);
        this.getSpellAbility().addEffect(new ConditionalContinousEffect(effect, new LockedInCondition(KickedCondition.getInstance()), "If {this} was kicked, that creature gains lifelink until end of turn"));
    }
View Full Code Here

TOP

Related Classes of mage.abilities.effects.ContinuousEffect

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.