Search in sources :

Example 1 with BoostEnchantedEffect

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;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) BoostEnchantedEffect(mage.abilities.effects.common.continuous.BoostEnchantedEffect) ChoiceImpl(mage.choices.ChoiceImpl)

Example 2 with BoostEnchantedEffect

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

Aggregations

BoostEnchantedEffect (mage.abilities.effects.common.continuous.BoostEnchantedEffect)2 Permanent (mage.game.permanent.Permanent)2 TargetPermanent (mage.target.TargetPermanent)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 MageObjectReference (mage.MageObjectReference)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)1 GainAbilityAllEffect (mage.abilities.effects.common.continuous.GainAbilityAllEffect)1 GainAbilityAttachedEffect (mage.abilities.effects.common.continuous.GainAbilityAttachedEffect)1 Choice (mage.choices.Choice)1 ChoiceImpl (mage.choices.ChoiceImpl)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 MageObjectReferencePredicate (mage.filter.predicate.mageobject.MageObjectReferencePredicate)1 Player (mage.players.Player)1