My project uses a number of Yanfly plugins, and using some of them, I was trying to recreate the "Cover" effect from the final fantast series. What it does in FF is that the user manually selects a ally to cover and whenever that target is attacked, the user intercepts the attack and takes it instead as if they were its target, also using their stats for the damage calculation. Its similar to the substitute effect, but unlike substitute, it only effects the one selected ally and the ally does not need to be at low hp to trigger.
the way I was trying to go about it was that attacks meant for the cover target would be entirely redirected to the user instead of intercepting the attack. If anyone has any pointers on how this can be better implemented it would be appreciated.
I already have a weaker version of cover i called conceal that redirects half of the damage taken by the target to the user through custom react effects. But it only redirects a portion of the damage. It doesnt recalculate the skill's damage to check what the guardian would have taken with their defense stats. It doesnt give the guardian any of the ailments/debuffs the skill would have given the target. It just pushes half of the damage the target took to the guardian.
I wanted Cover to be different in that the entire attack essentially gets retargeted to the cover user, special effects and all.
I had the effect broken into 3 states. This is the note for the skill itself.
This one goes on the guardian when cover is used.
This one goes on the target of the cover skill:
and this one is applied to all enemies through the aura on the first state. it was supposed to carry out the effect.
The problem here is that I hadnt realized that the "target" within <custom action start effect> returns the user currently acting, not the target of the skill being used. I tried using the currentAction() of the user to get the skill and then tried to check the target through the skill's ._targetIndex, but its always -1. i cant use the index to check if the attack is actually aimed at the covered actor in order to redirect it. Any ideas as to how to continue with this?
the way I was trying to go about it was that attacks meant for the cover target would be entirely redirected to the user instead of intercepting the attack. If anyone has any pointers on how this can be better implemented it would be appreciated.
I already have a weaker version of cover i called conceal that redirects half of the damage taken by the target to the user through custom react effects. But it only redirects a portion of the damage. It doesnt recalculate the skill's damage to check what the guardian would have taken with their defense stats. It doesnt give the guardian any of the ailments/debuffs the skill would have given the target. It just pushes half of the damage the target took to the guardian.
I wanted Cover to be different in that the entire attack essentially gets retargeted to the cover user, special effects and all.
I had the effect broken into 3 states. This is the note for the skill itself.
Code:
<After Eval>
user._ward = target;
user.addState(458);
target.addState(459);
</After Eval>
<Cooldown: 8>
<Select Conditions>
Not User
</Select Conditions>
This one goes on the guardian when cover is used.
Code:
<Custom Remove Effect>
user._ward.removeState(stateId+1);
user._ward = undefined;
</Custom Remove Effect>
<Alive Foe Aura: 460>
This one goes on the target of the cover skill:
Code:
<Custom Apply Effect>
user._guardian = origin;
</Custom Apply Effect>
<Custom Remove Effect>
user._guardian.removeState(stateId-1);
user._guardian = undefined;
</Custom Remove Effect>
and this one is applied to all enemies through the aura on the first state. it was supposed to carry out the effect.
Code:
<Custom Action Start Effect>
var action = user.currentAction();
if(action.isForOpponent() && action.isDamage() && action.isForOne()){
if(target.isStateAffected(stateId-1)){
action.setTarget(target._guardian.index());
}
}
</Custom Action Start Effect>
The problem here is that I hadnt realized that the "target" within <custom action start effect> returns the user currently acting, not the target of the skill being used. I tried using the currentAction() of the user to get the skill and then tried to check the target through the skill's ._targetIndex, but its always -1. i cant use the index to check if the attack is actually aimed at the covered actor in order to redirect it. Any ideas as to how to continue with this?