use of mage.abilities.effects.common.continuous.BoostEnchantedEffect in project mage by magefree.
the class PemminsAuraBoostEnchantedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent enchantment = game.getPermanent(source.getSourceId());
if (controller == null || enchantment == null) {
return false;
}
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature == null) {
return false;
}
Choice choice = new ChoiceImpl(true);
choice.setMessage("Select how to boost");
choice.getChoices().add(CHOICE_1);
choice.getChoices().add(CHOICE_2);
if (controller.choose(outcome, choice, game)) {
if (choice.getChoice().equals(CHOICE_1)) {
game.addEffect(new BoostEnchantedEffect(+1, -1, Duration.EndOfTurn), source);
} else {
game.addEffect(new BoostEnchantedEffect(-1, +1, Duration.EndOfTurn), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostEnchantedEffect 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;
}
Aggregations