Search in sources :

Example 6 with GainAbilityControlledEffect

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

the class BoldDefenseEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (KickedCondition.instance.apply(game, source)) {
        game.addEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn), source);
        game.addEffect(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE), source);
    } else {
        game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
    }
    return true;
}
Also used : GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) BoostControlledEffect(mage.abilities.effects.common.continuous.BoostControlledEffect)

Example 7 with GainAbilityControlledEffect

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

the class EonFrolickerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player == null) {
        return false;
    }
    game.getState().getTurnMods().add(new TurnMod(player.getId(), false));
    FilterPlayer filter = new FilterPlayer(player.getName());
    filter.add(new PlayerIdPredicate(player.getId()));
    Ability ability = new ProtectionAbility(filter);
    game.addEffect(new GainAbilityControlledEffect(ability, Duration.UntilYourNextTurn, StaticFilters.FILTER_PERMANENT_PLANESWALKER), source);
    game.addEffect(new GainAbilityControllerEffect(ability, Duration.UntilYourNextTurn), source);
    return true;
}
Also used : EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) FlyingAbility(mage.abilities.keyword.FlyingAbility) ProtectionAbility(mage.abilities.keyword.ProtectionAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) FilterPlayer(mage.filter.FilterPlayer) PlayerIdPredicate(mage.filter.predicate.other.PlayerIdPredicate) ProtectionAbility(mage.abilities.keyword.ProtectionAbility) TurnMod(mage.game.turn.TurnMod) GainAbilityControllerEffect(mage.abilities.effects.common.continuous.GainAbilityControllerEffect)

Example 8 with GainAbilityControlledEffect

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

the class LenaSelflessChampionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (permanent == null) {
        return false;
    }
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, permanent.getPower().getValue()));
    game.addEffect(new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn, filter), source);
    return true;
}
Also used : FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) PowerPredicate(mage.filter.predicate.mageobject.PowerPredicate)

Example 9 with GainAbilityControlledEffect

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

the class LinvalaShieldOfSeaGateEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Ability ability = player.chooseUse(Outcome.Neutral, "Choose hexproof or indestructible", null, "Hexproof", "Indestructible", source, game) ? HexproofAbility.getInstance() : IndestructibleAbility.getInstance();
    game.addEffect(new GainAbilityControlledEffect(ability, Duration.EndOfTurn, StaticFilters.FILTER_CONTROLLED_CREATURE), source);
    return true;
}
Also used : BeginningOfCombatTriggeredAbility(mage.abilities.common.BeginningOfCombatTriggeredAbility) IndestructibleAbility(mage.abilities.keyword.IndestructibleAbility) FlyingAbility(mage.abilities.keyword.FlyingAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) HexproofAbility(mage.abilities.keyword.HexproofAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect)

Example 10 with GainAbilityControlledEffect

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

the class VeilOfSummerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    game.addEffect(new GainAbilityControlledEffect(HexproofFromBlueAbility.getInstance(), Duration.EndOfTurn), source);
    game.addEffect(new GainAbilityControlledEffect(HexproofFromBlackAbility.getInstance(), Duration.EndOfTurn), source);
    game.addEffect(new GainAbilityControllerEffect(HexproofFromBlueAbility.getInstance(), Duration.EndOfTurn), source);
    game.addEffect(new GainAbilityControllerEffect(HexproofFromBlackAbility.getInstance(), Duration.EndOfTurn), source);
    return true;
}
Also used : GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) GainAbilityControllerEffect(mage.abilities.effects.common.continuous.GainAbilityControllerEffect)

Aggregations

GainAbilityControlledEffect (mage.abilities.effects.common.continuous.GainAbilityControlledEffect)11 Permanent (mage.game.permanent.Permanent)5 Ability (mage.abilities.Ability)4 BoostControlledEffect (mage.abilities.effects.common.continuous.BoostControlledEffect)4 Player (mage.players.Player)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 GainAbilityControllerEffect (mage.abilities.effects.common.continuous.GainAbilityControllerEffect)3 FlyingAbility (mage.abilities.keyword.FlyingAbility)3 ProtectionAbility (mage.abilities.keyword.ProtectionAbility)3 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)3 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 BeginningOfCombatTriggeredAbility (mage.abilities.common.BeginningOfCombatTriggeredAbility)2 ConditionalInterveningIfTriggeredAbility (mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility)2 FilterCard (mage.filter.FilterCard)2 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)2 HashSet (java.util.HashSet)1 MageObject (mage.MageObject)1 ObjectColor (mage.ObjectColor)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1