Well, here's the thing:
I have a skill called Onslaught. It has a base chance of 70% to apply the state Stun, and this chance is affected by the user's and the target's LUK. This means that if the target's LUK is 500 and the user's LUK is 100, the chance to Stun is just 14% because (a.luk / b.luk) * 70 = 14. Everything is fine with this skill.
But this is the deal: I want to make another skill called Onslaught II, which is an improvement of the first one. Its new effect is that, in top of what after the normal calculations in the basic Onslaught, it also calculates the number of times the user's DEF surpasses that of the target (a.def / b.def), and then multiplies the result by the chance of applying the Stun state (not the base chance, the chance after the LUK calculations).
Taking the previous example to explain myself better: even if the chance to apply Stun is just 14% because the enemy's LUK is far higher than the user's LUK, the user has a much better DEF: he has 200 DEF while his opponent has a mere 50 DEF, which means he has 4 times more DEF than the enemy. The original 14% chance is then multiplied by this number, 4, resulting in a 56% chance to apply Stun, giving him much better odds.
How would I be able to implement this mechanic recurring only to the damage formula? Thanks in advance.
(I also don't want the chance to Stun to be affected when the user's DEF is LOWER than the opponent's DEF. If the multiplying factor is any lower than 1, then it shouldn't affect the chance to Stun at all, simply leave it as it is)
(Also LUK shouldn't be needed in any part of the damage formula, as I've already changed the formula for how the stat works in Game_Battler, which means it affects all the skills in the game)
Apply state when user's DEF surpasses the target's DEF
● ARCHIVED · READ-ONLY
-
-
Actually, luk and the add_state command should be included into the formula.
Code:b.add_state(23) if rand < (0.7 * a.luk / b.luk * [a.def / b.def.to_f, 1].max); a.atk * 4 - b.def * 2
You're not going to modify a skill's effect rate without coding. -
Thanks man, it works pretty well.