Search in sources :

Example 26 with GainAbilitySourceEffect

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

the class UrzasScienceFairProjectEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        int amount = controller.rollDice(outcome, source, game, 6);
        Effect effect = null;
        // 6 - gets +2/+2 until end of turn";
        if (amount == 1) {
            game.addEffect(new BoostSourceEffect(-2, -2, Duration.EndOfTurn), source);
        } else if (amount == 2) {
            game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source);
        } else if (amount == 3) {
            game.addEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn), source);
        } else if (amount == 4) {
            game.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), source);
        } else if (amount == 5) {
            game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
        } else if (amount == 6) {
            game.addEffect(new BoostSourceEffect(+2, +2, Duration.EndOfTurn), source);
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) PreventCombatDamageBySourceEffect(mage.abilities.effects.common.PreventCombatDamageBySourceEffect) BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Effect(mage.abilities.effects.Effect) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) PreventCombatDamageBySourceEffect(mage.abilities.effects.common.PreventCombatDamageBySourceEffect)

Example 27 with GainAbilitySourceEffect

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

the class WarrenPilferersReturnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(source.getFirstTarget());
    Player controller = game.getPlayer(source.getControllerId());
    if (card != null && controller != null && controller.moveCards(card, Zone.HAND, source, game)) {
        if (card.hasSubtype(SubType.GOBLIN, game)) {
            game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) Card(mage.cards.Card)

Example 28 with GainAbilitySourceEffect

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

the class GiantSlugEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (controller == null || sourcePermanent == null) {
        return false;
    }
    ChoiceImpl choices = new ChoiceBasicLandType();
    if (!controller.choose(outcome, choices, game)) {
        return false;
    }
    game.informPlayers(sourcePermanent.getName() + ":  Chosen basic land type is " + choices.getChoice());
    switch(choices.getChoice()) {
        case "Plains":
            game.addEffect(new GainAbilitySourceEffect(new PlainswalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Island":
            game.addEffect(new GainAbilitySourceEffect(new IslandwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Swamp":
            game.addEffect(new GainAbilitySourceEffect(new SwampwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Mountain":
            game.addEffect(new GainAbilitySourceEffect(new MountainwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        case "Forest":
            game.addEffect(new GainAbilitySourceEffect(new ForestwalkAbility(), Duration.EndOfTurn, false), source);
            return true;
        default:
            return false;
    }
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) ChoiceImpl(mage.choices.ChoiceImpl) ChoiceBasicLandType(mage.choices.ChoiceBasicLandType)

Example 29 with GainAbilitySourceEffect

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

the class ObzedatGhostCouncilReturnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (card == null) {
        return false;
    }
    Player owner = game.getPlayer(card.getOwnerId());
    if (owner == null || !owner.moveCards(card, Zone.BATTLEFIELD, source, game)) {
        // comes back from any zone
        return false;
    }
    game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield), source);
    return true;
}
Also used : Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect)

Example 30 with GainAbilitySourceEffect

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

the class SilverquillPledgemageEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    game.addEffect(new GainAbilitySourceEffect(player.chooseUse(Outcome.Neutral, "Choose flying or lifelink", null, "Flying", "Lifelink", source, game) ? FlyingAbility.getInstance() : LifelinkAbility.getInstance(), Duration.EndOfTurn), source);
    return true;
}
Also used : Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect)

Aggregations

GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)33 Player (mage.players.Player)21 Permanent (mage.game.permanent.Permanent)11 Ability (mage.abilities.Ability)9 MageObject (mage.MageObject)7 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)6 ChoiceImpl (mage.choices.ChoiceImpl)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)5 Choice (mage.choices.Choice)5 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 FirstStrikeAbility (mage.abilities.keyword.FirstStrikeAbility)3 FlyingAbility (mage.abilities.keyword.FlyingAbility)3 HasteAbility (mage.abilities.keyword.HasteAbility)3 TrampleAbility (mage.abilities.keyword.TrampleAbility)3 HashSet (java.util.HashSet)2 AddCardSubTypeSourceEffect (mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect)2 SetPowerToughnessSourceEffect (mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect)2 ProtectionAbility (mage.abilities.keyword.ProtectionAbility)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2