Eval Collection: Share Damage

Untitled1

Any incoming damage will be evenly distributed among all living members.

Requirements:

♦ YEP_BuffsStatesCore.js

  1. Create a new state.
  2. Use the following notetag:

<Custom React Effect>
// Split the damage
value = Math.floor(value / $gameParty.aliveMembers().length);
// Start loop
for (var i = 0; i < $gameParty.aliveMembers().length; i++) {
var actor = $gameParty.aliveMembers()[i];
// Ignore actor if the actor is the target (= Don't damage the target twice)
if (actor === target) { continue };
// Actor loses HP
actor.gainHp(-value);
actor.startDamagePopup();
actor.clearResult();
// Collapse Actor if dead
if (actor.isDead()) { actor.performCollapse() };
};
</Custom React Effect>

 

 

Advertisements

2 thoughts on “Eval Collection: Share Damage

  1. Use this:

    <Custom React Effect>
    // How many percent of the damage should be split?
    // 1.0 = 100%; 0.5 = 50%; 0.25 = 25%; ...
    var split = 1.0
    // Apply split rate
    var partyDamage = Math.floor(value * split);
    value = Math.floor(value * (1.0 - split));
    // Split the damage
    var partyLength = Math.max(1, $gameParty.aliveMembers().length - 1);
    partyDamage = Math.floor(partyDamage / partyLength);
    // Start loop
    for (var i = 0; i < $gameParty.aliveMembers().length; i++) {
    var actor = $gameParty.aliveMembers()[i];
    // Ignore actor if the actor is the target (= Don't damage the target twice)
    if (actor === target) { continue };
    // Actor loses HP
    actor.gainHp(Math.floor(-partyDamage));
    actor.startDamagePopup();
    actor.clearResult();
    // Collapse Actor if dead
    if (actor.isDead()) { actor.performCollapse() };
    };
    </Custom React Effect>
    

    Edit Line 4 to your liking.

    Like

Write a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s