Have you played Shin Megami Tensei?
I did not, and that is why I asked that question. As a general rule of thumb, never ask for skills that exist in a certain game. Doing so means that the reader must have played the said game to understand your question, greatly limiting the amount of potential helpers.
That said, here is how I would do that.
How to empower the next attack/spell
If the skills empowers the next attack/spell, you can just apply a state that only lasts for 1 turn (in my example I am going to use state 61). Once you have done that, you have to change each skill available to actors that can be affected by that state and add this to their formula box:
Code:
r = formula_goes_here; a.state?(61) ? (a.remove_state(61); r * 2) : r
Just change
"formula_goes_here" with any formula you want for that particular skill.
Spoiler: Example using the formula of the Attack skill
Applying what I said to the Attack skill would look like this:
Code:
r = a.atk * 4 - b.def * 2; a.state?(61) ? (a.remove_state(61); r * 2) : r
- - - - - - - - - - - - -
How to reflect spells
To reflect spells you have to force an action against the user. To do that you have to store both the user and the original target. This is requires another check in the formula, and you have to do this for every existing skill that can be reflected. First of all pick a variable (in my example I am going to use variable 32) and store the required information in it, then modify your skill formula. In the following example, the ID of my reflect state is going to be 54.
Code:
v[32] << [a, b, skill_id_goes_here]; r = skill_formula_goes_here; b.state?(54) ? (b.remove_state(54); 0) : r
This goes under the assumption that you initialize your variable as an array at the beginning of the battle using the following script call in a troop event:
After you do that, you can call a common event from your skill that forces actions on the the caster until the array is empty. The script call to do that is the following:
Code:
while ($game_variables[32].length > 0)
action = $game_variables[32].pop
next if (action[0].dead? || action[1].dead?)
target_array = (action[0].actor? ? $game_party.members : $game_troop.members)
target_index = 0
target_array.each_index do |i|
if (target_array[i] == action[0])
target_index = i
break
end
end
action[1].force_action(action[2], target_index)
end
Personal tip
While the code you should write in common events and troop events can take a lot of space, the one you can write in the formula box is quite limited. If you have a skill that needs both those changes, the formula is going to take a lot of space. For that reason, I recommend placing those things in a small script (or a variable, just anything that can take a bigger number of characters) and evaluate that text instead. This will break the limits of formula boxes.