Creation of 'Burn Infusion' spell

I've got a boss that relies heavily on a mechanic of constantly applying a 'burn' status effect that periodically deals damage equal to 5% of the afflicted target's current HP each turn, similar to a poison effect. Usually the burn goes away after five turns, having dealt 25% damage in total. However, I'm trying to give the boss an ability that removes the burn from a burned target, in exchange for dealing all remaining damage instantly. For example, using this 'burn infusion' ability on a target that has already taken 5% damage from the burn will deal the remaining 20% from the four remaining turns, and will remove the burn so that no more damage is applied.

So my two questions are:

  1. How would I go about creating an ability like this?
  2. How would I set the boss to only cast this ability on targets that are burned, and to not cast the ability at all if no-one is burned?
Okay this I think may be the basic structure for it. But it needs tweaking sorry that I couldn't give you something more fleshed out.

Burn infusion 1.png

Burn infusion 2.png
Just use a damage formula.

x = b.mhp * 0.05; y = b.state_turns(state_id); x * yWhere 'state_id' is the id of your burn state.

This way, both actors and enemies will have access to this skill (if you want), without any additional work.

As for question 2, you could set the skill to be AoE since it will only deal damage to characters with the burn state. If that's no good, an enemy target conditions, or enemy ai script would be an easy way to pull this off.

Edit: I forgot you wanted the state removed as well. I fixed it for ya.

Code:
x = b.mhp * 0.05; y = b.state_turns(state_id); b.erase_state(state_id) ? x * y : 0
Hm, so I've got it set up as follows, with 34 being the ID of the burn state.

x = b.mhp * 0.05; y = b.state_turns(34); b.erase_state(34) ? x * y : 0However, it doesn't seem to do any damage at all, regardless of whether or not the state is applied. What have I done wrong?
There is no state_turns method available for battlers by default. You have to define it first using a script like this:

class Game_BattlerBase   def state_turns(state_id)    @state_turns[state_id] || 0  endendThe implementation is a bit simplistic as state turns are always updated at the end of a round after HRG/MRG took effect, regardless of the states auto removeal timing. I don't think this would be a problem in your case though.

As for the  b.erase_state(state_id) ? x * y : 0  part:
While this works fine, erase_state is usually not used as a condition, so I doubt many scripters will pay attention to preserve that feature when modifying that method within their scripts.
 

The chances this will cause problems in your project are very low though, and most state-related scripts probably don't even touch that method anyway. However, in case you experience that such a script messes with your skill, you might consider that issue.

Instead of removing the state via the damage formula, you could've done that using the effects section too.
Ah, thanks! It works perfectly now.

Original thread: https://forums.rpgmakerweb.com/threads/creation-of-burn-infusion-spell.41954/