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;
}
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;
}
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;
}
Aggregations