use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class DeadIronSledgeDestroyEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(sourceId);
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
if (equipped.getId().equals(event.getTargetId()) || equipped.getId().equals(event.getSourceId())) {
List<Permanent> targets = new ArrayList<>();
Permanent blocker = game.getPermanent(event.getSourceId());
if (blocker != null) {
targets.add(blocker);
}
Permanent blocked = game.getPermanent(event.getTargetId());
if (blocked != null) {
targets.add(blocked);
}
this.getEffects().get(0).setTargetPointer(new FixedTargets(targets, game));
return true;
}
}
return false;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class BreachingLeviathanEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
creature.tap(source, game);
doNotUntapNextUntapStep.add(creature);
}
if (!doNotUntapNextUntapStep.isEmpty()) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class ClingingMistsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_ATTACKING_CREATURES, source.getControllerId(), source.getSourceId(), game)) {
creature.tap(source, game);
doNotUntapNextUntapStep.add(creature);
}
if (!doNotUntapNextUntapStep.isEmpty()) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
game.addEffect(effect, source);
}
return true;
}
Aggregations