A fugitive ordered beer and cigars the night before two police officers were murdered because he "knew it was his last night of freedom", a court heard.
Dale Cregan, 29, was the focus of a nationwide manhunt over two other murders before shooting the officers, Preston Crown Court heard.
Mr Cregan denies killing PCs Nicola Hughes, 23, and Fiona Bone, 32, in Greater Manchester last September.
He also denies the murders of David Short, 46, and his son, Mark, 23.
Mr Cregan forced his way into the home of his barber, Alan Whitwell, in Abbey Gardens in Hattersley the night before the murders of the PCs, the court heard.
He was drinking and smoking and tried to obtain cocaine, the jury was told.
Discharged 32 bullets
The following day, he is accused of luring the two PCs to the house with a fake report of a domestic burglary.
Nicholas Clarke QC, prosecuting, said: "Cregan had carefully put into place a plan that he knew would ensure that an unsuspecting police officer or police officers would be sent to the door.
"Cregan knew that the officers who attended would have no idea what would be waiting for them."
He discharged 32 bullets as he shot at the two unarmed officers and then threw a grenade at their bodies as he fled, the court heard.
Mr Cregan is the only one of the 10 men on trial accused of the PC killings.
Five other men are also accused of the murder of Mark Short, and three others of the murder of David Short.
Mr Short was killed in a gun and grenade attack at his home in Clayton in August.
His son, Mark, was shot at the Cotton Tree pub in Droylsden, Manchester, in May as part of a long-running family feud, the court heard.
Anthony Wilkinson, 33, one of those accused of the murder of David Short, told police he "accidentally" fired his gun, the jury was told.
But prosecutors said the Glock's safety features mean this was not possible, adding the shots were "the result of an assassin's deliberate, repeated pulling of the trigger".
Mr Cregan, Mr Atkinson, 35, from Ashton-under-Lyne, Mr Livesey, 27, from Hattersley, Damian Gorman, 38, from Glossop, Mr Hadfield, 28, from Droylsden, and Mr James, 33, from Clayton, are all accused of the murder of Mark Short and the attempted murders of three others in the pub at the time. All six defendants deny the charges.
Accused of the murder of David Short are Mr Cregan, Francis Dixon, 37, from Stalybridge, Anthony Wilkinson, 38, from Manchester, and Jermaine Ward, 24.
All four are also jointly accused of the attempted murder of Sharon Hark on the same day, and a single charge of causing an explosion.
They all deny the charges.
Mr Wilkinson is also charged with possession of a firearm with intent to endanger life and Mohammed Ali, 32, from Chadderton, is accused of assisting an offender. They deny the charges.