Search in sources :

Example 1 with GainAbilityAttachedEffect

use of mage.abilities.effects.common.continuous.GainAbilityAttachedEffect in project mage by magefree.

the class OldGrowthTrollContinuousEffect method makeAbility.

private static final Ability makeAbility() {
    Ability activatedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TrollWarriorToken(), 1, true, false), new GenericManaCost(1));
    activatedAbility.addCost(new TapSourceCost());
    Cost cost = new SacrificeSourceCost();
    cost.setText("sacrifice this land");
    activatedAbility.addCost(cost);
    Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost()), AttachmentType.AURA).setText("enchanted Forest has \"{T}: Add {G}{G}\""));
    ability.addEffect(new GainAbilityAttachedEffect(activatedAbility, AttachmentType.AURA).setText("and \"{1}, {T}, Sacrifice this land: Create a tapped 4/4 green Troll Warrior creature token with trample.\""));
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DiesSourceTriggeredAbility(mage.abilities.common.DiesSourceTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) SpellAbility(mage.abilities.SpellAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) TrampleAbility(mage.abilities.keyword.TrampleAbility) Ability(mage.abilities.Ability) TrollWarriorToken(mage.game.permanent.token.TrollWarriorToken) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) TapSourceCost(mage.abilities.costs.common.TapSourceCost) Cost(mage.abilities.costs.Cost) TapSourceCost(mage.abilities.costs.common.TapSourceCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost)

Example 2 with GainAbilityAttachedEffect

use of mage.abilities.effects.common.continuous.GainAbilityAttachedEffect in project mage by magefree.

the class CrownOfFuryEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // Enchanted creature ...
    ContinuousEffect effect = new BoostEnchantedEffect(1, 0, Duration.EndOfTurn);
    game.addEffect(effect, source);
    effect = new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.AURA, Duration.EndOfTurn);
    game.addEffect(effect, source);
    // ... and other creatures that share a creature type with it ...
    Permanent enchantedCreature = game.getPermanent(source.getSourcePermanentOrLKI(game).getAttachedTo());
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new CrownOfFuryPredicate(enchantedCreature));
    filter.add(Predicates.not(new MageObjectReferencePredicate(new MageObjectReference(enchantedCreature, game))));
    game.addEffect(new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), source);
    game.addEffect(new GainAbilityAllEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, filter), source);
    // ... get +1/+0 and gain first strike until end of turn.
    return true;
}
Also used : FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) BoostEnchantedEffect(mage.abilities.effects.common.continuous.BoostEnchantedEffect) MageObjectReferencePredicate(mage.filter.predicate.mageobject.MageObjectReferencePredicate) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect) GainAbilityAllEffect(mage.abilities.effects.common.continuous.GainAbilityAllEffect) MageObjectReference(mage.MageObjectReference)

Example 3 with GainAbilityAttachedEffect

use of mage.abilities.effects.common.continuous.GainAbilityAttachedEffect in project mage by magefree.

the class CrownOfAweEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // Enchanted creature
    ContinuousEffect effect = new GainAbilityAttachedEffect(ProtectionAbility.from(ObjectColor.BLACK, ObjectColor.RED), AttachmentType.AURA, Duration.EndOfTurn);
    game.addEffect(effect, source);
    // and other creatures that share a creature type with it
    Permanent enchantedCreature = game.getPermanent(source.getSourcePermanentOrLKI(game).getAttachedTo());
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new CrownOfAwePredicate(enchantedCreature));
    filter.add(Predicates.not(new MageObjectReferencePredicate(new MageObjectReference(enchantedCreature, game))));
    game.addEffect(effect, source);
    // have protection from black and from red until end of turn.
    return true;
}
Also used : FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) MageObjectReferencePredicate(mage.filter.predicate.mageobject.MageObjectReferencePredicate) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) MageObjectReference(mage.MageObjectReference)

Aggregations

GainAbilityAttachedEffect (mage.abilities.effects.common.continuous.GainAbilityAttachedEffect)3 MageObjectReference (mage.MageObjectReference)2 ContinuousEffect (mage.abilities.effects.ContinuousEffect)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 MageObjectReferencePredicate (mage.filter.predicate.mageobject.MageObjectReferencePredicate)2 Permanent (mage.game.permanent.Permanent)2 TargetPermanent (mage.target.TargetPermanent)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 Ability (mage.abilities.Ability)1 SpellAbility (mage.abilities.SpellAbility)1 DiesSourceTriggeredAbility (mage.abilities.common.DiesSourceTriggeredAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 Cost (mage.abilities.costs.Cost)1 SacrificeSourceCost (mage.abilities.costs.common.SacrificeSourceCost)1 TapSourceCost (mage.abilities.costs.common.TapSourceCost)1 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)1 ConditionalInterveningIfTriggeredAbility (mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)1