Remaining number of turns in damage calculation

I am attempting to make a skill which will deal increased damage based on the number of turns that the enemy still has left of a state, but I cannot find anywhere with the correct way to have this written in the formula box. Does anyone know how to implement it? I have tried "b.getStateTurns(23)" but it presented a bug so obviously that is wrong.

-Edit-
I have figured it out myself Turns out you need to use "b._stateTurns[State Id]" in order to get the number of turns left (I am using yanfly's states and buffs core, may or may not work without it)

Original thread: https://forums.rpgmakerweb.com/threads/remaining-number-of-turns-in-damage-calculation.79085/