Here's something I'll add to this project once its working right:
Weapons having the ability to inflict ailments on enemies! https://drive.google.com/open?id=1r8_sDoWdHwGeFNV0tbhVsvpICnxJdaAb
Here's the bank_C.asm file with all the code I've edited. There's a lot of other changes, not all of them documented well--I didn't expect this to need to be read by anyone else.
But there seems to be some difficulties in figuring out the proc rates? I can't find issues when I go through a debugger with it, but I don't have time to play through and test different combinations of weapon ailments, enemy resistances, weapon elements, and enemy elemental weakness/resistances... Apparently certain combinations of these make the proc rate super low, even if the player's base chance is set at #200 in the code.
Edit: It turns out due to the debugger not counting the header, and probably my own blindness, the wrong byte was being tested... and it turns out this all works!
To find the bits most important to the issue, look for "BNE @DoEnemyAilmentChance" and "STA btl_attacker_attackailment" (the one under "@SaveAilment:")
In this, the high 4 bits of the enemy's category are their resistance to weapon-inflicted ailments, while the low 4 bits are more what the original game uses categories for. So:
$8x = Enemy is resistant to Stone
$4x = Enemy is resistant to Confuse
$2x = Enemy is resistant to Stun
$1x = Enemy is resistant to Poison
Likewise, the weapon's category works the same, $8x being that it has a chance to inflict Stone on an enemy.
The original enemy vs. player chance calculations are there: Enemy starts with 100, it subtracts the player's magic defense, then rolls 0-200 and compares against that.
For players, they should have a base chance of #20 per hit, no chance if fighting Fiends or Chaos, and #1 if the enemy resists the weapon's ailment with their category high bits. Then it goes on to do the 0-200 roll and compare against that again.