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