Search in sources :

Example 1 with RampageAbility

use of mage.abilities.keyword.RampageAbility in project mage by magefree.

the class RapidFireEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (controller != null && permanent != null) {
        if (!permanent.getAbilities().containsClass(RampageAbility.class)) {
            ContinuousEffect effect = new GainAbilityTargetEffect(new RampageAbility(2), Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(permanent, game));
            game.addEffect(effect, source);
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) RampageAbility(mage.abilities.keyword.RampageAbility) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 2 with RampageAbility

use of mage.abilities.keyword.RampageAbility in project mage by magefree.

the class GabrielAngelfireGainAbilityEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Choice choice = new ChoiceImpl(true);
        choice.setMessage("Choose one");
        choice.setChoices(choices);
        if (controller.choose(outcome, choice, game)) {
            switch(choice.getChoice()) {
                case "First strike":
                    ability = FirstStrikeAbility.getInstance();
                    break;
                case "Trample":
                    ability = TrampleAbility.getInstance();
                    break;
                case "Rampage 3":
                    ability = new RampageAbility(3);
                    break;
                default:
                    ability = FlyingAbility.getInstance();
                    break;
            }
        } else {
            discard();
        }
    }
}
Also used : Player(mage.players.Player) RampageAbility(mage.abilities.keyword.RampageAbility) Choice(mage.choices.Choice) ChoiceImpl(mage.choices.ChoiceImpl)

Aggregations

RampageAbility (mage.abilities.keyword.RampageAbility)2 Player (mage.players.Player)2 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 Choice (mage.choices.Choice)1 ChoiceImpl (mage.choices.ChoiceImpl)1 Permanent (mage.game.permanent.Permanent)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1