Search in sources :

Example 1 with ContinuousRuleModifyingEffect

use of mage.abilities.effects.ContinuousRuleModifyingEffect in project mage by magefree.

the class DreadWightCounterCondition method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
    if (permanent != null) {
        // add paralyzation counter
        Effect effect = new AddCountersTargetEffect(CounterType.PARALYZATION.createInstance());
        effect.setTargetPointer(new FixedTarget(permanent, game));
        effect.apply(game, source);
        // tap permanent
        permanent.tap(source, game);
        // does not untap while paralyzation counter is on it
        ContinuousRuleModifyingEffect effect2 = new DreadWightDoNotUntapEffect(Duration.WhileOnBattlefield, permanent.getId());
        effect2.setText("This creature doesn't untap during its controller's untap step for as long as it has a paralyzation counter on it");
        Condition condition = new DreadWightCounterCondition(permanent.getId());
        ConditionalContinuousRuleModifyingEffect conditionalEffect = new ConditionalContinuousRuleModifyingEffect(effect2, condition);
        Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, conditionalEffect);
        ContinuousEffect effect3 = new GainAbilityTargetEffect(ability, Duration.WhileOnBattlefield);
        ability.setRuleVisible(true);
        effect3.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect3, source);
        // each gains 4: remove paralyzation counter
        Ability activatedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.PARALYZATION.createInstance()), new ManaCostsImpl("{4}"));
        ContinuousEffect effect4 = new GainAbilityTargetEffect(activatedAbility, Duration.WhileOnBattlefield);
        effect4.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect4, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Condition(mage.abilities.condition.Condition) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) Ability(mage.abilities.Ability) Permanent(mage.game.permanent.Permanent) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalContinuousRuleModifyingEffect(mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ConditionalContinuousRuleModifyingEffect(mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect) ContinuousRuleModifyingEffect(mage.abilities.effects.ContinuousRuleModifyingEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) ConditionalContinuousRuleModifyingEffect(mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect) ContinuousRuleModifyingEffect(mage.abilities.effects.ContinuousRuleModifyingEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) RemoveCounterSourceEffect(mage.abilities.effects.common.counter.RemoveCounterSourceEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) RemoveCounterSourceEffect(mage.abilities.effects.common.counter.RemoveCounterSourceEffect)

Example 2 with ContinuousRuleModifyingEffect

use of mage.abilities.effects.ContinuousRuleModifyingEffect in project mage by magefree.

the class PeaceTalksPlayersAndPermanentsCantBeTargetsOfSpellsOrActivatedAbilities method apply.

@Override
public boolean apply(Game game, Ability source) {
    RestrictionEffect effect = new PeaceTalksCantAttackEffect();
    game.addEffect(effect, source);
    ContinuousRuleModifyingEffect effect2 = new PeaceTalksPlayersAndPermanentsCantBeTargetsOfSpellsOrActivatedAbilities();
    game.addEffect(effect2, source);
    return true;
}
Also used : ContinuousRuleModifyingEffect(mage.abilities.effects.ContinuousRuleModifyingEffect) RestrictionEffect(mage.abilities.effects.RestrictionEffect)

Aggregations

ContinuousRuleModifyingEffect (mage.abilities.effects.ContinuousRuleModifyingEffect)2 Ability (mage.abilities.Ability)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)1 Condition (mage.abilities.condition.Condition)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ConditionalContinuousRuleModifyingEffect (mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 RestrictionEffect (mage.abilities.effects.RestrictionEffect)1 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)1 RemoveCounterSourceEffect (mage.abilities.effects.common.counter.RemoveCounterSourceEffect)1 Permanent (mage.game.permanent.Permanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1