MV I've made a Splash Damage Skill, But It's not perfect.

Skill does 100%(1000) damage to one enemy.
And it does half the damage(500) to all the other enemies.

I've found some information about this,
There was only more evolved information.
like.. chain lighting(The damage is reduced by moving one by one.)
or bouncing bullet?(跳彈:도탄사격,I don't know how to translate it into English.)

Perhaps there are no questions because it is too easy to make this formula.
Nevertheless, I'm having a hard time making it.
Because my Java scripting ability is really zero.

I used the chain lighting formula of Yanfly Target core

Below are the formulas(My adjusted formula) and links(Original).
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
<Damage Formula>
// Set the chain multiplier to a value if it doesn't exist.
this._chainmultiplier = this._chainmultiplier || 1.0;
// This is the damage formula.
value = 1000;
// Apply the chain multiplier to the damage formula.
value *= this._chainmultiplier;
// Reduce the chain multiplier per target.
this._chainmultiplier -= 0.5;
</Damage Formula>

<Custom Target Eval>
// Adds the selected target to the target list.
targets.push(target);
// Grab the group of alive foes as candidates.
var members = foes.aliveMembers();
// Remove the target from the group of candidates.
members.splice(members.indexOf(target), 3);
// This is the number of extra targets to select with Chain Lightning.
var extraTargets = 3;
// Loop the extra targets.
while (extraTargets--) {
// Grab a random foe from the alive foes.
var member = members[Math.floor(Math.random() * members.length)];
// Check to see if the member exists.
if (member) {
// Add the member to the group of targets.
targets.push(member);
// Remove the member as a viable candidate.
members.splice(members.indexOf(member), 1);
}
}
</Custom Target Eval>

<Enemy or Actor Select>
-----------------------------------------------------------------------------------------------------

Skill damage is 1000.
The rest have to suffer 500 damage.

It actually works quite accurately.

However, allways two enemies, not one, suffer 1,000 damage.
I don't know why this is happening.
I made a splash damage skill recently as well. If you prefer, you can use my script instead.
Spoiler: Lunatic
<Custom Target Eval>
targets.push(target);
target.addState(state id);
var members = foes.aliveMembers();
members.splice(members.indexOf(target), 1);
targets.push(...members);
</Custom Target Eval>

<Pre-Damage Eval>
if (!target.isStateAffected(state id)) value *= 0.5;
</Pre-Damage Eval>
Be sure to replace "state id" with the ID of a new state. This state can be mostly blank, but you must add "Remove by Damage" (100%). Skill scope must be "1 Enemy" too.
I made a splash damage skill recently as well. If you prefer, you can use my script instead.
Spoiler: Lunatic
<Custom Target Eval>
targets.push(target);
target.addState(state id);
var members = foes.aliveMembers();
members.splice(members.indexOf(target), 1);
targets.push(...members);
</Custom Target Eval>

<Pre-Damage Eval>
if (!target.isStateAffected(state id)) value *= 0.5;
</Pre-Damage Eval>
Be sure to replace "state id" with the ID of a new state. This state can be mostly blank, but you must add "Remove by Damage" (100%). Skill scope must be "1 Enemy" too.

It can't work better than this.

Muchas gracias!

+Edit
Do you know how to delete the following animation?

There's no problem with the system.
But It seems more appropriate to have only one visual explosive animation.
It can't work better than this.

Muchas gracias!

+Edit
Do you know how to delete the following animation?

There's no problem with the system.
But It seems more appropriate to have only one visual explosive animation.
If you are using action sequences, then you can do something like:

<target action>
if (target.isStateAffected(id))
action animation
end
</target action>

<whole action>
action effect
</whole action>

But I'm on mobile for the time being so I can't check.
If you are using action sequences, then you can do something like:

<target action>
if (target.isStateAffected(id))
action animation
end
</target action>

<whole action>
action effect
</whole action>

But I'm on mobile for the time being so I can't check.

Thank you again.

It works perfectly!

I'm planning to make separate splash animation.
by adjusting the code you gave me.

Original thread: https://forums.rpgmakerweb.com/threads/ive-made-a-splash-damage-skill-but-its-not-perfect.131129/