Im trying to make a set of skills based off Negative Ions,
When a target is affected by this state: Negative Ions, a portion of that damage will be shot off and hit another random target. After that, Negative Ions is removed.
However my skill has 2 steps;
Skill 111-113: Apply state 40, if state 40 is applied deals 50% of DMG dealt to a random enemy and removes state.
I use a custom script for my DMG formulas basically
Now I have other skills that apply this state but I only want Skills 111-113 to do the random DMG.
Under state 40 I have this code, it checks to see if the attack was from Skill 111/112/113.
The problem im having is that whenever I use skills 111-113 it does the 50% dmg right away, it all happens at the same time applies the state then does the bonus effect. I dont know the code that could check after dmg but before the state is added.
I need to separate the timing so that casting this skill on a target without state 40 will apply state 40 and DMG. But when state 40 is already on the target from any source, thats when the skill now does DMG plus random enemy takes 50% of the primary damage.
When a target is affected by this state: Negative Ions, a portion of that damage will be shot off and hit another random target. After that, Negative Ions is removed.
However my skill has 2 steps;
Skill 111-113: Apply state 40, if state 40 is applied deals 50% of DMG dealt to a random enemy and removes state.
I use a custom script for my DMG formulas basically
Code:
if (b.isStateAffected(40)) {
b.removeState(40); }
else {
b.addState(40);
}
Under state 40 I have this code, it checks to see if the attack was from Skill 111/112/113.
Code:
<Custom Respond Effect>
if (this.isSkill() && user.currentAction().item().id === 111 || this.isSkill() && user.currentAction().item().id === 112 ||this.isSkill() && user.currentAction().item().id === 113){
if (target.result().hpDamage > 0) {
var dmg = Math.ceil(target.result().hpDamage * 0.50);
var group = target.friendsUnit().aliveMembers();
group.splice(group.indexOf(target), 1);
var member = group[Math.floor(Math.random() * group.length)];
if (member) {
member.startAnimation(76);
member.gainHp(-dmg);
member.startDamagePopup();
if (member.isDead()) {
member.performCollapse();
}
member.clearResult();}
}
}
</Custom Respond Effect>
I need to separate the timing so that casting this skill on a target without state 40 will apply state 40 and DMG. But when state 40 is already on the target from any source, thats when the skill now does DMG plus random enemy takes 50% of the primary damage.