I’m interested in making a state which locks the target’s MP to its maximum value for the duration of the state. Is this sort of effect possible to achieve (with or without plugins)?
For context, skills don’t cost MP to use in my project, but certain incoming skills may reduce the target’s MP, amongst other effects. I’m trying to just block all MP reductions on targets with this state.
Thanks!
Easiest way to do this is to give all MP reduction attacks their own element (I call mine Mana), then make it that anyone in this state has the element rate Mana * 0%.
You'll have to code in a conditional check then to avoid that. I don't know the code for that but maybe another poster will?
Update: I think I got it working with Yanfly’s Damage Core! I’ll have to manually put the code into each MP-damaging skill rather than directly into a single state, but otherwise, it’s working the way I’d hoped so far.
The regular damage formula box wasn’t happy about trying to run a conditional branch with the gainMp() command (which could just be user error, honestly), but by using the <damage formula> tags from the Damage Core plugin, I was able to implement the conditional branch successfully. The state itself is just a dummy state with a certain turn duration.
Here’s a simplified version of my code:
<damage formula>
if (target.isStateAffected(44) {
target.gainMp(0);
value = user.atk
}
else {
target.gainMp(-(30 + user.luk));
value = user.atk;
}
</damage formula>
You could probably simplify that like so:
<damage formula>
if (!target.isStateAffected(44) target.gainMp(-(30 + user.luk));
value = user.atk;
</damage formula>
Since user.atk is the same regardless of state, there's no need to have it in both conditional branches and unless I'm wrong, there's no reason to call gainMp if there's no MP adjustment being made. For the damage formula line, you could probably even use this:
if (!b.isStateAffected(44)) b.gainMp(-(30 + a.luk)); a.atk
Here’s the code I was trying to use without the else branch:
<damage formula>
if (!target.isStateAffected(44) && !target.isStateAffected(45) && !target.isStateAffected(46)) {
target.gainMp(-(30 + user.luk));
value = user.atk;
}
</damage formula>
The code above runs normally at first, but as soon as the target is affected by states 44, 45, or 46 (all dummy states, just with different durations), it begins to return 0. If I add the else branch with just value = user.atk; then the skill works properly.