@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } if (setColor != null) { boolean objectFound = false; for (UUID targetId : targetPointer.getTargets(game, source)) { MageObject targetObject = game.getObject(targetId); if (targetObject != null) { if (targetObject instanceof Spell || targetObject instanceof Permanent) { objectFound = true; targetObject.getColor(game).setColor(setColor); } else { objectFound = false; } } } if (!objectFound && this.getDuration() == Duration.Custom) { this.discard(); } return true; } else { throw new UnsupportedOperationException("No color set"); } }