Why don't you add filter trigger in sunken city that drops items that are not for the class of the hero?
Example: item level 1=strength,2=agility,3=intelligence,0=all
Create 3 invisible abilities named 'strength', 'agility','intelligence' and put them to be by default on the heroes. Then with the trigger check the item's level and what ability does the hero have.