Ace: adding new end of turn methods in battle

I need a method to run at the end of every turn
Ive been searching in battlerbase but turn and end are...very...common...terms...

where is the code for what happens at the end of each turn?

Update: found the code in Game_battler line 799.. its a method called on_turn_end now to write a method and add/test it.
on_turn_end in Game_Battler runs once in the context of the battler. Means if you have 8 battlers (actors and enemies) it will run 8 times in each battler. If you want to run it once, try to modify Scene_Battle --> turn_end (line 493)
on_turn_end in Game_Battler runs once in the context of the battler. Means if you have 8 battlers (actors and enemies) it will run 8 times in each battler. If you want to run it once, try to modify Scene_Battle --> turn_end (line 493)

thanks theo! saved me some time/frustration already.

My goal is a method which would update placeholder states dependent on current MP% and current states.. but i think id also need a way to make sure two of these states couldnt apply at the same time since im using them to assign animations. assigning the animations to the states is already handled by the graphics side but I need something to see the state..apply the state effect (MP damage) and remove the state/add the next state. such as for example.. poison1 to poison2 to poison3.

me and you have had a similar conversation here before and you provided something im trying to adapt but i think im still missing some things.

Code:
def combo_attack(a,b)
  #--------------------------------------------
  # State ID to check => State ID to add
  # Edit here:
  #--------------------------------------------
  states = {
   14 => 15,
   15 => 16,
   16 => 16,
  }
  #--------------------------------------------
  states.keys.each do |state_id|
   if a.state?(state_id)
     a.remove_state(state_id)
     a.add_state(states[state_id])
     return
   end
  end
  # Else
  a.add_state(14) # <-- Also here
  return  # <-- Also here
end

id imagine it'd be something like..

when a.state?(state_id) || a.mp=>90%

but im struggling to understand the best approach. should i create a second method that toggles out the states when called since it can only be one of them? (if a then not b or c, if b then not a or c... ect.)

I want the method to check for states each turn and if certain states are present check the current MP of the actor and reduce the actors MP
by a quantity assigned in the state note per turn and also remove/assign a new state if the MP value is outside of the range for that state.

state1 might be 90% to 100% MP and damages MP by 10 points per turn
state2 might be 60% to 90% MP and damages MP by 30 points per turn
state3 might be 30% to 60% MP and damages MP by 50 points per turn..

any thoughts?

Original thread: https://forums.rpgmakerweb.com/threads/ace-adding-new-end-of-turn-methods-in-battle.114847/