use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.
the class TangleEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
doNotUntapNextUntapStep.add(permanent);
}
if (!doNotUntapNextUntapStep.isEmpty()) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.
the class GuardianOfTazeemEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent land = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (land != null && targetCreature != null && land.hasSubtype(SubType.ISLAND, game)) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that creature");
effect.setTargetPointer(new FixedTarget(targetCreature, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.
the class CodeOfConstraintEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
if (AddendumCondition.instance.apply(game, source)) {
new TapTargetEffect().apply(game, source);
game.addEffect(new DontUntapInControllersNextUntapStepTargetEffect(), source);
}
return true;
}
use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.
the class ExertedThisTurnWatcher method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
if (exertOnlyOncePerTurn) {
MageObjectReference creatureReference = new MageObjectReference(creature.getId(), creature.getZoneChangeCounter(game), game);
ExertedThisTurnWatcher watcher = game.getState().getWatcher(ExertedThisTurnWatcher.class);
if (watcher != null && watcher.getExertedThisTurnCreatures().contains(creatureReference)) {
return false;
}
}
if (controller.chooseUse(outcome, "Exert " + creature.getLogName() + '?', "An exerted creature won't untap during your next untap step.", "Yes", "No", source, game)) {
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " exerted " + creature.getName());
}
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, creature.getId(), source, source.getControllerId()));
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", creature.getControllerId());
effect.setTargetPointer(new FixedTarget(creature, game));
game.addEffect(effect, source);
}
}
return false;
}
use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.
the class MisstepEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, player.getId(), game)) {
doNotUntapNextUntapStep.add(creature);
}
if (!doNotUntapNextUntapStep.isEmpty()) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", player.getId());
effect.setText("those creatures don't untap during that player's next untap step");
effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
Aggregations