Here is my code for reference:
What I have here is just a basic healing effect that heals over time. if I were to add a "-" to (regen), it would instead deal damage (and would be displayed as (-regen) instead). What I want to be able to do is make an effect that can change it's damage or healing based on actions received.
For example, the above example heals for 1% of the user's max HP per turn, but maybe if you receive physical damage (element 1), the amount of healing it does should be increased to 2% instead.
Alternatively, supposed you were to take Shadow damage (let's say element 9), and that effect weakens healing taken, so it should instead reduce the amount of healing to 0.5% of the user's max HP per turn. Of course, this can be done already by modifying the user's element rate, since the above formula already performs a check against the elementrate, but what if I want to be able to do it without having to do that?
I don't know exactly how it would have to be written, but I'm inclined to believe it should be possible to do using if statements.
If this can be done, I would like to try to take it one step further and make it so when a modifier is run to increase or decrease the effect, it also increases a number (either a number unique to this formula, or a variable, it doesn't matter), and the point of this number would be to limit the number of times the effect can be increased or decreased.
<Custom Apply Effect>
if (target._stateTurns[36] >= 50) {
target._stateTurns[36] = 50;
}
</Custom Apply Effect>
// The above snippet is used to control the maximum duration of the state (in this case, state 36 has a cap of 50 turns)
<Custom Regenerate Effect>
// The formula for the regeneration effect. In this case, it uses the user's max HP, divides by 100 (to make it 1%),
// checks against the elementRate of element 12, rounds everything down, then increases the total by 1.
var regen = Math.floor(origin.mhp / 100 * target.elementRate(12)+1);
// Make the user gain HP.
user.gainHp(regen);
// Show the HP healed.
user.startDamagePopup();
// Clear the user's results.
user.clearResult();
</Custom Regenerate Effect>
if (target._stateTurns[36] >= 50) {
target._stateTurns[36] = 50;
}
</Custom Apply Effect>
// The above snippet is used to control the maximum duration of the state (in this case, state 36 has a cap of 50 turns)
<Custom Regenerate Effect>
// The formula for the regeneration effect. In this case, it uses the user's max HP, divides by 100 (to make it 1%),
// checks against the elementRate of element 12, rounds everything down, then increases the total by 1.
var regen = Math.floor(origin.mhp / 100 * target.elementRate(12)+1);
// Make the user gain HP.
user.gainHp(regen);
// Show the HP healed.
user.startDamagePopup();
// Clear the user's results.
user.clearResult();
</Custom Regenerate Effect>
What I have here is just a basic healing effect that heals over time. if I were to add a "-" to (regen), it would instead deal damage (and would be displayed as (-regen) instead). What I want to be able to do is make an effect that can change it's damage or healing based on actions received.
For example, the above example heals for 1% of the user's max HP per turn, but maybe if you receive physical damage (element 1), the amount of healing it does should be increased to 2% instead.
Alternatively, supposed you were to take Shadow damage (let's say element 9), and that effect weakens healing taken, so it should instead reduce the amount of healing to 0.5% of the user's max HP per turn. Of course, this can be done already by modifying the user's element rate, since the above formula already performs a check against the elementrate, but what if I want to be able to do it without having to do that?
I don't know exactly how it would have to be written, but I'm inclined to believe it should be possible to do using if statements.
If this can be done, I would like to try to take it one step further and make it so when a modifier is run to increase or decrease the effect, it also increases a number (either a number unique to this formula, or a variable, it doesn't matter), and the point of this number would be to limit the number of times the effect can be increased or decreased.