We study the twist-field representations of W-algebras and generalize construction of the corresponding vertex operators to D- and B-series. It is shown, how the computation of characters of these representations leads to nontrivial identities involving lattice theta-functions. We also propose a way to calculate their exact conformal blocks, expressing them for D-series in terms of geometric data of the corresponding Prym variety for covering curve with involution.