Jamie Jackson suffered a severely broken jaw and other injuries to his face when he was attacked at his flat in the town.
Andrew Llewellyn, 49, of High Street, Wem, Marcus Supersad, 26, of Riverside Drive, Tern Hill, and William Bratton 27, of Dalelands Estate, Market Drayton, all deny grievous bodily harm with intent.
Bratton also denies assisting an offender, knowing an offence had taken place.
Shrewsbury Crown Court heard that Mr Jackson had been socialising with Llewellyn prior to the incident on April 7 last year.
Mohammad Hafeez, prosecuting, told the jury that Jamie Jackson had a drug addiction and took cocaine.
He said: "On April 7 they spent most of the afternoon together at a number of places, including the pub. Both ended up at Llewellyn's flat and appeared to be having a good time.
"While at the flat Mr Jackson was shown a Kinder egg containing some cocaine. Llewellyn then hid it away under the bathroom sink."
Mr Jackson returned home later that evening and received a phone call from Llewellyn asking him if he had taken the drugs - something he denied.
The crown then alleges that the defendants, driven by Bratton, arrived at the flat and attacked him.
Mr Hafeez said: "The next thing Mr Jackson remember was being on the floor with police and ambulance staff around him."
He was taken to hospital where he was treated for three fractures to the face and other cuts and bruises.
When he arrived home after being discharged, a neighbour told him he witnessed the attack but was too scared to tell the police.
He described one man as holding a kitchen knife, which the crown believes is Bratton, and another man holding a stone and swinging it towards Mr Jackson's face, which is believed to be Supersad.
The witness and Mr Jackson identified Supersad in an identification line-up.
Mr Jackson told police he recognised Llewellyn in the attack.
Mr Hafeez also told the jury about a recorded conversation between Supersad and his partner while he was in prison on April 21.
He told his girlfriend, 'the brick is too rough to carry the DNA', he also said he would just deny anything to the police and asked her to throw away a pair of tracksuit bottoms and trainers.
"We say this is a joint enterprise and they all played different parts to get the drugs back and pay Jamie Jackson a lesson," Mr Hafeez added.
The trial continues.