Have you seen my crusader mod? (it is outdated and probably not working, but the code for this stuff should still be valid).
I made an ability for the crusader which would inflict a debuff (not visible in the unit frame, but had a vfx) only to the undead.
You just have to put in inside the entity_data of the equipment piece, like in the original file where you found that code (it could be in the default weapon json file, or it could be in a skill file like in this example):
crusader_holy_punch_manual.json:
{
"type": "entity",
"components": {
"stonehearth:equipment_piece": {}
},
"entity_data": {
"stonehearth:combat:melee_attacks": [
{
"name": "holy_punch",
"effect": "holy_punch",
"active_frame": 20,
"cooldown": 2000,
"priority": 1,
"bonus_dmg_multiplier": 1.0
}
],
"stonehearth:buffs": {
"inflictable_debuffs": {
"infection": {
"uri": "crusader:buffs:crusader:holy_light",
"chance": 0.5
}
}
}
}
}
For the undeads the inflictable debuff seems to be in a mixin on their base file, so it would inflict the debuff no matter the weapon they’re using, but I assume you want to restrict it to a certain job or something.