use state turns in damage calc?

hey im trying to make a skill that does damage based on the amount of turns remaining in a state (ex. 10 turns left in the state then it does 10 damage) but i just cant seem to figure out how to get it working

im not sure if this is doable with the base damage calculations or if it'd require a script but if anyone knows a good way i'd be happy with either
unlikely to be done without a full script - while you can place code into the damage formula, that field is a bit limited for the calculation you'll likely need.

you'll need a script that either provides specific formulae for this, or one that runs a notetag as an extension to the damage formula to get the space needed.
Something like Yanfly's "Lunatic"-type expansions should be enough, but I don't know which of those scripts (Ace is too long in the past for me)
Hello, here is an untested small script that lets you get the remaining turns of a state on a battler:
Ruby:
#==============================================================================
# Game_BattlerBase
#==============================================================================
class Game_BattlerBase
  #---------------------------------------------------------------------------
  # new method: state_turns -> public access to the remaining turns of a state
  # return 0 if no such state
  #---------------------------------------------------------------------------
  def state_turns(state_id)
    return 0 unless @state_turns[state_id]
    @state_turns[state_id]
  end
end #Game_BattlerBase

You should be able to then use in your damage formula:
a.state_turns(state_id)
b.state_turns(state_id)
To get the remaining turns of the state on the battler, if the state is not here or it has no turn count, then this value will be 0.
looks like its working just how i was trying to get it, i appreciate the help!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/use-state-turns-in-damage-calc.181174/