Lets say that Vic is on trial for murder, and Bob was present when Vic made some incriminating statement or action which implicates Vic and Bob's testimony is crucial to convincing a Jury of Vic's guilt. Bob is friends with Vic and doesn't wish to testify against him, but the court subpoenas him and compels him to testify. Bob is not going to perjure himself or otherwise break the law for his friend, but wishes to minimize the harm to Vic his testimony may cause.
Can Bob intentionally make himself look like a non-credible witness, to greatly limit the degree that the jury trusts Bob's testimony? I'm referring to something like showing up for the trial drunk and disheveled, speaking in slang and broken English, tossing out random/irrelevant statements or acting confused, Saying things like, "The police told me they thought I witnessed the crime, who am I to argue with the police?" or, "They threatened to throw me in jail if I didn't say I saw Bob do that so I'm here to say I saw it." (I.e., something that is accurate but may leave jury wondering if the pathetic Bob is just saying what the police want him to).
Assuming the police could prove intentional attempt to ruin one's own credibility would any, or all, of the above be illegal? What options would a lawyer have at trial if a less blatant example of someone showing up disheveled and acting incompetent, where the lawyer suspects it's intentional but it's not so blatant to cause a mistrial, to address the attempt to do something like this?