I'm working on creating a skill that inflicts damage to all enemies, and deals extra damage to enemies that are affected by a debuff or negative state. The code I have doesn't seem to be working, though.
Code:
<After Eval>
target.hasNegEffect = false;
var negEffects = [];
//Negative effects are states 4-14
negEffects.push(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
target.debuffDmg = 1;
//loop through parameters to find a debuff
for (var i = 0; i < 8; i++){
//if the target has any debuff, stop the loop
if (target._buffs[i] < 0){
target.hasNegEffect = true;
break;
}
}
//go into this loop only if the first loop doesn't find any debuffs
//if target.hasNegEffect is true, there's no point searching for anything else
if (!target.hasNegEffect){
for (var j = 0; j < negEffects.size; j++){
var id = negEffects[j];
if (target.isStateAffected(id)){
target.hasNegEffect = true;
break;
}
}
}
//if the target is found to have a negative effect, increase the damage by 45%
if (target.hasNegEffect){
target.debuffDmg = 1.45;
}
</After Eval>
Damage formula:
6000 * b.debuffDmg