is there a way to replace the loot tables of only the mobs that were hit by a certain item

i mean like run a function asat a dying entity right before they die
Continue to help post