How does たり + される work?


In a particular story, one character is getting tortured, and his friend, who
was betrayed by him, says this:

> 普通敵にしたりされるようなことを友達にされるってのはどんな気分だ?

I can infer that the speaker is saying something along the lines:

> How does it feel, having done it by a friend what you normally do to your
> enemies?

How does 敵にしたりされる work here? Does it really mean "What you do to your enemies
(and such)" or "What you are done by your enemies (and such)" ?




I think your understanding is correct. 普通敵にし **たり** されるようなこと is the same as
普通敵にし **たり** され **たり** するようなこと. The second たり is omitted, which is common in
recent informal speech.

> 普通敵 **に** したりされるようなこと  
>  = 普通敵 **に** したりされたりするようなこと
>
> things that [you] normally do **to** or are done **by** an enemy

This is a shorter way of saying two things:

> 普段敵にするようなことや、普段敵にされるようなこと
>
> things you normally do to an enemy _and_ things you are normally done by an
> enemy

From an English perspective, に may seem to have the function of "to" and "by"
at the same time, but it's the same に in Japanese.

So a literal translation of the entire sentence would be:

> [普通敵にしたりされるようなことを友達にされる]ってのはどんな気分だ?
>
> How does it feel like when [things that you normally do **to** or are done
> **by** an enemy are done by your friend]?  
>  → How does it feel like when a friend does something to you that you'd
> usually expect from an enemy?

