Search in sources :

Example 1 with GainControlAllEffect

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

the class RohgahhOfKherKeepEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player == null) {
        return false;
    }
    Cost cost = new ManaCostsImpl("{R}{R}{R}");
    if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.Benefit, "Pay {R}{R}{R}?", source, game) || !cost.pay(source, game, source, player.getId(), false)) {
        TargetOpponent target = new TargetOpponent();
        Player opponent = null;
        if (target.choose(Outcome.Detriment, player.getId(), source.getSourceId(), game)) {
            opponent = game.getPlayer(target.getFirstTarget());
        }
        new TapAllEffect(filter).apply(game, source);
        if (permanent != null) {
            permanent.tap(source, game);
        }
        if (opponent != null) {
            new GainControlAllEffect(Duration.Custom, filter, opponent.getId()).apply(game, source);
            if (permanent != null) {
                ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, opponent.getId());
                effect.setTargetPointer(new FixedTarget(permanent, game));
                game.addEffect(effect, source);
            }
        }
        return true;
    }
    return false;
}
Also used : TapAllEffect(mage.abilities.effects.common.TapAllEffect) FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) TargetOpponent(mage.target.common.TargetOpponent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) GainControlAllEffect(mage.abilities.effects.common.continuous.GainControlAllEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Cost(mage.abilities.costs.Cost) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

Example 2 with GainControlAllEffect

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

the class AshiokSculptorOfFearsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    FilterPermanent filter = new FilterCreaturePermanent();
    filter.add(new ControllerIdPredicate(source.getFirstTarget()));
    new GainControlAllEffect(Duration.Custom, filter).apply(game, source);
    return true;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) GainControlAllEffect(mage.abilities.effects.common.continuous.GainControlAllEffect)

Aggregations

GainControlAllEffect (mage.abilities.effects.common.continuous.GainControlAllEffect)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 Cost (mage.abilities.costs.Cost)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 TapAllEffect (mage.abilities.effects.common.TapAllEffect)1 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)1 FilterPermanent (mage.filter.FilterPermanent)1 ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1 TargetOpponent (mage.target.common.TargetOpponent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1