Damage enemy group on state leave effect

Beriquer

Warper
Member
Joined
Dec 27, 2016
Messages
4
Reaction score
1
First Language
German
Primarily Uses
Hi, I'm pretty new to javascript and most of the time I'm mix and matching my way through yanflys lunatic mode but now I'm stuck on this one state and I can't get it to work.
I'm trying to recreate the living bomb skill from WoW. Simply a skill that creates a state with a DoT (no problem there). which in return when expiring will damage the whole enemy squad.


I used a mix from yanflys unstable affliction and overheating scripts, but I'm stuck and can't get it to work properly. When the leave effect is triggered, it applies the damage twice plus the normal regeneration effect damage to all enemies.


Maybe someone more profficient could take a look at the code for me.


here's what I'm using:



Spoiler



<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
target._DoT = Math.ceil(origin.mat * 0.50);
</Custom Apply Effect>


<Custom Leave Effect>
// Calculate the damage to be dealt by the formula.
  var dmg = Math.ceil(origin.mat * 3);
// Get the element ID
  var ElementId = 2;
  // Get all living battle members on the battlefield
  var members = user.friendsUnit().aliveMembers().concat(target.friendsUnit().aliveMembers());
  // Loop through each of the members
  for (var i = 0; i < members.length; ++i) {
    // Get the currently looped member
    var member = members;

    // Check if the member exists


    if (member) {


      // Make the member take damage


      member.gainHp(-1 * dmg * member.elementRate(ElementId));


      // Start the damage popup


      member.startDamagePopup();


      // Check if the member is dead


      if (member.isDead()) {


        // If it is, collapse the member


        member.performCollapse();


      }


      // Clear the results


      member.clearResult();


    }


  }


</Custom Leave Effect>





 





<Custom Regenerate Effect>


// Get the element.


var elementId = 2;


// Default the DoT formula.


target._DoT = target._DoT || Math.ceil(origin.mat * 0.50)*user.elementRate(elementId);


// Play an animation on the target.


target.startAnimation(67);


// Reduce the target's HP


target.gainHp(-target._DoT);


// Start the damage popup.


target.startDamagePopup();


// Check if the target is dead.


if (target.isDead()) {


  // Make the target collapse.


  target.performCollapse();


}


// Clear the target's results.


target.clearResult();


</Custom Regenerate Effect>





 





 











 
 

Latest Threads

Latest Posts

Latest Profile Posts

Working on a case. Get all the evidence to prosecute some bad guys. :kaojoy:
But, the game development schedule delayed. :kaoswt2:
The moral of the story: No good deed goes unpunished... I guess...
Except that, nothing to see here. :kaoswt2:
just beat ff7 original for the first time since 2010. having played remake last year, I have a much better appreciation for the original oddly enough. I still like some of the character presentation in remake more, but the original's got a lot going for it.
Ever reach that moment in your life when your juggling a dozen or more projects that you know will never be made but don't have the heart to delete them? Ugh, I hate those moments...
:kaosigh: Why must you hurt me so?
my main character isn't the warrior of light or the chosen one, he's a self righteous, invasive try hard who gets ahead of himself and makes a critical error, resulting in a downward moral spiral that, eventually, leads him to truths that make him a better man, and im DAMN proud of that.

Forum statistics

Threads
111,451
Messages
1,061,205
Members
144,818
Latest member
OMEGASS
Top